Index: include/core/SkColorSpace.h |
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h |
index f942780b7c73a9a0936f044f977693b5065826ba..ef6d277b695e91f1b8e24c7a2e01695b92132e8b 100644 |
--- a/include/core/SkColorSpace.h |
+++ b/include/core/SkColorSpace.h |
@@ -23,27 +23,18 @@ public: |
kAdobeRGB_Named, |
}; |
- /** |
- * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. |
- */ |
- static sk_sp<SkColorSpace> NewRGB(const float gammas[3], const SkMatrix44& toXYZD50); |
- |
- /** |
- * Create a common, named SkColorSpace. |
- */ |
- static sk_sp<SkColorSpace> NewNamed(Named); |
- |
- /** |
- * Create an SkColorSpace from an ICC profile. |
- */ |
- static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
- |
enum GammaNamed { |
kLinear_GammaNamed, |
/** |
- * Gamma curve is a close match to the 2.2f exponential curve. This is by far |
- * the most common gamma, and is used by sRGB and Adobe RGB profiles. |
+ * Gamma curve is a close match to the canonical sRGB curve, which has |
+ * a short linear segment followed by a 2.4f exponential. |
+ */ |
+ kSRGB_GammaNamed, |
+ |
+ /** |
+ * Gamma curve is a close match to the 2.2f exponential curve. This is |
+ * used by Adobe RGB profiles and is common on monitors as well. |
*/ |
k2Dot2Curve_GammaNamed, |
@@ -55,6 +46,21 @@ public: |
kNonStandard_GammaNamed, |
}; |
+ /** |
+ * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ. |
+ */ |
+ static sk_sp<SkColorSpace> NewRGB(GammaNamed gammaNamed, const SkMatrix44& toXYZD50); |
+ |
+ /** |
+ * Create a common, named SkColorSpace. |
+ */ |
+ static sk_sp<SkColorSpace> NewNamed(Named); |
+ |
+ /** |
+ * Create an SkColorSpace from an ICC profile. |
+ */ |
+ static sk_sp<SkColorSpace> NewICC(const void*, size_t); |
+ |
GammaNamed gammaNamed() const { return fGammaNamed; } |
/** |
@@ -62,6 +68,13 @@ public: |
*/ |
const SkMatrix44& xyz() const { return fToXYZD50; } |
+ /** |
+ * Returns true if the color space gamma is near enough to be approximated as sRGB. |
+ */ |
+ bool gammaCloseToSRGB() const { |
+ return kSRGB_GammaNamed == fGammaNamed || k2Dot2Curve_GammaNamed == fGammaNamed; |
+ } |
+ |
protected: |
SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named); |