Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkICC.h
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 SkICC_DEFINED
9 #define SkICC_DEFINED
10 
11 #include "SkData.h"
12 #include "SkRefCnt.h"
13 
15 class SkColorSpace;
16 class SkData;
17 class SkMatrix44;
18 
19 class SK_API SkICC : public SkRefCnt {
20 public:
21 
28  static sk_sp<SkICC> Make(const void*, size_t);
29 
37  bool toXYZD50(SkMatrix44* toXYZD50) const;
38 
49  bool isNumericalTransferFn(SkColorSpaceTransferFn* fn) const;
50 
72  struct Channel {
73  // Byte offset of the start of the table in |fStorage|
74  size_t fOffset;
75  int fCount;
76  };
77  struct Tables {
78  Channel fRed;
79  Channel fGreen;
80  Channel fBlue;
81 
82  const float* red() {
83  return (const float*) (fStorage->bytes() + fRed.fOffset);
84  }
85  const float* green() {
86  return (const float*) (fStorage->bytes() + fGreen.fOffset);
87  }
88  const float* blue() {
89  return (const float*) (fStorage->bytes() + fBlue.fOffset);
90  }
91 
92  sk_sp<SkData> fStorage;
93  };
94  bool rawTransferFnData(Tables* tables) const;
95 
99  static sk_sp<SkData> WriteToICC(const SkColorSpaceTransferFn& fn, const SkMatrix44& toXYZD50);
100 
101 private:
102  SkICC(sk_sp<SkColorSpace> colorSpace);
103 
104  sk_sp<SkColorSpace> fColorSpace;
105 
106  friend class ICCTest;
107 };
108 
109 #endif
Definition: SkColorSpace.h:59
Definition: SkICC.h:19
The SkMatrix44 class holds a 4x4 matrix.
Definition: SkMatrix44.h:135
Definition: SkRefCnt.h:125
SkData holds an immutable data buffer.
Definition: SkData.h:22
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:246
Definition: SkICC.h:77
Contains the coefficients for a common transfer function equation, specified as a transformation from...
Definition: SkColorSpace.h:43
Please do not call this unless isNumericalTransferFn() has been called and it fails.
Definition: SkICC.h:72