Lines Matching refs:matrix

27 void GetBrightnessMatrix(float amount, SkScalar matrix[20]) {
31 memset(matrix, 0, 20 * sizeof(SkScalar));
32 matrix[0] = matrix[6] = matrix[12] = amount;
33 matrix[18] = 1.f;
36 void GetSaturatingBrightnessMatrix(float amount, SkScalar matrix[20]) {
39 memset(matrix, 0, 20 * sizeof(SkScalar));
40 matrix[0] = matrix[6] = matrix[12] = matrix[18] = 1.f;
41 matrix[4] = matrix[9] = matrix[14] = amount * 255.f;
44 void GetContrastMatrix(float amount, SkScalar matrix[20]) {
45 memset(matrix, 0, 20 * sizeof(SkScalar));
46 matrix[0] = matrix[6] = matrix[12] = amount;
47 matrix[4] = matrix[9] = matrix[14] = (-0.5f * amount + 0.5f) * 255.f;
48 matrix[18] = 1.f;
51 void GetSaturateMatrix(float amount, SkScalar matrix[20]) {
54 matrix[0] = 0.213f + 0.787f * amount;
55 matrix[1] = 0.715f - 0.715f * amount;
56 matrix[2] = 1.f - (matrix[0] + matrix[1]);
57 matrix[3] = matrix[4] = 0.f;
58 matrix[5] = 0.213f - 0.213f * amount;
59 matrix[6] = 0.715f + 0.285f * amount;
60 matrix[7] = 1.f - (matrix[5] + matrix[6]);
61 matrix[8] = matrix[9] = 0.f;
62 matrix[10] = 0.213f - 0.213f * amount;
63 matrix[11] = 0.715f - 0.715f * amount;
64 matrix[12] = 1.f - (matrix[10] + matrix[11]);
65 matrix[13] = matrix[14] = 0.f;
66 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0.f;
67 matrix[18] = 1.f;
70 void GetHueRotateMatrix(float hue, SkScalar matrix[20]) {
75 matrix[0] = 0.213f + cos_hue * 0.787f - sin_hue * 0.213f;
76 matrix[1] = 0.715f - cos_hue * 0.715f - sin_hue * 0.715f;
77 matrix[2] = 0.072f - cos_hue * 0.072f + sin_hue * 0.928f;
78 matrix[3] = matrix[4] = 0.f;
79 matrix[5] = 0.213f - cos_hue * 0.213f + sin_hue * 0.143f;
80 matrix[6] = 0.715f + cos_hue * 0.285f + sin_hue * 0.140f;
81 matrix[7] = 0.072f - cos_hue * 0.072f - sin_hue * 0.283f;
82 matrix[8] = matrix[9] = 0.f;
83 matrix[10] = 0.213f - cos_hue * 0.213f - sin_hue * 0.787f;
84 matrix[11] = 0.715f - cos_hue * 0.715f + sin_hue * 0.715f;
85 matrix[12] = 0.072f + cos_hue * 0.928f + sin_hue * 0.072f;
86 matrix[13] = matrix[14] = 0.f;
87 matrix[15] = matrix[16] = matrix[17] = 0.f;
88 matrix[18] = 1.f;
89 matrix[19] = 0.f;
92 void GetInvertMatrix(float amount, SkScalar matrix[20]) {
93 memset(matrix, 0, 20 * sizeof(SkScalar));
94 matrix[0] = matrix[6] = matrix[12] = 1.f - 2.f * amount;
95 matrix[4] = matrix[9] = matrix[14] = amount * 255.f;
96 matrix[18] = 1.f;
99 void GetOpacityMatrix(float amount, SkScalar matrix[20]) {
100 memset(matrix, 0, 20 * sizeof(SkScalar));
101 matrix[0] = matrix[6] = matrix[12] = 1.f;
102 matrix[18] = amount;
105 void GetGrayscaleMatrix(float amount, SkScalar matrix[20]) {
108 matrix[0] = 0.2126f + 0.7874f * amount;
109 matrix[1] = 0.7152f - 0.7152f * amount;
110 matrix[2] = 1.f - (matrix[0] + matrix[1]);
111 matrix[3] = matrix[4] = 0.f;
113 matrix[5] = 0.2126f - 0.2126f * amount;
114 matrix[6] = 0.7152f + 0.2848f * amount;
115 matrix[7] = 1.f - (matrix[5] + matrix[6]);
116 matrix[8] = matrix[9] = 0.f;
118 matrix[10] = 0.2126f - 0.2126f * amount;
119 matrix[11] = 0.7152f - 0.7152f * amount;
120 matrix[12] = 1.f - (matrix[10] + matrix[11]);
121 matrix[13] = matrix[14] = 0.f;
123 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0.f;
124 matrix[18] = 1.f;
127 void GetSepiaMatrix(float amount, SkScalar matrix[20]) {
128 matrix[0] = 0.393f + 0.607f * amount;
129 matrix[1] = 0.769f - 0.769f * amount;
130 matrix[2] = 0.189f - 0.189f * amount;
131 matrix[3] = matrix[4] = 0.f;
133 matrix[5] = 0.349f - 0.349f * amount;
134 matrix[6] = 0.686f + 0.314f * amount;
135 matrix[7] = 0.168f - 0.168f * amount;
136 matrix[8] = matrix[9] = 0.f;
138 matrix[10] = 0.272f - 0.272f * amount;
139 matrix[11] = 0.534f - 0.534f * amount;
140 matrix[12] = 0.131f + 0.869f * amount;
141 matrix[13] = matrix[14] = 0.f;
143 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0.f;
144 matrix[18] = 1.f;
148 const SkScalar matrix[20],
151 skia::AdoptRef(SkColorMatrixFilter::Create(matrix));
162 SkScalar matrix[20];
167 GetGrayscaleMatrix(1.f - op.amount(), matrix);
168 image_filter = CreateMatrixImageFilter(matrix, image_filter);
171 GetSepiaMatrix(1.f - op.amount(), matrix);
172 image_filter = CreateMatrixImageFilter(matrix, image_filter);
175 GetSaturateMatrix(op.amount(), matrix);
176 image_filter = CreateMatrixImageFilter(matrix, image_filter);
179 GetHueRotateMatrix(op.amount(), matrix);
180 image_filter = CreateMatrixImageFilter(matrix, image_filter);
183 GetInvertMatrix(op.amount(), matrix);
184 image_filter = CreateMatrixImageFilter(matrix, image_filter);
187 GetOpacityMatrix(op.amount(), matrix);
188 image_filter = CreateMatrixImageFilter(matrix, image_filter);
191 GetBrightnessMatrix(op.amount(), matrix);
192 image_filter = CreateMatrixImageFilter(matrix, image_filter);
195 GetContrastMatrix(op.amount(), matrix);
196 image_filter = CreateMatrixImageFilter(matrix, image_filter);
212 image_filter = CreateMatrixImageFilter(op.matrix(), image_filter);
235 GetSaturatingBrightnessMatrix(op.amount(), matrix);
236 image_filter = CreateMatrixImageFilter(matrix, image_filter);
250 if (cf && cf->asColorMatrix(matrix) &&
252 image_filter = CreateMatrixImageFilter(matrix, image_filter);