i've heard that you can write your own filters for bitmaps that can can be applied at runtime. basically what i want to do is take a picture that the user uploads, up the contrast 100% so it's basically black and white, and then convert it to two colors. ideally i would be apple to set the blend mode to "multiply" so the white would go away.
is this possible? i'm trying to search the help but it's very difficult since i don't know what i'm looking for. :(
thanks in advance!
Generated from a webcam snapshot.

Is that what you were after?
Usage:
import com.snepo.util.colour.TwoTone; import flash.display.BlendMode; import flash.display.Bitmap;
var canvas : BitmapData = TwoTone.generate( source ); // source is a movieclip in this case, but any DisplayObject will work var bitmap : Bitmap = new Bitmap ( canvas ); bitmap.blendMode = BlendMode.MULTIPLY;
addChild ( bitmap );
lithium, i love you so much! you just saved me about a million years of work. also, how you been? long time no see! the last time i talked to you was when you and scotty were in town from australia and that was a long time ago.
btw, sort of related,
you can also load an image in the IDE, onto the stage, get it how you want it using the IDE filter controls, and put it off stage. Then just copy the filter array to the incoming pic.
This is handy for creating buttons which are samples of the effect with very little code.
I do this on a graffiti app which adds automatic drop shadow, outline and fill effects with little buttons which are literally the source of the filter arrays themselves.
Am i making sense. it's midnight.
are you saying that i can get an example photo like how i want in the ide with filters, blend modes, etc, in the ide, then access that later via actionscript to apply to a user uploaded photo?
i'm sure i'll have lots more questions, this project is kind of my personal kick in the ass to get up to date on as3. it's hard for me to keep up these days now that i really only use flash for prototyping, which doesn't require the cleanest, most beautiful code in the world.
but this is a fun project (little interactive for a battlestar galactica exhibit at the emp science fiction museum here), so i couldn't say no.
Originally posted by: jessica are you saying that i can get an example photo like how i want in the ide with filters, blend modes, etc, in the ide, then access that later via actionscript to apply to a user uploaded photo?
yes.
I have 5 buttons on the stage. Each has a little picture in it. I use the filter sections of the properties panel to modify each button with a style I want to apply to the image the user is editing.
Then it's an uber tiny bit of code. It's also then super easy to make new styles and add them to your application.
public function styleButton(event:MouseEvent){ var sourceClip = event.currentTarget; workSpace.canvas.filters = sourceClip.filters; }
style1Button.addEventListener(MouseEvent.MOUSE_DOWN, styleButton); style2Button.addEventListener(MouseEvent.MOUSE_DOWN, styleButton); style3Button.addEventListener(MouseEvent.MOUSE_DOWN, styleButton); style4Button.addEventListener(MouseEvent.MOUSE_DOWN, styleButton); style5Button.addEventListener(MouseEvent.MOUSE_DOWN, styleButton);
//a button with no styles applied has the words "remove style" blankStyleButton.addEventListener(MouseEvent.MOUSE_DOWN, styleButton);
that's awesome. i think this is going to be a super fun little project.
So what happened?