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

Unified Diff: include/core/SkColorSpace.h

Issue 1996973002: Make SkColorSpace a public API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove SkColorSpace.h from gyp Created 4 years, 7 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 | « gyp/core.gypi ('k') | src/core/SkColorSpace.h » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..9630fe4c2508b3e49383685abb21fe972f8101a7
--- /dev/null
+++ b/include/core/SkColorSpace.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkColorSpace_DEFINED
+#define SkColorSpace_DEFINED
+
+#include "SkMatrix44.h"
+#include "SkRefCnt.h"
+#include "../private/SkTemplates.h"
+
+class SkColorSpace : public SkRefCnt {
+public:
+
+ /**
+ * Common, named profiles that we can recognize.
+ */
+ enum Named {
+ kUnknown_Named,
+ kSRGB_Named,
+ kAdobeRGB_Named,
+ };
+
+ /**
+ * Create an SkColorSpace from the src gamma and a transform from src gamut to D50 XYZ.
+ */
+ static sk_sp<SkColorSpace> NewRGB(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.
+ */
+ k2Dot2Curve_GammaNamed,
+
+ /**
+ * Gamma is represented by a look-up table, a parametric curve, or an uncommon
+ * exponential curve. Or there is an additional pre-processing step before the
+ * applying the gamma.
+ */
+ kNonStandard_GammaNamed,
+ };
+
+ GammaNamed gammaNamed() const { return fGammaNamed; }
+
+ /**
+ * Returns the matrix used to transform src gamut to XYZ D50.
+ */
+ SkMatrix44 xyz() const { return fToXYZD50; }
+
+protected:
+
+ SkColorSpace(GammaNamed gammaNamed, const SkMatrix44& toXYZD50, Named named);
+
+ const GammaNamed fGammaNamed;
+ const SkMatrix44 fToXYZD50;
+ const Named fNamed;
+};
+
+#endif
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkColorSpace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698