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

Side by Side Diff: src/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 unified diff | Download patch
« no previous file with comments | « include/core/SkColorSpace.h ('k') | src/core/SkColorSpace.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_DEFINED
9 #define SkColorSpace_DEFINED
10
11 // Some terms
12 //
13 // PCS : Profile Connection Space : where color number values have an absolute meaning.
14 // Part of the work float is to convert colors to and from this space...
15 // src_linear_unit_floats --> PCS --> PCS' --> dst_linear_unit_floats
16 //
17 // Some nice documents
18 //
19 // http://www.cambridgeincolour.com/tutorials/color-space-conversion.htm
20 // https://www.w3.org/Graphics/Color/srgb
21 // http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html
22 //
23
24 #include "SkMatrix44.h"
25 #include "SkRefCnt.h"
26 #include "../private/SkTemplates.h"
27
28 struct SkColorLookUpTable;
29 struct SkGammaCurve;
30 struct SkGammas;
31
32 class SkColorSpace : public SkRefCnt {
33 public:
34
35 enum Named {
36 kUnknown_Named,
37 kSRGB_Named,
38 kAdobeRGB_Named,
39 };
40
41 /**
42 * Given the src gamma and a transform from src gamut to D50_XYZ, return a SkColorSpace.
43 */
44 static sk_sp<SkColorSpace> NewRGB(float gammas[3], const SkMatrix44& toXYZD5 0);
45
46 static sk_sp<SkColorSpace> NewNamed(Named);
47 static sk_sp<SkColorSpace> NewICC(const void*, size_t);
48
49 /**
50 * Used only by test code.
51 */
52 SkGammas* gammas() const { return fGammas.get(); }
53
54 SkMatrix44 xyz() const { return fToXYZD50; }
55 Named named() const { return fNamed; }
56 uint32_t uniqueID() const { return fUniqueID; }
57
58 private:
59
60 static bool LoadGammas(SkGammaCurve* gammas, uint32_t num, const uint8_t* sr c, size_t len);
61
62 static bool LoadColorLUT(SkColorLookUpTable* colorLUT, uint32_t inputChannel s,
63 uint32_t outputChannels, const uint8_t* src, size_t len);
64
65 static bool LoadA2B0(SkColorLookUpTable* colorLUT, SkGammaCurve*, SkMatrix44 * toXYZ,
66 const uint8_t* src, size_t len);
67
68 SkColorSpace(sk_sp<SkGammas> gammas, const SkMatrix44& toXYZ, Named);
69
70 SkColorSpace(SkColorLookUpTable* colorLUT, sk_sp<SkGammas> gammas, const SkM atrix44& toXYZ);
71
72 SkAutoTDelete<SkColorLookUpTable> fColorLUT;
73 sk_sp<SkGammas> fGammas;
74 const SkMatrix44 fToXYZD50;
75
76 const uint32_t fUniqueID;
77 const Named fNamed;
78 };
79
80 #endif
OLDNEW
« no previous file with comments | « include/core/SkColorSpace.h ('k') | src/core/SkColorSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698