The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 3 of 3

Thread: copying masked bitmap onto another bitmap

  1. #1

    copying 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.

    //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());
    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! :]

  2. #2
    Have you tried using BitmapData#draw instead of copyPixels?

  3. #3
    yes - 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. :/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012