Results 1 to 3 of 3
-
May 2nd, 2012, 01:15 AM #19Registered User
postscopying masked bitmap onto another bitmap
I'm having a bit of a problem copying the masked only pixels from one bitmap onto another. Basically I'm masking bitmap A with bitmap B, which is working fine, but I'm unsure how to copy just the masked pixels onto Bitmap C which is the only one I want to keep.
how would I go about just copying or drawing or maybe merg() just the masked texture so its copied over the planter graphic where the dirt should be? Any and all help will be greatly appreciated! :]Code://all this works fine var _texture:Bitmap = new Bitmap(new Dirt_Bitmap); var _mask:Bitmap = new Bitmap(new Mask_Bitmap); var _planter:Bitmap = new Bitmap(new Planter_Bitmap); _texture.cacheAsBitmap = _mask.cacheAsBitmap = true; _texture.mask = _mask; //This is where things get weird :[ var newBitmap:Bitmap = new Bitmap(new BitmapData(50, 50, true)); newBitmap.bitmapData.copyPixels(_texture.bitmapData, _texture.bitmapData.rect, new Point()); _planter.bitmapData.copyPixels(_newBitmap.bitmapData, _newBitmap.bitmapData.rect, new Point());
-
May 2nd, 2012, 02:14 AM #2
Have you tried using BitmapData#draw instead of copyPixels?
-
May 2nd, 2012, 03:58 AM #39Registered User
postsyes - the result is whatever I masked is gone so it simply draws all of the texture onto my final bitmap instead of simply the masked pixels. :/

Reply With Quote


Bookmarks