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 |
11 #include "SkMatrix44.h" | 11 #include "SkMatrix44.h" |
12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
13 | 13 |
14 class SkData; | 14 class SkData; |
15 | 15 |
16 class SK_API SkColorSpace : public SkRefCnt { | 16 class SK_API SkColorSpace : public SkRefCnt { |
17 public: | 17 public: |
18 | 18 |
19 /** | 19 /** |
20 * Common, named profiles that we can recognize. | 20 * Common, named profiles that we can recognize. |
21 */ | 21 */ |
22 enum Named { | 22 enum Named : uint8_t { |
23 kUnknown_Named, | 23 /** |
| 24 * By far the most common color space. |
| 25 * This is the default space for images, unmarked content, and monitors
. |
| 26 */ |
24 kSRGB_Named, | 27 kSRGB_Named, |
| 28 |
| 29 /** |
| 30 * Very common wide gamut color space. |
| 31 * Often used by images and monitors. |
| 32 */ |
25 kAdobeRGB_Named, | 33 kAdobeRGB_Named, |
26 }; | 34 }; |
27 | 35 |
28 enum GammaNamed { | 36 enum GammaNamed : uint8_t { |
29 kLinear_GammaNamed, | 37 kLinear_GammaNamed, |
30 | 38 |
31 /** | 39 /** |
32 * Gamma curve is a close match to the canonical sRGB curve, which has | 40 * Gamma curve is a close match to the canonical sRGB curve, which has |
33 * a short linear segment followed by a 2.4f exponential. | 41 * a short linear segment followed by a 2.4f exponential. |
34 */ | 42 */ |
35 kSRGB_GammaNamed, | 43 kSRGB_GammaNamed, |
36 | 44 |
37 /** | 45 /** |
38 * Gamma curve is a close match to the 2.2f exponential curve. This is | 46 * Gamma curve is a close match to the 2.2f exponential curve. This is |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 112 |
105 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); | 113 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); |
106 | 114 |
107 /** | 115 /** |
108 * If both are null, we return true. If one is null and the other is not,
we return false. | 116 * If both are null, we return true. If one is null and the other is not,
we return false. |
109 * If both are non-null, we do a deeper compare. | 117 * If both are non-null, we do a deeper compare. |
110 */ | 118 */ |
111 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); | 119 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); |
112 | 120 |
113 protected: | 121 protected: |
114 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; | 122 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50); |
115 | 123 |
116 const GammaNamed fGammaNamed; | 124 const GammaNamed fGammaNamed; |
117 const SkMatrix44 fToXYZD50; | 125 const SkMatrix44 fToXYZD50; |
118 const Named fNamed; | |
119 }; | 126 }; |
120 | 127 |
121 #endif | 128 #endif |
OLD | NEW |