OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkColor_DEFINED | 8 #ifndef SkColor_DEFINED |
9 #define SkColor_DEFINED | 9 #define SkColor_DEFINED |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 dependent order, to match the format of kARGB32 bitmaps. | 153 dependent order, to match the format of kARGB32 bitmaps. |
154 */ | 154 */ |
155 SK_API SkPMColor SkPreMultiplyColor(SkColor c); | 155 SK_API SkPMColor SkPreMultiplyColor(SkColor c); |
156 | 156 |
157 /** Define a function pointer type for combining two premultiplied colors | 157 /** Define a function pointer type for combining two premultiplied colors |
158 */ | 158 */ |
159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); | 159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); |
160 | 160 |
161 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 161 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
162 | 162 |
| 163 struct SkColor4f; |
| 164 |
163 /* | 165 /* |
164 * The float values are 0...1 premultiplied | 166 * The float values are 0...1 premultiplied |
165 */ | 167 */ |
166 struct SkPM4f { | 168 struct SkPM4f { |
167 enum { | 169 enum { |
168 A = SK_A32_SHIFT/8, | 170 A = SK_A32_SHIFT/8, |
169 R = SK_R32_SHIFT/8, | 171 R = SK_R32_SHIFT/8, |
170 G = SK_G32_SHIFT/8, | 172 G = SK_G32_SHIFT/8, |
171 B = SK_B32_SHIFT/8, | 173 B = SK_B32_SHIFT/8, |
172 }; | 174 }; |
173 float fVec[4]; | 175 float fVec[4]; |
174 | 176 |
175 float a() const { return fVec[A]; } | 177 float a() const { return fVec[A]; } |
176 | 178 |
| 179 SkColor4f unpremul() const; |
| 180 |
177 static SkPM4f FromPMColor(SkPMColor); | 181 static SkPM4f FromPMColor(SkPMColor); |
178 | 182 |
179 #ifdef SK_DEBUG | 183 #ifdef SK_DEBUG |
180 void assertIsUnit() const; | 184 void assertIsUnit() const; |
181 #else | 185 #else |
182 void assertIsUnit() const {} | 186 void assertIsUnit() const {} |
183 #endif | 187 #endif |
184 }; | 188 }; |
185 | 189 |
186 /* | 190 /* |
(...skipping 19 matching lines...) Expand all Loading... |
206 static SkColor4f FromColor(SkColor); | 210 static SkColor4f FromColor(SkColor); |
207 | 211 |
208 SkColor4f pin() const { | 212 SkColor4f pin() const { |
209 return Pin(fA, fR, fG, fB); | 213 return Pin(fA, fR, fG, fB); |
210 } | 214 } |
211 | 215 |
212 SkPM4f premul() const; | 216 SkPM4f premul() const; |
213 }; | 217 }; |
214 | 218 |
215 #endif | 219 #endif |
OLD | NEW |