Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrColorInfo.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 GrColorInfo_DEFINED
9#define GrColorInfo_DEFINED
10
15
16class SkColorInfo;
17class SkColorSpace;
18/**
19 * All the info needed to interpret a color: Color type + alpha type + color space. Also caches
20 * the GrColorSpaceXform from sRGB. */
22public:
27 /* implicit */ GrColorInfo(const SkColorInfo&);
29
30 bool operator==(const GrColorInfo& that) const;
31 bool operator!=(const GrColorInfo& that) const { return !(*this == that); }
32
34
35 bool isLinearlyBlended() const;
36
37 SkColorSpace* colorSpace() const;
39
40 GrColorSpaceXform* colorSpaceXformFromSRGB() const { return fColorXformFromSRGB.get(); }
41 sk_sp<GrColorSpaceXform> refColorSpaceXformFromSRGB() const { return fColorXformFromSRGB; }
42
43 GrColorType colorType() const { return fColorType; }
44 SkAlphaType alphaType() const { return fAlphaType; }
45
46 bool isAlphaOnly() const { return GrColorTypeIsAlphaOnly(fColorType); }
47
48 bool isValid() const {
49 return fColorType != GrColorType::kUnknown && fAlphaType != kUnknown_SkAlphaType;
50 }
51
52private:
53 sk_sp<SkColorSpace> fColorSpace;
54 sk_sp<GrColorSpaceXform> fColorXformFromSRGB;
57};
58
59#endif
static constexpr bool GrColorTypeIsAlphaOnly(GrColorType ct)
GrColorType
SkAlphaType
Definition SkAlphaType.h:26
@ kUnknown_SkAlphaType
uninitialized
Definition SkAlphaType.h:27
bool isLinearlyBlended() const
bool operator==(const GrColorInfo &that) const
bool isValid() const
Definition GrColorInfo.h:48
bool operator!=(const GrColorInfo &that) const
Definition GrColorInfo.h:31
sk_sp< GrColorSpaceXform > refColorSpaceXformFromSRGB() const
Definition GrColorInfo.h:41
sk_sp< SkColorSpace > refColorSpace() const
SkColorSpace * colorSpace() const
GrColorType colorType() const
Definition GrColorInfo.h:43
SkAlphaType alphaType() const
Definition GrColorInfo.h:44
GrColorInfo & operator=(const GrColorInfo &)
bool isAlphaOnly() const
Definition GrColorInfo.h:46
GrColorInfo(const GrColorInfo &)
GrColorInfo makeColorType(GrColorType ct) const
GrColorSpaceXform * colorSpaceXformFromSRGB() const
Definition GrColorInfo.h:40
T * get() const
Definition SkRefCnt.h:303