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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 /** | 49 /** |
50 * Return a colorspace instance, given a 3x3 transform from linear_RGB to D
50_XYZ | 50 * Return a colorspace instance, given a 3x3 transform from linear_RGB to D
50_XYZ |
51 * and the src-gamma, return a ColorSpace | 51 * and the src-gamma, return a ColorSpace |
52 */ | 52 */ |
53 static SkColorSpace* NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3& gamm
a); | 53 static SkColorSpace* NewRGB(const SkFloat3x3& toXYZD50, const SkFloat3& gamm
a); |
54 | 54 |
55 static SkColorSpace* NewNamed(Named); | 55 static SkColorSpace* NewNamed(Named); |
56 static SkColorSpace* NewICC(const void*, size_t); | 56 static SkColorSpace* NewICC(const void*, size_t); |
57 | 57 |
58 SkFloat3 gamma() const { return fGamma; } | 58 SkFloat3 gamma() const { return fGamma; } |
| 59 SkFloat3x3 xyz() const { return fToXYZD50; } |
59 Named named() const { return fNamed; } | 60 Named named() const { return fNamed; } |
60 uint32_t uniqueID() const { return fUniqueID; } | 61 uint32_t uniqueID() const { return fUniqueID; } |
61 | 62 |
62 enum Result { | 63 enum Result { |
63 kFailure_Result, | 64 kFailure_Result, |
64 kIdentity_Result, | 65 kIdentity_Result, |
65 kNormal_Result, | 66 kNormal_Result, |
66 }; | 67 }; |
67 | 68 |
68 /** | 69 /** |
69 * Given a src and dst colorspace, return the 3x3 matrix that will convert
src_linear_RGB | 70 * Given a src and dst colorspace, return the 3x3 matrix that will convert
src_linear_RGB |
70 * values into dst_linear_RGB values. | 71 * values into dst_linear_RGB values. |
71 */ | 72 */ |
72 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo
at3x3* result); | 73 static Result Concat(const SkColorSpace* src, const SkColorSpace* dst, SkFlo
at3x3* result); |
73 | 74 |
74 static void Test(); | 75 static void Test(); |
75 void dump() const; | 76 void dump() const; |
76 | 77 |
77 protected: | 78 protected: |
78 SkColorSpace(const SkFloat3x3& toXYZ, const SkFloat3& gamma, Named); | 79 SkColorSpace(const SkFloat3x3& toXYZ, const SkFloat3& gamma, Named); |
79 | 80 |
80 private: | 81 private: |
81 const SkFloat3x3 fToXYZD50; | 82 const SkFloat3x3 fToXYZD50; |
82 const SkFloat3 fGamma; | 83 const SkFloat3 fGamma; |
83 const uint32_t fUniqueID; | 84 const uint32_t fUniqueID; |
84 const Named fNamed; | 85 const Named fNamed; |
85 }; | 86 }; |
86 | 87 |
87 #endif | 88 #endif |
OLD | NEW |