Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2016 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkColorSpace_DEFINED | |
| 9 #define SkColorSpace_DEFINED | |
| 10 | |
| 11 #include "SkMatrix44.h" | |
| 12 #include "SkRefCnt.h" | |
| 13 #include "../private/SkTemplates.h" | |
| 14 | |
| 15 class SkColorSpace : public SkRefCnt { | |
|
msarett
2016/05/23 15:22:51
Should this be SK_API?
| |
| 16 public: | |
| 17 | |
| 18 /** | |
| 19 * Common, named profiles that we can recognize. | |
| 20 */ | |
| 21 enum Named { | |
| 22 kUnknown_Named, | |
| 23 kSRGB_Named, | |
| 24 kAdobeRGB_Named, | |
| 25 }; | |
| 26 | |
| 27 /** | |
| 28 * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. | |
| 29 */ | |
| 30 static sk_sp<SkColorSpace> NewRGB(float gammas[3], const SkMatrix44& toXYZD5 0); | |
| 31 | |
| 32 /** | |
| 33 * Create a common, named SkColorSpace. | |
| 34 */ | |
| 35 static sk_sp<SkColorSpace> NewNamed(Named); | |
| 36 | |
| 37 /** | |
| 38 * Create an SkColorSpace from an ICC profile. | |
| 39 */ | |
| 40 static sk_sp<SkColorSpace> NewICC(const void*, size_t); | |
| 41 | |
| 42 enum GammaNamed { | |
| 43 kLinear_GammaNamed, | |
| 44 | |
| 45 /** | |
| 46 * Gamma curve is a close match to the 2.2f exponential curve. This is by far | |
| 47 * the most common gamma, and is used by sRGB and Adobe RGB profiles. | |
| 48 */ | |
| 49 k2Dot2Curve_GammaNamed, | |
| 50 | |
| 51 /** | |
| 52 * Gamma is represented by a look-up table, a parametric curve, or an u ncommon | |
| 53 * exponential curve. Or there is an additional pre-processing step be fore the | |
| 54 * applying the gamma. | |
| 55 */ | |
| 56 kNonStandard_GammaNamed, | |
| 57 }; | |
| 58 | |
| 59 GammaNamed gammaNamed() const { return fGammaNamed; } | |
| 60 | |
| 61 /** | |
| 62 * Returns the matrix used to transform src gamut to XYZ D50. | |
| 63 */ | |
| 64 SkMatrix44 xyz() const { return fToXYZD50; } | |
| 65 | |
| 66 protected: | |
| 67 | |
| 68 SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named) ; | |
| 69 | |
| 70 const GammaNamed fGammaNamed; | |
| 71 const SkMatrix44 fToXYZD50; | |
| 72 const Named fNamed; | |
| 73 }; | |
| 74 | |
| 75 #endif | |
| OLD | NEW |