Chromium Code Reviews| Index: include/core/SkColorSpace.h |
| diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h |
| index 045117552626b55373074c6fa3c94d3b02295c9e..6496ef12de863ff374f13b80bdf8fb87a7e95888 100644 |
| --- a/include/core/SkColorSpace.h |
| +++ b/include/core/SkColorSpace.h |
| @@ -13,6 +13,44 @@ |
| class SkData; |
| +/** |
| + * Describes a color gamut with primaries and a white point. |
| + */ |
| +struct SK_API SkPrimaries { |
| + float fRX, fRY; |
| + float fGX, fGY; |
| + float fBX, fBY; |
| + float fWX, fWY; |
| + |
| + /** |
| + * Convert primaries and a white point to a toXYZD50 matrix, the preferred color gamut |
| + * representation of SkColorSpace. |
| + */ |
| + // TODO: Implement this. |
| + static bool PrimariesToXYZD50(SkMatrix44* toXYZD50, const SkPrimaries& primaries); |
|
reed1
2016/09/07 22:50:45
nit: doesn't need to be static:
bool toXYZD50(SkM
msarett
2016/09/08 02:24:08
Done.
|
| +}; |
| + |
| +/** |
| + * Contains the coefficients for a common transfer function equation, specified as |
| + * a transformation from a curved space to linear. |
| + * |
| + * LinearVal = E*InputVal + F , for 0.0f <= InputVal < D |
| + * LinearVal = (A*InputVal + B)^G + C, for D <= InputVal <= 1.0f |
| + * |
| + * Function is undefined if InputVal is not in [ 0.0f, 1.0f ]. |
| + * Resulting LinearVals must be in [ 0.0f, 1.0f ]. |
| + * Function must be increasing. |
| + */ |
| +struct SK_API SkTransferFn { |
| + float fG; |
| + float fA; |
| + float fB; |
| + float fC; |
| + float fD; |
| + float fE; |
| + float fF; |
| +}; |
| + |
| class SK_API SkColorSpace : public SkRefCnt { |
| public: |
| @@ -44,9 +82,13 @@ public: |
| }; |
| /** |
| - * Create an SkColorSpace from a transfer function and a color gamut transform to D50 XYZ. |
| + * Create an SkColorSpace from a transfer function and a color gamut. |
| + * |
| + * Transfer function can be specified as a render target or as the coefficients to an equation. |
| + * Gamut is specified using the matrix transformation to XYZ D50. |
| */ |
| static sk_sp<SkColorSpace> NewRGB(RenderTargetGamma gamma, const SkMatrix44& toXYZD50); |
| + static sk_sp<SkColorSpace> NewRGB(const SkTransferFn& coeffs, const SkMatrix44& toXYZD50); |
| /** |
| * Create a common, named SkColorSpace. |