Understanding AS3 ColorMatrixFilter class
2009-10-27 00:00:00 来源:WEB开发网Do you want to apply color correction to images into your Flash movies on the fly?
Then ColorMatrixFilter is the class you need.
The ColorMatrixFilter class lets you apply a 4 x 5 matrix transformation on the RGBA color and alpha values of every pixel in the input image to produce a result with a new set of RGBA color and alpha values.
The color matrix filter separates each source pixel into its red, green, blue, and alpha components as srcR, srcG, srcB, srcA.
To calculate the result of each of the four channels, the value of each pixel in the image is multiplied by the values in the transformation matrix.
It allows saturation changes, hue rotation, luminance to alpha, and various other effects.
For more information visit the official Adobe docs page.
Around the web you can find a lot of examples of photos loaded with Flash and sliders to change colors, but I want to explore this feature from a coding point of view.
I will make some experiment on this photo I found on Flickr
The first thing is creating a MovieClip with the image inside. I called it cats, so with this simple code I display the cats on the stage:
Tags:Understanding AS ColorMatrixFilter
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接