I can’t get drawing a Sprite to a Bitmap to work on android. Is this not implemented or am I just doing something terribly wrong?
class Main extends Sprite {
public function new () {
super ();
var size = new Point( 400, 300 );
var circle = new Sprite();
circle.graphics.beginFill( 0xFF0000 );
circle.graphics.drawCircle( 100, 100, 40 );
circle.graphics.endFill();
var bitmapData = new BitmapData( Std.int(size.x), Std.int(size.y));
bitmapData.draw( circle );
var bitmap = new Bitmap( bitmapData );
bitmap.y = size.y+1;
addChild(circle);
addChild(bitmap);
graphics.beginFill( 0, 0 );
graphics.lineStyle( 1, 0 );
graphics.moveTo( 0, size.y );
graphics.lineTo( size.x, size.y );
graphics.endFill();
}
}
Does it work when you target Windows/Mac/Linux (whatever your machine is)? How about Neko? All of those ought to use the same renderer, and they’re all easier to debug than Android.
Displays a black rectangle for me, which I assume is tied to [this][1]. It may also be interesting to note the black rectangle is the size of the bitmap data, rather than the size of the filled rectangle.
class Main extends Sprite {
public function new () {
super();
var bitmapData = new BitmapData( 400, 400);
bitmapData.fillRect( new Rectangle( 0, 0, 40, 40 ), 0xFF336699 );
var bitmap = new Bitmap( bitmapData );
addChild(bitmap);
}
}