bali33 Posted October 6, 2014 Share Posted October 6, 2014 Hi guys, I can't find any documentation about the ColorMatrixFilter - It's a 4x4 Matrix but what represent each value inside it ? Thank you Quote Link to comment Share on other sites More sharing options...
pongstylin Posted October 6, 2014 Share Posted October 6, 2014 I've stared at that thing for a long time. It's similar to the flash documentation on their 4x5 matrix. But it's missing the 5th column (offset), which is a source of frustration for me.http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filters/ColorMatrixFilter.html Every pixel's color and alpha values are multiplied in the matrix. The following matrix produces no change in the pixel. R G B AR 1 0 0 0G 0 1 0 0B 0 0 1 0A 0 0 0 1 So let's say I have a pixel with the following color: 0x010203 and alpha of 1 and pass it through a matrix like this:2.0 0.0 1.0 00.0 0.5 0.0 00.0 0.0 0.0 00.0 0.0 0.0 1The pixel's new value will be calculated as follows:R = 2*1 + 0*2 + 1*3 + 0*1;G = 0*1 + 0.5*2 + 0*3 + 0*1;B = 0*1 + 0*2 + 0*3 + 0*1;A = 0*1 + 0*2 + 0*3 + 1*1; Which is 0x050100 with an alpha of 1. Essentially, we removed all the blue and doubled the red and added even more redness where there used to be blue. The green was reduced by half. Common use cases include brightening/darkening an image (multiply all colors by an equal amount above/below 1) and grayscale an image (multiply all colors together). And if that is still confusing I defer to a random article I found:http://code.tutsplus.com/tutorials/manipulate-visual-effects-with-the-colormatrixfilter-and-convolutionfilter--active-3221 Quote Link to comment Share on other sites More sharing options...
bali33 Posted October 7, 2014 Author Share Posted October 7, 2014 That all make sense now, thank you ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.