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

Side by Side Diff: src/core/SkColorSpace_A2B.h

Issue 2389983002: Refactored SkColorSpace and added in a Lab PCS GM (Closed)
Patch Set: migrated call from SkColorSpace_Base::makeLinearGamma() to SkColorSpace_XYZ::makeLinearGamma() 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 unified diff | Download patch
« no previous file with comments | « src/core/SkColorSpaceXform_Base.h ('k') | src/core/SkColorSpace_A2B.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_A2B_DEFINED
9 #define SkColorSpace_A2B_DEFINED
10
11 #include "SkColorSpace_Base.h"
12
13 // An alternative SkColorSpace that represents all the color space data that
14 // is stored in an A2B0 ICC tag. This allows us to use alternative profile
15 // connection spaces (CIELAB instead of just CIEXYZ), use color-lookup-tables
16 // to do color space transformations not representable as TRC functions or
17 // matrix operations, as well as have multiple TRC functions. The CLUT also has
18 // the potential to allow conversion from input color spaces with a different
19 // number of channels such as CMYK (4) or GRAY (1), but that is not supported ye t.
20 //
21 // Evaluation is done: A-curve => CLUT => M-curve => Matrix => B-curve
22 //
23 // There are also multi-processing-elements in the A2B0 tag which allow you to
24 // combine these 3 primitives (TRC, CLUT, matrix) in any order/quantitiy,
25 // but support for that is not implemented.
26 class SkColorSpace_A2B : public SkColorSpace_Base {
27 public:
28 const SkMatrix44* toXYZD50() const override {
29 // the matrix specified in A2B0 profiles is not necessarily
30 // a to-XYZ matrix, as to-Lab is supported as well so returning
31 // that could be misleading. Additionally, B-curves are applied
32 // after the matrix is, but a toXYZD50 matrix is the last thing
33 // applied in order to get into the (XYZ) profile connection space.
34 return nullptr;
35 }
36
37 const SkMatrix44* fromXYZD50() const override {
38 // See toXYZD50()'s comment. Also, A2B0 profiles are not supported
39 // as destination color spaces, so an inverse matrix is never wanted.
40 return nullptr;
41 }
42
43 bool onGammaCloseToSRGB() const override {
44 // There is no single gamma curve in an A2B0 profile
45 return false;
46 }
47
48 bool onGammaIsLinear() const override {
49 // There is no single gamma curve in an A2B0 profile
50 return false;
51 }
52
53 SkGammaNamed aCurveNamed() const { return fACurveNamed; }
54
55 const SkGammas* aCurve() const { return fACurve.get(); }
56
57 const SkColorLookUpTable* colorLUT() const { return fColorLUT.get(); }
58
59 SkGammaNamed mCurveNamed() const { return fMCurveNamed; }
60
61 const SkGammas* mCurve() const { return fMCurve.get(); }
62
63 const SkMatrix44& matrix() const { return fMatrix; }
64
65 SkGammaNamed bCurveNamed() const { return fBCurveNamed; }
66
67 const SkGammas* bCurve() const { return fBCurve.get(); }
68
69 // the intermediate profile connection space that this color space
70 // represents the transformation to
71 enum class PCS : uint8_t {
72 kLAB, // CIELAB
73 kXYZ // CIEXYZ
74 };
75
76 PCS pcs() const { return fPCS; }
77
78 Type type() const override { return Type::kA2B; }
79
80 private:
81 SkColorSpace_A2B(SkGammaNamed aCurveNamed, sk_sp<SkGammas> aCurve,
82 sk_sp<SkColorLookUpTable> colorLUT,
83 SkGammaNamed mCurveNamed, sk_sp<SkGammas> mCurve,
84 const SkMatrix44& matrix,
85 SkGammaNamed bCurveNamed, sk_sp<SkGammas> bCurve,
86 PCS pcs, sk_sp<SkData> profileData);
87
88 const SkGammaNamed fACurveNamed;
89 sk_sp<SkGammas> fACurve;
90 sk_sp<SkColorLookUpTable> fColorLUT;
91 const SkGammaNamed fMCurveNamed;
92 sk_sp<SkGammas> fMCurve;
93 SkMatrix44 fMatrix;
94 const SkGammaNamed fBCurveNamed;
95 sk_sp<SkGammas> fBCurve;
96 PCS fPCS;
97
98 friend class SkColorSpace;
99 typedef SkColorSpace_Base INHERITED;
100 };
101
102 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorSpaceXform_Base.h ('k') | src/core/SkColorSpace_A2B.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698