for example i got
var spriteA = new Sprite();
var spriteB = new Sprite();
Is there a way to blend them together(possibly with different blend options) and receive spriteC as result?
Well, you could:
- blt() the bitmaps of both sprites and a 3rd bitmap and create a Sprite from it.
- Use PIXI.RenderTexture, render both sprites on it, create a new Bitmap from its Base64 representation and create a Sprite from it (more complicated, but might be faster).
Also, you could maybe create a PIXI filter from one sprite and apply it to the other one, but i don't know if that works across both Canvas and WebGL.
ok - then another question
context.save();
context.fillStyle = color;
context.fillRect(x1, y1, x2, y2);
context.restore();
something like that will make rectangle and fill it with color (u can play with gradients and so on here too)
but how to fill it with image in rmmv - i seen some examples how to make it in html5 using context.drawImage(img,x,y,w,h);
but i cant figure out how to make rmmv to load my image in to img here.
You usually don't directly with the canvas, but with Bitmap and Sprite objects (or the underlying pixi objects, but most of the time you don't need this). If you want to display a picture, you would do it like this:
var sprite = new Sprite(Bitmap.load('img/enemies/Angel.png'));scene.addChild(sprite);Where "scene" is the current scene (usually "this", because you are adding images inside a scene's "create" function).The first part create a Bitmap object from the given image and creates a sprite from it. The second part adds the sprite to the scene, because it wouldn't be visible, otherwise.
yap - but i need to compose it from different images before i addchild it
or more accurate - i got it already composed from moving primitives (like rectangle scripts posted above and gradient patterns) - now i want to blend image directly in to it, and affect of blanding it as addchild or darken whole image to much or partially override it depends from blending option, so i thought to merge background with image first and then render it with other objects.
allthough now i got an idea to cut background from pixi rendered sprite and try to blend it with my image as sprite too - thanks for hint.