Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkColorSpaceXform.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 SkColorSpaceXform_DEFINED
9 #define SkColorSpaceXform_DEFINED
10 
11 #include "SkImageInfo.h"
12 
13 class SkColorSpace;
14 
15 class SK_API SkColorSpaceXform : SkNoncopyable {
16 public:
17 
25  static std::unique_ptr<SkColorSpaceXform> New(SkColorSpace* srcSpace, SkColorSpace* dstSpace);
26 
27  enum ColorFormat {
28  kRGBA_8888_ColorFormat,
29  kBGRA_8888_ColorFormat,
30 
31  // Unsigned, big-endian, 16-bit integer
32  kRGB_U16_BE_ColorFormat, // Src only
33  kRGBA_U16_BE_ColorFormat, // Src only
34 
35  kRGBA_F16_ColorFormat,
36  kRGBA_F32_ColorFormat,
37 
38  kBGR_565_ColorFormat, // Dst only, kOpaque only
39  };
40 
58  bool apply(ColorFormat dstFormat, void* dst, ColorFormat srcFormat, const void* src, int count,
59  SkAlphaType alphaType) const;
60 
61  virtual ~SkColorSpaceXform() {}
62 
63  enum AlphaOp {
64  kPreserve_AlphaOp, // just transfer src-alpha to dst-alpha
65  kPremul_AlphaOp, // like kPreserve, but multiplies RGB by it
66  kSrcIsOpaque_AlphaOp, // src alphas are all 1, this is a perf hint
67  };
68  static bool Apply(SkColorSpace* dstCS, ColorFormat dstFormat, void* dst,
69  SkColorSpace* srcCS, ColorFormat srcFormat, const void* src,
70  int count, AlphaOp);
71 
72 protected:
74 };
75 
76 #endif
Definition: SkColorSpaceXform.h:15
Definition: SkColorSpace.h:59