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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 117 |
110 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); | 118 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); |
111 | 119 |
112 /** | 120 /** |
113 * If both are null, we return true. If one is null and the other is not,
we return false. | 121 * If both are null, we return true. If one is null and the other is not,
we return false. |
114 * If both are non-null, we do a deeper compare. | 122 * If both are non-null, we do a deeper compare. |
115 */ | 123 */ |
116 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); | 124 static bool Equals(const SkColorSpace* src, const SkColorSpace* dst); |
117 | 125 |
118 protected: | 126 protected: |
119 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; | 127 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50); |
120 | 128 |
121 const GammaNamed fGammaNamed; | 129 const GammaNamed fGammaNamed; |
122 const SkMatrix44 fToXYZD50; | 130 const SkMatrix44 fToXYZD50; |
123 const Named fNamed; | |
124 }; | 131 }; |
125 | 132 |
126 #endif | 133 #endif |
OLD | NEW |