Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GrColorInfo Class Reference

#include <GrColorInfo.h>

Public Member Functions

 GrColorInfo ()
 
 GrColorInfo (const GrColorInfo &)
 
GrColorInfooperator= (const GrColorInfo &)
 
 GrColorInfo (GrColorType, SkAlphaType, sk_sp< SkColorSpace >)
 
 GrColorInfo (const SkColorInfo &)
 
 ~GrColorInfo ()
 
bool operator== (const GrColorInfo &that) const
 
bool operator!= (const GrColorInfo &that) const
 
GrColorInfo makeColorType (GrColorType ct) const
 
bool isLinearlyBlended () const
 
SkColorSpacecolorSpace () const
 
sk_sp< SkColorSpacerefColorSpace () const
 
GrColorSpaceXformcolorSpaceXformFromSRGB () const
 
sk_sp< GrColorSpaceXformrefColorSpaceXformFromSRGB () const
 
GrColorType colorType () const
 
SkAlphaType alphaType () const
 
bool isAlphaOnly () const
 
bool isValid () const
 

Detailed Description

All the info needed to interpret a color: Color type + alpha type + color space. Also caches the GrColorSpaceXform from sRGB.

Definition at line 21 of file GrColorInfo.h.

Constructor & Destructor Documentation

◆ GrColorInfo() [1/4]

GrColorInfo::GrColorInfo ( )
default

◆ GrColorInfo() [2/4]

GrColorInfo::GrColorInfo ( const GrColorInfo )
default

◆ GrColorInfo() [3/4]

GrColorInfo::GrColorInfo ( GrColorType  colorType,
SkAlphaType  alphaType,
sk_sp< SkColorSpace colorSpace 
)

Definition at line 16 of file GrColorInfo.cpp.

18 : fColorSpace(std::move(colorSpace)), fColorType(colorType), fAlphaType(alphaType) {
19 // sRGB sources are very common (SkColor, etc...), so we cache that transformation
21 fColorSpace.get(), kUnpremul_SkAlphaType);
22}
kUnpremul_SkAlphaType
SkColorSpace * sk_srgb_singleton()
SkColorSpace * colorSpace() const
GrColorType colorType() const
Definition GrColorInfo.h:43
SkAlphaType alphaType() const
Definition GrColorInfo.h:44
static sk_sp< GrColorSpaceXform > Make(SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)
T * get() const
Definition SkRefCnt.h:303

◆ GrColorInfo() [4/4]

GrColorInfo::GrColorInfo ( const SkColorInfo ci)

Definition at line 24 of file GrColorInfo.cpp.

26 ci.alphaType(),
27 ci.refColorSpace()) {}
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
SkAlphaType alphaType() const
sk_sp< SkColorSpace > refColorSpace() const
SkColorType colorType() const

◆ ~GrColorInfo()

GrColorInfo::~GrColorInfo ( )
default

Member Function Documentation

◆ alphaType()

SkAlphaType GrColorInfo::alphaType ( ) const
inline

Definition at line 44 of file GrColorInfo.h.

44{ return fAlphaType; }

◆ colorSpace()

SkColorSpace * GrColorInfo::colorSpace ( ) const

Definition at line 48 of file GrColorInfo.cpp.

48{ return fColorSpace.get(); }

◆ colorSpaceXformFromSRGB()

GrColorSpaceXform * GrColorInfo::colorSpaceXformFromSRGB ( ) const
inline

Definition at line 40 of file GrColorInfo.h.

40{ return fColorXformFromSRGB.get(); }

◆ colorType()

GrColorType GrColorInfo::colorType ( ) const
inline

Definition at line 43 of file GrColorInfo.h.

43{ return fColorType; }

◆ isAlphaOnly()

bool GrColorInfo::isAlphaOnly ( ) const
inline

Definition at line 46 of file GrColorInfo.h.

46{ return GrColorTypeIsAlphaOnly(fColorType); }
static constexpr bool GrColorTypeIsAlphaOnly(GrColorType ct)

◆ isLinearlyBlended()

bool GrColorInfo::isLinearlyBlended ( ) const

Definition at line 44 of file GrColorInfo.cpp.

44 {
45 return fColorSpace && fColorSpace->gammaIsLinear();
46}
bool gammaIsLinear() const

◆ isValid()

bool GrColorInfo::isValid ( ) const
inline

Definition at line 48 of file GrColorInfo.h.

48 {
49 return fColorType != GrColorType::kUnknown && fAlphaType != kUnknown_SkAlphaType;
50 }
@ kUnknown_SkAlphaType
uninitialized
Definition SkAlphaType.h:27

◆ makeColorType()

GrColorInfo GrColorInfo::makeColorType ( GrColorType  ct) const

Definition at line 40 of file GrColorInfo.cpp.

40 {
41 return GrColorInfo(ct, fAlphaType, this->refColorSpace());
42}
sk_sp< SkColorSpace > refColorSpace() const

◆ operator!=()

bool GrColorInfo::operator!= ( const GrColorInfo that) const
inline

Definition at line 31 of file GrColorInfo.h.

31{ return !(*this == that); }

◆ operator=()

GrColorInfo & GrColorInfo::operator= ( const GrColorInfo )
default

◆ operator==()

bool GrColorInfo::operator== ( const GrColorInfo that) const

Definition at line 34 of file GrColorInfo.cpp.

34 {
35 return fColorType == that.fColorType &&
36 fAlphaType == that.fAlphaType &&
37 SkColorSpace::Equals(fColorSpace.get(), that.fColorSpace.get());
38}
static bool Equals(const SkColorSpace *, const SkColorSpace *)

◆ refColorSpace()

sk_sp< SkColorSpace > GrColorInfo::refColorSpace ( ) const

Definition at line 49 of file GrColorInfo.cpp.

49{ return fColorSpace; }

◆ refColorSpaceXformFromSRGB()

sk_sp< GrColorSpaceXform > GrColorInfo::refColorSpaceXformFromSRGB ( ) const
inline

Definition at line 41 of file GrColorInfo.h.

41{ return fColorXformFromSRGB; }

The documentation for this class was generated from the following files: