No real masking with BitmapDataUnlimited

It would have been too cool if there weren’t any limits with BitmapDataUnlimited, but unfortunately I have to tell you that there are limits.
For a recent project I needed an alpha mask greater than 2880px. The problem is that applying an alpha mask requires the cacheAsBitmap property of both the mask and the masked Sprite to be true, but for DisplayObjects greater than 2880px you can’t activate Bitmap caching or at least it’s ignored.

I have tried to apply a filter to the Sprites which normally forces Bitmap caching but it didn’t work out either. The next idea was to use BlendMode.ALPHA instead of a real mask but still no success. So the only working solution for the moment is to render a Bitmap and place it in front of the other layers. very oldschool but it works.

If you know a better solution please let me know.



3 Responses (Add Your Comment)

  1. Can you cut the mask and the display object up into tiles, apply the mask parts to the separate tiles and then write it back to the bitmapdataunlimited?

  2. slicing up the display object isn’t very handy I guess, but should work.

    If I get you right you want to apply a mask directly to the BitmapData in order to have a transparent Bitmap. This will work with BitmapDataUnlimited without the slicing.

  3. example:

     
    // bitmapDataImage -> your image
    // bitmapDataMask -> your mask
     
    // merge image layer with mask layer:
    // the transparent regions in the mask Bitmap will be 
    // transparent in the result image as well
    bitmapDataImage.draw( new Bitmap(bitmapDataMask), 
                          new Matrix(), 
                          null, 
                          BlendMode.ALPHA, 
                          bitmapDataMask.rect);

Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Other Entries

About

Martin Rädlinger is an Interactive Developer & Designer. He specializes in interactive coding predominantly with ActionScript, but every new challenge is welcome. If you like his work feel free to get in touch with him. At the moment he's available for freelance work.

Contact

Martin Rädlinger
mail: mr [at] formatlos.de
web: www.formatlos.de
xing: Martin Rädlinger
linkedin: Martin Rädlinger
skype: martinraedlinger