OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
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 SkColorSpace_DEFINED | 8 #ifndef SkColorSpace_DEFINED |
9 #define SkColorSpace_DEFINED | 9 #define SkColorSpace_DEFINED |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 */ | 46 */ |
47 kNonStandard_GammaNamed, | 47 kNonStandard_GammaNamed, |
48 | 48 |
49 /** | 49 /** |
50 * To be used by UMA code only. ICC profiles lacks valid gamma represe ntation. | 50 * To be used by UMA code only. ICC profiles lacks valid gamma represe ntation. |
51 */ | 51 */ |
52 kInvalid_GammaNamed, | 52 kInvalid_GammaNamed, |
53 }; | 53 }; |
54 | 54 |
55 /** | 55 /** |
56 * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. | 56 * Contains the coefficients for a common transfer function equation. |
57 */ | |
58 struct GammaCoefficients { | |
59 // Y = (aX + b)^g + c for X >= d | |
60 // Y = eX + f otherwise | |
61 float fG; | |
62 float fA; | |
63 float fB; | |
64 float fC; | |
65 float fD; | |
66 float fE; | |
67 float fF; | |
68 }; | |
69 | |
70 /** | |
71 * Describes a color gamut with primaries and a white point. | |
72 */ | |
73 struct Primaries { | |
74 float fRX, fRY; | |
75 float fGX, fGY; | |
76 float fBX, fBY; | |
77 float fWX, fWY; | |
78 }; | |
79 | |
80 /** | |
81 * Create an SkColorSpace from a gamma transfer function and a gamut. | |
82 * | |
83 * Gamma can be specified using an enum or the coefficients to an equation. | |
84 * Gamut can specified using the to D50 matrix transformation or using a se t | |
85 * of primaries and a white point. | |
86 * | |
57 */ | 87 */ |
58 static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& t oXYZD50); | 88 static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& t oXYZD50); |
89 static sk_sp<SkColorSpace> NewRGB(const GammaCoefficients& coeffs, const SkM atrix44& toXYZD50); | |
90 static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const Primaries& pr imaries); | |
Brian Osman
2016/09/02 15:37:52
I already mentioned this to Matt, but this set of
| |
91 static sk_sp<SkColorSpace> NewRGB(const GammaCoefficients& coeffs, const Pri maries& primaries); | |
59 | 92 |
60 /** | 93 /** |
61 * Create a common, named SkColorSpace. | 94 * Create a common, named SkColorSpace. |
62 */ | 95 */ |
63 static sk_sp<SkColorSpace> NewNamed(Named); | 96 static sk_sp<SkColorSpace> NewNamed(Named); |
64 | 97 |
65 /** | 98 /** |
66 * Create an SkColorSpace from an ICC profile. | 99 * Create an SkColorSpace from an ICC profile. |
67 */ | 100 */ |
68 static sk_sp<SkColorSpace> NewICC(const void*, size_t); | 101 static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 | 150 |
118 protected: | 151 protected: |
119 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named) ; | 152 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named) ; |
120 | 153 |
121 const GammaNamed fGammaNamed; | 154 const GammaNamed fGammaNamed; |
122 const SkMatrix44 fToXYZD50; | 155 const SkMatrix44 fToXYZD50; |
123 const Named fNamed; | 156 const Named fNamed; |
124 }; | 157 }; |
125 | 158 |
126 #endif | 159 #endif |
OLD | NEW |