inspirit / GPUImage

AS3 framework for GPU-based image processing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Request] ColorMatrix for Filters

summers314 opened this issue · comments

Hi, Im trying to make a similar library for Android. It accepts ColorMatrix of 5x4 size , but the filters & effects here are not of that format. Could you convert them to 5x4 or explain how to?

5x4 :
[ 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:

R’ = a_R + b_G + c_B + d_A + e;
G’ = f_R + g_G + h_B + i_A + j;
B’ = k_R + l_G + m_B + n_A + o;
A’ = p_R + q_G + r_B + s_A + t;

That resulting color [R’, G’, B’, A’] then has each channel clamped to the 0 to 255 range.