Index: include/core/SkColorSpace.h |
diff --git a/include/core/SkColorSpace.h b/include/core/SkColorSpace.h |
index 9b990da966dcac73912ed36ae1cb23423524e85f..b1daf4f232692898514f63f57ddb9f383d3ce793 100644 |
--- a/include/core/SkColorSpace.h |
+++ b/include/core/SkColorSpace.h |
@@ -29,6 +29,27 @@ struct SK_API SkColorSpacePrimaries { |
bool toXYZD50(SkMatrix44* toXYZD50) const; |
}; |
+/** |
+ * Contains the coefficients for a common transfer function equation, specified as |
+ * a transformation from a curved space to linear. |
+ * |
+ * LinearVal = E*InputVal + F , for 0.0f <= InputVal < D |
+ * LinearVal = (A*InputVal + B)^G + C, for D <= InputVal <= 1.0f |
+ * |
+ * Function is undefined if InputVal is not in [ 0.0f, 1.0f ]. |
+ * Resulting LinearVals must be in [ 0.0f, 1.0f ]. |
+ * Function must be positive and increasing. |
+ */ |
+struct SK_API SkColorSpaceTransferFn { |
+ float fG; |
+ float fA; |
+ float fB; |
+ float fC; |
+ float fD; |
+ float fE; |
+ float fF; |
+}; |
+ |
class SK_API SkColorSpace : public SkRefCnt { |
public: |
@@ -68,10 +89,12 @@ public: |
/** |
* Create an SkColorSpace from a transfer function and a color gamut. |
* |
- * Transfer function is specified as linear or sRGB. |
+ * Transfer function can be specified as a render target or as the coefficients to an equation. |
* Gamut is specified using the matrix transformation to XYZ D50. |
*/ |
static sk_sp<SkColorSpace> NewRGB(RenderTargetGamma gamma, const SkMatrix44& toXYZD50); |
+ static sk_sp<SkColorSpace> NewRGB(const SkColorSpaceTransferFn& coeffs, |
+ const SkMatrix44& toXYZD50); |
/** |
* Create a common, named SkColorSpace. |