TwelvestoneFlash

actionscript bitmap filters


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
jessica
 
2010-09-23

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!

lithium
 
2010-09-24

Generated from a webcam snapshot. http://dl.dropbox.com/u/1181433/12s/twotone.png

Is that what you were after?

Source

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 );

jessica
 
2010-09-24

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.

persist
 
2010-09-24

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.

jessica
 
2010-09-24

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. k 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.

persist
 
2010-09-24

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);

jessica
 
2010-09-27

that's awesome. i think this is going to be a super fun little project.

arigato
 
2010-10-26

So what happened?

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

actionscript bitmap filters