开发者

How to understand and choose values when working with ColorMatrix?

开发者 https://www.devze.com 2023-03-08 14:02 出处:网络
I have read the ColorMatrix documentation and it says the following: 5x4 matrix for transforming the color+alpha components of a Bitmap.

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 开发者_如何学Pythona 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?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号