View Single Post
Old 04-22-2013, 09:53 AM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,031

The color matrix is technically modifying the whole bitmap, but since the bitmap is made up of Black and White, you only see the White X being affected.

What the color matrix is doing scaling the red, green and blue portions of all the pixels to a value between 0 and 100 percent of themselves.
Since Black has Red, Green and Blue componenets with values of zero, any percentage of 0 is still 0.
Since White is made up of 100% Red, Green and Blue, then any percentage given to any of those three values will reduce that component by that amount directly affecting the result of the white color.

If you were to use this example with a bitmap that wasn't strickly Black and White, then the results would be quite different, but generally predictable. The code can only reduce a given color's components, so if you reduced the Red component by 50%, pixels that were pure red would be darkened. Colors with Red in them, such as yellow, would shift to a color with less red, towards brown. Colors with no red in them, such as Cyan or Green, would not be affected.
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote