开发者

Why would bitmap outperform vector, as3?

开发者 https://www.devze.com 2022-12-28 15:24 出处:网络
Why would bitma开发者_如何转开发p outperform vector? My Flash is for a large Kiosk, with rich media requirements and must function accurately as a counter. I want to keep everything vector for scalab

Why would bitma开发者_如何转开发p outperform vector?

My Flash is for a large Kiosk, with rich media requirements and must function accurately as a counter. I want to keep everything vector for scalability.

When I did a simple FPS test, I noticed my Bitmap version performed perfectly, and the all vector file was noticeably slower.

PLEASE EXPLAIN

• vector performance

• what graphic standards I can apply

• solutions for using vector


KIOSK TEST ANIMATION

alt text http://www.ashcraftband.com/myspace/videodnd/daemonfps.jpg


RESULTS

• only text and bitmap perform well, not vector

• background and clouds OK, but more layers slow it down


Its really quite logical when you get your head around what a vector is.

A vector is a visual representation of the computer plotting many points on the screen and joining the dots and colouring it in. This is a the reason why vectors look good scaled up as well as down.

A bitmap as your probably aware - in flash is regarded as pixel data. Something thats just picture stuff.

When the screen renderers vectors, at every screen redraw it must plot and map and recreate the vector - each time working it out. With bitmap, - well, its a picture and therefore saves all that computing power trying to redraw complicated objects and plot 100's of points.

You caching everything as vector, you will not notice a difference in the slighest. Anything you've drawn on the stage - check the 'cache as bitmap' checkbox, and any new item produced in the code and added as a child, cacheAsBitmap = true on every visual thing.

There is a great little trick that should work a treat here.

You can still use your vectors. However, when adding them to your stage, check the 'cache as bitmap' checkbox underneath the display settings in the properties panel.

in the code you can write

myCloud.cacheAsBitmap = true

That property is available for every visual object.

This works best when the objects you have on the stage are doing simple things like spinning and fading - it tends to not be as effecient when performing movieclip nested animations and similar stuff, as of course, the object will still need to be redrawn at every frame. Although you will still see a big improvement.


here are some urls on the from googling 'as3 cache as bitmap'

http://www.adobe.com/devnet/flash/articles/bitmap_caching_03.html

live docs for displayObject - you'll see it 3 down in the first table.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObject.html

0

精彩评论

暂无评论...
验证码 换一张
取 消