A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Bitmap Caching Bitmaps

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    Bitmap Caching Bitmaps

    Currently working on a game that reqires a lot of mc's on the screen at one time. They are all PNG images and i know what Bitmap cahing dose with vectors.

    But... Dose it give any performace boost if i bitmap cach my PNG images?

    I figured that bitmaps were automaticly cached, so in theroy its caching each bitmap twice?
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  2. #2
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Well it won't help if you cache each PNG seperatly..

    But if you have like many PNG's that don't change it's position, you
    could put them all in one MovieClip, and chache that clip as bitmap.

    Bitmap caching gives you a performance boost, if the content does not
    change and you don't rotate/skew/resize.
    Hope you understand my krautenglish...
    My letters on the F1 key have faded, how are yours today?

  3. #3
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Can you explain that more, how to use it, maybe an example. I'm just not getting the cache bitmap thing at all.

  4. #4
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    It is quite easy, as far as i understood.
    If you have some vectors anywhere, the Flashplayer gotta make pixels outta those vectors to display them. On each frame, the player renders, he calculates those pixels again. If you now tell the player, that the vectors won't change (and nothing more you actually do, setting cacheAsBitmap to true) the player can reuse those already calculated pixels.

    If you understood this,it is quite easy to get, when you can't use this caching:
    If you want to move the vectors only half a pixel, they have to be rerendered, as
    the pixels changed. Same goes for resizing, skewing rotating, well everything, when the pixels can't be reused.

    This gets really effective, if you have a vector graphics, which is replicated over and over again and is only moved around or put a filter on..
    As for filters: the player has to use a cached bitmap anyways..

    Much more i don't know about it.


    [edit]
    See the "Bitmap cache [5]" section of frantos collected links
    http://www.franto.com/blog2/collecte...strom-examples
    for examples.. how much faster .. great!

    [edit2]
    Damn those Paralax examples are down... In his example he
    cached PNGs/Vectors and moved them in a 3d like environment,
    performance boost of factor 30 in fps...

    But the magaris example is still up:
    http://www.margaris.de/flash8/bitmap/bitmapcache.html

    [edit 3]
    In the magaris example the yellow "blobs" are cached for each size
    once, just b4 u ask, how he did the resizing
    Last edited by McUsher; 11-26-2005 at 05:50 PM.
    My letters on the F1 key have faded, how are yours today?

  5. #5
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    I'll have to try it. So this won't make the swf any smaller, but will make it easier on the processor to render it?

  6. #6
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Exactly.. it is only about frames per second.
    My letters on the F1 key have faded, how are yours today?

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center