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; |
| 15 |
14 class SK_API SkColorSpace : public SkRefCnt { | 16 class SK_API SkColorSpace : public SkRefCnt { |
15 public: | 17 public: |
16 | 18 |
17 /** | 19 /** |
18 * Common, named profiles that we can recognize. | 20 * Common, named profiles that we can recognize. |
19 */ | 21 */ |
20 enum Named { | 22 enum Named { |
21 kUnknown_Named, | 23 kUnknown_Named, |
22 kSRGB_Named, | 24 kSRGB_Named, |
23 kAdobeRGB_Named, | 25 kAdobeRGB_Named, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 */ | 70 */ |
69 const SkMatrix44& xyz() const { return fToXYZD50; } | 71 const SkMatrix44& xyz() const { return fToXYZD50; } |
70 | 72 |
71 /** | 73 /** |
72 * Returns true if the color space gamma is near enough to be approximated
as sRGB. | 74 * Returns true if the color space gamma is near enough to be approximated
as sRGB. |
73 */ | 75 */ |
74 bool gammaCloseToSRGB() const { | 76 bool gammaCloseToSRGB() const { |
75 return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGam
maNamed; | 77 return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGam
maNamed; |
76 } | 78 } |
77 | 79 |
| 80 /** |
| 81 * Caller takes ownership of SkData. |
| 82 */ |
| 83 sk_sp<SkData> serialize() const; |
| 84 |
| 85 static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length); |
| 86 |
78 protected: | 87 protected: |
79 | |
80 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; | 88 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; |
81 | 89 |
82 friend Named sk_deduce_named_from_colorspace(SkColorSpace*); | |
83 | |
84 const GammaNamed fGammaNamed; | 90 const GammaNamed fGammaNamed; |
85 const SkMatrix44 fToXYZD50; | 91 const SkMatrix44 fToXYZD50; |
86 const Named fNamed; | 92 const Named fNamed; |
87 }; | 93 }; |
88 | 94 |
89 #endif | 95 #endif |
OLD | NEW |