This class will allow you to create a pixellated copy of any display object.
It allows for varying pixel sizes and caching of rendered pixels so you don’t have to redraw them every time.
Usage is as follows:
var myMoz:Mosaic = new Mosaic(yourDisplayObj:DisplayObject, pixelSize:uint, useCache:Boolean);
addChild(myMoz);
or
var myMoz:Mosaic = new Mosaic(yourDisplayObj);
myMoz.pixelSize = 10;
myMoz.render();
Give it a try and let me know what you think.
Pingback: Actionscript Classes » Bitmap Mosaic
Very cool
Pingback: combinecreative.com » Blog Archive » AS3 bitmap mosaic class
Hello,
Nice job but i have a problem trying to use it in Full Browser. I put a mosaic image in background (full browser), and the image is supposed to resize when i resize my window. It works well but the mosaic image sometimes draw horizontal and vertcal outlines around the mosaics…
Is it normal ? Is it possible to fix it ?
Thank You !
Cédric from Montreal…
[Cedric, your stage scale mode is probably set to EXACT_FIT which is the default. To fix this you should set it to NO_SCALE. Of course after doing that you'd need to listen for a RESIZE event from the Stage and do all your other element's resizing manually through code. Hope this helps - JK]
hey there!
I’m trying to use this class but I get this error:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
Any help?
Cheers!
Hi julian,
Nice work, though I thought to change it a bit.
You can have a look here.
http://gfxcomplex.com/MosaicFilter.zip
I like the use of graphics better, because you can use the clear() method to clean old graphics faster then you can using removeChild() and creating extra vars for holding pixels.
That and I added most stander compliant coding. I would not recommend using public vars ever.
PS: I run the AS3 User group in st.Louis, you should come to visit. Your a good code, but I think you could use some help on standers.
oh yeah here’s the link to as3 apex http://as3apex.com
One thing missing now though is the caching I had built in. That way once you draw a 10px Mosaic, you can access it again at any time without redrawing it.
The BitmapData.draw() only happens once. Thats the slowest method of the class.
I have got this to work with video at 3 pixel size at 60fps with no problem
this is really fast, the only thing I could think to make this work faster would be to use a Vector class.
I guess I would need to see a real world use where I would need the cashed shape.
I Just updated the zip again. this Time I did it with pixel bender. super fast!
Note: this only work with flash 10.
If you don’t have flash 10, I could show you how to use flash develop with the flex 4 sdk to compile flash 10 for free.
Thanks, I need this class,
Pingback: Mosaic effect | Aleksey Matveev blog
thanks this is very good class .
Pingback: Mosaic Class, different tests at Helpful stuff
hi Julian.
I like it alot.
nice Class
been doing a short set of experiments:
http://www.campjohn.dk/wp/?p=1146
guess I’ll be using this a lot in the future.
thanks
felisan
Hey Julian.
This is really cool, but do you know if this can be done with a png that has a transparent background?
Cordially
Vayu
Hi again.
I actually found the answer to my own question about the transparent png.
In the Mosaic.as I changed the getPixel function to getPixel32.
var color:uint = bmd.getPixel(colorX , colorY);
to
var color:uint = bmd.getPixel32(colorX , colorY);
Let me know if there is a problem with this.
Pingback: 8 Classical ActionScript Classes About BitMap - Ntt.cc
Pingback: 8?bitmap??? | ??-????
Pingback: RIACOOL'BLOG | 8?bitmap???
Pingback: AS???????? « Deepin 3000
Pingback: AS???????? « Deepin 3000
Pingback: 8 Classical ActionScript Classes About BitMap | Adobe Show Center
Pingback: AS???????? ? Ase7en’Blog
Pingback: 8?bitmap??? « echo "RenYuan's Blog"
Pingback: AS3?????????????? | AS3??
Pingback: AS???????? | ???????
Pingback: as518.com