Source on github:
KDrawSprite draws your vector image onto a bitmap image. You don't need to manipulate cacheAsBitmapMatrix and cacheAsBitmap properties. These are powerful, however, sometimes make our app crashed erratically. You need take more care for iPad which has larger screen but has less memory.
How To Use ThisSimply call KDrawSprite.getSprite() instead of setting cacheAsBitmapMatrix and cacheAsBitmap properties.
var sprite:Sprite = new Sprite();Bitmap operations such as moving, scaling and rotation will be GPU enabled.
sprite.graphics.drawCircle(50, 50, 50);
// sprite.cacheAsBitmapMatrix = new Matrix(); // BEFORE
// sprite.cacheAsBitmap = true;
sprite = KDrawSprite.getSprite(sprite); // AFTER
sprite.x = 100;
sprite.y = 100;
sprite.scaleX = 0.5;
sprite.height = 50;
sprite.rotation = 1;
KDrawSprite will also free memory of image rendered when it comes out of the Stage.
You need call getSprite() or draw() method whenever you make changes on the vector source image. This also means any other needless re-rendering will not be invoked. Learn more on document.
Super Sampling Anti-Aliasing (2x SSAA)KDrawSprite supports 2x SSAA, super sampling anti-aliasing, in addition to NoAA per default.
NoteTo get better performance and rendering quality, you MUST set stage.quality as StageQuality.LOW. Also use 2x SSAA when needed.
stage.quality = StageQuality.LOW; // must
* Japanese version of this post is here.