Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to understand and choose values when working with ColorMatrix?

I have read the ColorMatrix documentation and it says the following:

5x4 matrix for transforming the color+alpha components of a Bitmap.

The matrix is stored in a single array and its treated as follows:

[ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t ]

When applied to a color [r, g, b, a], the resulting color is computed as (after clamping)

  • R' = aR + bG + cB + dA + e;
  • G' = fR + gG + hB + iA + j;
  • B' = kR + lG + mB + nA + o;
  • A' = pR + qG + rB + sA + t;

I know how to get the result but I still have some questions:

  1. What is the value of color [r, g, b, a], is color [r, g, b, a] calculated by system?
  2. I know that a d c d and so on can be negative values. What is the difference between positive values and negative values.
  3. I have no graphic knowledge it is very hard to get a satisfactory image, I have to usual try many times to get a good result. Are there any tools or website that can give some guidance on how to get the valve of [a b c d..t] possibly with examples?
like image 729
pengwang Avatar asked May 27 '11 07:05

pengwang


1 Answers

If I'm guessing right you want some information about color matrices. I've found some sites that explain it in detail.

It's not Android or Java related but it should be usefull to get the point across.

  • Understanding the Use of ColorMatrix and ColorMatrixColorFilter to Modify a Drawable's Hue

  • Color Transformations and the Color Matrix

  • ColorMatrix Basics - Simple Image Color Adjustment
like image 131
Nallath Avatar answered Oct 28 '22 23:10

Nallath