android - Filter alpha with ColorMatrixColorFilter -
i want filter color colormatrixcolorfilter. have code working but... doesn't work alpha.
static private colormatrixcolorfilter getfilter(int backgroundcolor, int foregroundcolor) { float rb = (float) (color.red(backgroundcolor)) / 255; float gb = (float) (color.green(backgroundcolor)) / 255; float bb = (float) (color.blue(backgroundcolor)) / 255; float rf = (float) (color.red(foregroundcolor)) / 255; float gf = (float) (color.green(foregroundcolor)) / 255; float bf = (float) (color.blue(foregroundcolor)) / 255; float[] colortransform = { rb - rf, 0, 0, 0, rf * 255, 0, gb - gf, 0, 0, gf * 255, 0, 0, bb - bf, 0, bf * 255, 0, 0, 0, 1, 0 }; colormatrix colormatrix = new colormatrix(colortransform); return new colormatrixcolorfilter(colormatrix); }
how can alpha ? because here, alpha "1".
thanks.
Comments
Post a Comment