//Create a bitmap 110x110 pixels
var bmd:BitmapData = new BitmapData(110, 110, false);
//Copy a rectangular region from src_bitmap to bmd
bmd.copyPixels(src_bitmap, new Rectangle(0, 0, 110, 110), new Point(0, 0));
//Draw the bitmap on top of a canvas as follows
my_canvas.graphics.drawRect(400, 200, wd, ht);
The rectangular region is copied but it is tiled. I tried
my_canvas.graphics.beginBitmapFill(bmd, null, false)
but in this case the bitmap is not drawn correctly
how can I copy a rectangualr region from a source bitmap
and paste on top of a canvas at a specific x,y ?
or how can I fix the above problm. if you take a look at the pic below
I was trying to copy the upper left corner but the result is a tiled
You can look at the trunk version of mx.graphics.BitmapFill.begin for some ideas. You need to make sure your source bitmap is not translated. If it is, then you can use the BitmapData.draw function to pass in a transform matrix.
Thank you for the response. I appreciate that.
I am a Flex Beginner. I appreciate if you elaborate on the suggestion
that you provided. my source bitmap aligns with the canvas so I do not
think it is translated.