I have an image loaded into an Image
control and I'd like to know the most efficient way that I can darken/lighten the image programatically.
views:
213answers:
2
+1
A:
Check out Adobe's BitmapFilter class. You can do some pretty cool things with it. Especially take a look at its derived classes and their usage examples.
Robusto
2010-04-29 17:47:11
Thanks Robusto, the ColorMatrixFilter and ShaderFilter both work great - and there are a lot of other things as well!
Jason W
2010-04-30 13:00:28
A:
Although I went with Robusto's method, I also found this that works well
var a:Number = value * 11;
var b:Number = 63.5 - (value * 698.5);
redValue = greenValue = blueValue = a;
redOffset = greenOffset = blueOffset = b;
var cmf:ColorMatrixFilter = new ColorMatrixFilter(a, 0, 0, 0, b, 0, a, 0, 0, b, 0, 0, a, 0, b, 0, 0, 0, 1, 0);
It was taken from here, Image Manipulation In Flex and there is much more image altering fun as well.
Jason W
2010-04-30 13:03:00