Chromium Code Reviews| 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 "SkData.h" | |
| 11 #include "SkMatrix44.h" | 12 #include "SkMatrix44.h" |
| 12 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
| 13 #include "../private/SkTemplates.h" | |
| 14 | 14 |
| 15 class SkColorSpace : public SkRefCnt { | 15 class SkColorSpace : public SkRefCnt { |
| 16 public: | 16 public: |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Common, named profiles that we can recognize. | 19 * Common, named profiles that we can recognize. |
| 20 */ | 20 */ |
| 21 enum Named { | 21 enum Named { |
| 22 kUnknown_Named, | 22 kUnknown_Named, |
| 23 kSRGB_Named, | 23 kSRGB_Named, |
| 24 kAdobeRGB_Named, | 24 kAdobeRGB_Named, |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. | 28 * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. |
| 29 */ | 29 */ |
| 30 static sk_sp<SkColorSpace> NewRGB(float gammas[3], const SkMatrix44& toXYZD5 0); | 30 static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& t oXYZD50); |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Create a common, named SkColorSpace. | 33 * Create a common, named SkColorSpace. |
| 34 */ | 34 */ |
| 35 static sk_sp<SkColorSpace> NewNamed(Named); | 35 static sk_sp<SkColorSpace> NewNamed(Named); |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Create an SkColorSpace from an ICC profile. | 38 * Create an SkColorSpace from an ICC profile. |
| 39 */ | 39 */ |
| 40 static sk_sp<SkColorSpace> NewICC(const void*, size_t); | 40 static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 56 kNonStandard_GammaNamed, | 56 kNonStandard_GammaNamed, |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 GammaNamed gammaNamed() const { return fGammaNamed; } | 59 GammaNamed gammaNamed() const { return fGammaNamed; } |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Returns the matrix used to transform src gamut to XYZ D50. | 62 * Returns the matrix used to transform src gamut to XYZ D50. |
| 63 */ | 63 */ |
| 64 SkMatrix44 xyz() const { return fToXYZD50; } | 64 SkMatrix44 xyz() const { return fToXYZD50; } |
| 65 | 65 |
| 66 /** | |
| 67 * Writes this object as an ICC profile. Used for serialization. | |
| 68 */ | |
| 69 sk_sp<SkData> writeToICC(); | |
|
msarett
2016/05/24 15:36:58
We may not need this to be a public API if/when we
reed1
2016/05/24 16:04:46
1. should be const
2. no need to mention "serializ
msarett
2016/05/24 18:38:05
Done.
| |
| 70 | |
| 66 protected: | 71 protected: |
| 67 | 72 |
| 68 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named) ; | 73 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named, |
| 74 sk_sp<SkData> profileData); | |
| 69 | 75 |
| 70 const GammaNamed fGammaNamed; | 76 const GammaNamed fGammaNamed; |
| 71 const SkMatrix44 fToXYZD50; | 77 const SkMatrix44 fToXYZD50; |
| 72 const Named fNamed; | 78 const Named fNamed; |
| 79 sk_sp<SkData> fProfileData; | |
| 73 }; | 80 }; |
| 74 | 81 |
| 75 #endif | 82 #endif |
| OLD | NEW |