Tony Polinelli
Tarwin Stroh-Spijer

contact [at]
touchmypixel.com

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

CopyPixels for BigAssCanvas

We needed to copy out the BitmapData from a BigAssCanvas so i added this to bit101s class. It doesnt really work like BitmapData's copyPixels - as that copys pixel INTO the bitmap object, so i've named it copyPixelsOut and it returns a new bitmapData of the rect.

You will notice the red lines at 2880 when you move the viewable region over them the data you are given is atually sourced from 2 bitmapData objects (inside the BigAssBitmap).

PS: Thanks to Jonno from Something Splendid for helping me when my maths brain had disappeared.

Its basically :

Actionscript:
  1. public function copyPixelsOut(rect:Rectangle, transparent:Boolean=true, fillColor:uint=0xff000000 ):BitmapData
  2. {
  3. var bitmapData:BitmapData = new BitmapData(rect.width, rect.height, transparent, fillColor);
  4.  
  5. for(var i:int = 0; i <_bitmaps.length; i++)
  6. {
  7. var bmp:Bitmap = _bitmaps[i] as Bitmap;
  8. var temp:Rectangle = rect.clone();
  9. temp.x -= bmp.x;
  10. temp.y -= bmp.y;
  11.  
  12. if(temp.intersects(new Rectangle(0,0,2880,2880))){
  13. bitmapData.copyPixels(bmp.bitmapData, temp, new Point());
  14. }
  15. }
  16.  
  17. return bitmapData;
  18. }

One comment


  1. [...] Touch My Pixel Blog Games + Web « CopyPixels for BigAssCanvas [...]

 

Leave a Reply

Our Friends:

Powered by haXe / poko cms | Copyright 2008-09 TouchMyPixel