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 #include "../private/SkTemplates.h" | |
14 | 13 |
15 class SkColorSpace : public SkRefCnt { | 14 class SkColorSpace : public SkRefCnt { |
16 public: | 15 public: |
17 | 16 |
18 /** | 17 /** |
19 * Common, named profiles that we can recognize. | 18 * Common, named profiles that we can recognize. |
20 */ | 19 */ |
21 enum Named { | 20 enum Named { |
22 kUnknown_Named, | 21 kUnknown_Named, |
23 kSRGB_Named, | 22 kSRGB_Named, |
24 kAdobeRGB_Named, | 23 kAdobeRGB_Named, |
25 }; | 24 }; |
26 | 25 |
27 /** | 26 /** |
28 * Create an SkColorSpace from the src gamma and a transform from src gamut
to D50 XYZ. | 27 * Create an SkColorSpace from the src gamma and a transform from src gamut
to D50 XYZ. |
29 */ | 28 */ |
30 static sk_sp<SkColorSpace> NewRGB(float gammas[3], const SkMatrix44& toXYZD5
0); | 29 static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& t
oXYZD50); |
31 | 30 |
32 /** | 31 /** |
33 * Create a common, named SkColorSpace. | 32 * Create a common, named SkColorSpace. |
34 */ | 33 */ |
35 static sk_sp<SkColorSpace> NewNamed(Named); | 34 static sk_sp<SkColorSpace> NewNamed(Named); |
36 | 35 |
37 /** | 36 /** |
38 * Create an SkColorSpace from an ICC profile. | 37 * Create an SkColorSpace from an ICC profile. |
39 */ | 38 */ |
40 static sk_sp<SkColorSpace> NewICC(const void*, size_t); | 39 static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
(...skipping 13 matching lines...) Expand all Loading... |
54 * applying the gamma. | 53 * applying the gamma. |
55 */ | 54 */ |
56 kNonStandard_GammaNamed, | 55 kNonStandard_GammaNamed, |
57 }; | 56 }; |
58 | 57 |
59 GammaNamed gammaNamed() const { return fGammaNamed; } | 58 GammaNamed gammaNamed() const { return fGammaNamed; } |
60 | 59 |
61 /** | 60 /** |
62 * Returns the matrix used to transform src gamut to XYZ D50. | 61 * Returns the matrix used to transform src gamut to XYZ D50. |
63 */ | 62 */ |
64 SkMatrix44 xyz() const { return fToXYZD50; } | 63 const SkMatrix44& xyz() const { return fToXYZD50; } |
65 | 64 |
66 protected: | 65 protected: |
67 | 66 |
68 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; | 67 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named)
; |
69 | 68 |
70 const GammaNamed fGammaNamed; | 69 const GammaNamed fGammaNamed; |
71 const SkMatrix44 fToXYZD50; | 70 const SkMatrix44 fToXYZD50; |
72 const Named fNamed; | 71 const Named fNamed; |
73 }; | 72 }; |
74 | 73 |
75 #endif | 74 #endif |
OLD | NEW |