Jump to content
Search Community

blitMask disappears when bitmapMode = true [HELP]

Applauz test
Moderator Tag

Recommended Posts

For some reason .. as soon as I set bitmapMode = true my image vanishes.

 

I tried setting to false by default and then creating a temp timer to trigger setting bitmapMode to true after 5 seconds.

 

Sure enough when the timer sets bitmapMode to true .. the image disappears.

 

 

Am I missing something here ?

Link to comment
Share on other sites

It sounds like your image vanishes because at the time you create the BlitMask, your target is actually blank. Certain components in Flash have funky behavior that prevents them from rendering immediately (they may take 1 extra frame to actually render, sometimes even 2). That has nothing to do with BlitMask. But of course if your target is blank when BlitMask does its capture of all the pixels, you'll get blank pixels. The solution is to either create your BlitMask after you're sure your target has properly rendered (maybe wait a frame or two), or force a recapture of the pixels by calling update(null, true) on the BlitMask. Notice the second parameter is true - that forces the recapture.

Link to comment
Share on other sites

ok. So I did what you suggested. and it works. However .. it is taking 3 seconds for it to capture the bitmap and display it.

 

I'm starting to think that blitMasking just can't handle the large image sizes needed for the iPad Retina Display.

 

I'm trying to use blitMask on an image that is over 25,000 pixels in width scaled at 50% ... so when its on the iPad3 .. its actually 50,000 pixels.

 

This has to be why its taking so long to capture.

 

If I put 1 single image 1024 x 768 or event 2048 x 768 and use the exact same code.. it captures instantly.

Link to comment
Share on other sites

Yes, it's a LOT of work to capture that many pixels, but keep in mind that there's a big trade-off in terms of scrolling performance after the bitmap is captured. That's the whole point of BlitMask. Without it, Flash has to keep rendering all those extra pixels on every frame whenever you move the target even if they're off the screen. That's wasted CPU cycles. The more pixels Flash has to render, the slower things go. BlitMask, however, creates a capture once (takes some time for huge images) but then it only pulls the ones that should be visible inside the masked area as you're scrolling. This can result in massive performance gains during the scroll. But again, there is a trade off in initial capture (which happens once at the beginning, unless you scale/rotate the target or need to recapture because child elements changed).

 

If you're getting great performance without BlitMask, then feel free to dump it. As you can see in the videos on the BlitMask page, it delivers some pretty substantial performance gains in iOS for scrolling though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...