Today I've got something not very spectacular but nevertheless quite useful: a demo of my ColorMatrix class. The new ColorMatrixFilter is a very versatile tool that allows for many color manipulations, many more than the good old ColorTransform was capable of. The only problem with the filter is that in order to use it you will have to feed it with a ColorMatrix which in pratice is an array of 20 elements. Not really the most intuitive way, but that's the price for its flexibility.
Fortunately there's lots of documentation all over the web on how those ColorMatrices work and what numbers you have to put where in order to achieve a certain effect like adjusting the contrast, creating a greyscale version or roating the hue of an image. The ColorMatrix class takes care for all the matrix operations that are necessary to achieve those effects. Here is a little demo of some of its possibilities:
There are some nice things possible that you cannot do with Photoshop. For example setting the saturation to -100 will invert the colors but not the luminance. Or setting the contrast to -200 will invert the image. The little grid on the right side allow to remap the RGBA channels of the image, so for example you can create an alpha channel from the combination of red+green+blue channel. For some effects the application order of the effects is important. In this demo the order is hardwired: hue - saturation - contrast - brightness - alpha - threshold (if selected) - channel mapping.Posted at September 12, 2005 05:37 PM | Further reading