this would be the most elegant solution i presume (with source
being you BitmapData
):
const rc:Number = 1/3, gc:Number = 1/3, bc:Number = 1/3;
source.applyFilter(source.bitmapData, source.bitmapData.rect, new Point(), new ColorMatrixFilter([rc, gc, bc, 0, 0,rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, 0, 0, 0, 1, 0]));
with flash.geom::Point
and flash.filters::ColorMaxtrixFilter
...
ColorMatrixFilter
allows many things, such as hue shifts, colorisation, lightening, darkening and desaturation and so on ... otherwise BitmapData::paletteMap
and BitmapData::colorTransform
are good complements ...
just wanted to note, that using the following
const rc:Number = 1/3, gc:Number = 1/2, bc:Number = 1/6;
looks a little more natural, since subjectively, #00FF00
is brighter than #FF0000
, which in turn is brighter than #0000FF
good luck then ... ;)
greetz
back2dos
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…