2 Replies Latest reply on Jan 7, 2010 8:38 PM by KontaCat

    Copy BitmapData Paste to Canvas


      //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