Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: include/core/SkColorSpace.h

Issue 2409383002: Add SkColorSpaceTransferFn to SkColorSpace (Closed)
Patch Set: Add more comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkColorSpace.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | src/core/SkColorSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698