Ganzimaro

Villager
Member
Joined
Aug 24, 2016
Messages
11
Reaction score
0
First Language
Ukrainian
Primarily Uses
RMMV
Hello. I decided to try other ways of creating an interface. Question! How to turn "PIXI.Container" into "Bitmap". It is known that when you use "cacheAsBitmap", "Bitmap" is obtained from the container, but how to interact with it now? How to transfer it in a "Sprint"?

Who has any ideas?
 

Ganzimaro

Villager
Member
Joined
Aug 24, 2016
Messages
11
Reaction score
0
First Language
Ukrainian
Primarily Uses
RMMV
var container = new PIXI.Container();
container.addChild(...);

function getBitmapContainer(container, width, height) {
var bitmap = new Bitmap(width, height);
var context = bitmap._context;
var renderTexture = PIXI.RenderTexture.create(width, height);
Graphics._renderer.render(container, renderTexture);
var canvas = Graphics._renderer.extract.canvas(renderTexture);
context.drawImage(canvas, 0, 0);
renderTexture.destroy({ destroyBase: true });
bitmap._setDirty();
return bitmap;
};

var snap = getBitmapContainer(container, 400, 500);
var sprite = new Sprite(snap);
this.addChild(sprite);

The topic can be considered closed.
 

Latest Threads

Latest Posts

Latest Profile Posts

Valentines Entry, first contest I'm in and it is so much fun to just participate!
Anatomy is really hard. I'm not an artist.
just destroyed hours of work again. i don't know why I bother.
World Map for the inside of my main character's head. Every spot is an area that either occupies his thoughts or staples of everyone's "headspace"

Forum statistics

Threads
109,000
Messages
1,041,148
Members
141,467
Latest member
ribzypooh
Top