MovieMix is a Class transcribed by another Class of the author Sascha on blog.hexagonstar.com
Its mission is to turn a regular bitmap into animated bitmap. I was surprised and delighted to extend it, From there, I've developed based on the Hexagonstar's AnimatedBitmap in the first version.
In the AnimatedBitmap, data input into is a BitmapData(ImageSequence a horizontal line)
Corresponds to rendering:
//thisbuffer as ImageSequence a horizontal lineIn the MovieMix, data input into is a list BitmapData that stored in DataMix.
bitmapData.copyPixels(thisbuffer, new Rectangle((framenr - 1) * onwidth, 0, onwidth, onheight), new Point());
Corresponds to rendering:
var db:BitmapData = listbitmap[framenr - 1]; // listbitmap as Array
bitmapData.copyPixels(db,db.rect,new Point(0,0));
Oh yes, reading from Array list to get BitmapData, maybe you'll appreciate it not better by shifting the position, because the process of reading data in an array will take the CPU processing time,
you're right but be assured, processing time there is will not come up too costly in the case of small array.
Anyway, here is a great performance tester written by author Nicolas.
http://bimeanalytics.com/projects/performance_tester/performanceTester.html
And here is my demo:
| MovieMix with data is Array of the BimapData |
MoviePix
To expand my method to render data I write a different class, instead of read from Array as MovieMix, I'll write to read from BitmapData, Bitmap is an ImageSequence(multi line) and I named it as MoviePix.
For the process of writing a BitmapData and reading BitmapData is the same correlative, I created a "Big BitmapData" in DataMix (read more wiki DataMix version 1.0.0.4 here) and readed same method:
var thisframe:Number = framenr - 1;The above method rended by shifting the position, you can fully trust that it runs lighter then reading from the array.
var sizeW:Number = this.width;
var sizeH:Number = this.height;
var bufW:Number = thisbuffer.width;
var bufH:Number = thisbuffer.height;
var column:Number = bufW / sizeW;
var x:Number = ( thisframe % column ) * sizeW;
var y:Number = Math.floor( thisframe / column ) * sizeH;
//thisbuffer as Image sequence multi lines
bitmapData.copyPixels(thisbuffer, new Rectangle(x, y, sizeW, sizeH), new Point());
For demo to easily imagine.
| MoviePix with data is a big of the BimapData |
Flowchart:
![]() |
| DataMix offers two types of data, an Array BitmapData and a Big BitmapData |
Reference:
http://blog.odcup.com/2011/12/movieclip-to-animated-bitmap.html
http://blog.hexagonstar.com/animatedbitmapclass/
http://bimeanalytics.com/projects/performance_tester/performanceTester.html
http://jacksondunstan.com/articles/479

0 comments:
Post a Comment