Package | net.kawa.display |
Class | public class KDrawSprite |
Inheritance | KDrawSprite flash.display.Sprite |
Method | Defined By | ||
---|---|---|---|
KDrawSprite(autoDispose:Boolean = true)
Creates a new KDrawSprite instance. | KDrawSprite | ||
dispose():void
Frees memory of the internal bitmap image. | KDrawSprite | ||
draw(source:DisplayObject, quality:Number = 1):void
Draws the source DisplayObject onto the internal bitmap image. | KDrawSprite | ||
getBitmapData(source:DisplayObject, quality:Number = 1):BitmapData [static]
Draws the source DisplayObject as a bitmap image. | KDrawSprite | ||
getSprite(source:DisplayObject, quality:Number = 1):Sprite [static]
Draws the source DisplayObject as a bitmap image. | KDrawSprite |
KDrawSprite | () | Constructor |
public function KDrawSprite(autoDispose:Boolean = true)
Creates a new KDrawSprite instance.
ParametersautoDispose:Boolean (default = true ) — Specifies whether internal BitmapData will be disposed by KDrawSprite when removed from Stage.
|
dispose | () | method |
public function dispose():void
Frees memory of the internal bitmap image. Call this when autoDispose is false.
draw | () | method |
public function draw(source:DisplayObject, quality:Number = 1):void
Draws the source DisplayObject onto the internal bitmap image.
Parameters
source:DisplayObject — Source DisplayObject to draw. Ex. Sprite, Shape, etc.
| |
quality:Number (default = 1 ) — Rendering quality. The default is 1 (NoAA). 2 means 2x SSAA, super sampling anti-aliasing.
|
var view:KDrawSprite = new KDrawSprite(); addChild(view); var work:Sprite = new Sprite(); work.graphics.beginFill(0xFFCC99); work.graphics.drawRect(0, 0, 100, 100); view.draw(work);
getBitmapData | () | method |
public static function getBitmapData(source:DisplayObject, quality:Number = 1):BitmapData
Draws the source DisplayObject as a bitmap image. Returns it as a BitmapData object.
Parameters
source:DisplayObject — Source DisplayObject to draw. Ex. Sprite, Shape, etc.
| |
quality:Number (default = 1 ) — Rendering quality. The default is 1 (NoAA). 2 means 2x SSAA, super sampling anti-aliasing.
|
BitmapData — A BitmapData object rendered.
|
var bitmap:Bitmap = new Bitmap(); addChild(bitmap); var shape:Shape = new Shape(); shape.graphics.beginFill(0xFFCC99); shape.graphics.drawRect(0, 0, 100, 100); bitmap.bitmapData = KDrawSprite.getBitmapData(shape);
getSprite | () | method |
public static function getSprite(source:DisplayObject, quality:Number = 1):Sprite
Draws the source DisplayObject as a bitmap image. Returns it as a Sprite object.
Parameters
source:DisplayObject — Source DisplayObject to draw. Ex. Sprite, Shape, etc.
| |
quality:Number (default = 1 ) — Rendering quality. The default is 1 (NoAA). 2 means 2x SSAA, super sampling anti-aliasing.
|
Sprite — A Sprite object which has a Bitmap image rendered.
|
var sprite:Sprite = new Sprite(); sprite.graphics.beginFill(0x336699); sprite.graphics.drawCircle(50, 50, 50); sprite = KDrawSprite.getSprite(sprite); addChild(sprite);
var sprite:Sprite = new Sprite(); sprite.graphics.beginFill(0x336699); sprite.graphics.drawCircle(50, 50, 50); // sprite.cacheAsBitmapMatrix = new Matrix(); // BEFORE // sprite.cacheAsBitmap = true; sprite = KDrawSprite.getSprite(sprite); // AFTER addChild(sprite); sprite.x = 100; sprite.y = 100; sprite.scaleX = 0.5; sprite.height = 50; sprite.rotation = 1;