Skia
2D Graphics Library
SkColorInfo Struct Reference

Describes pixel and encoding. More...

#include <SkImageInfo.h>

Public Member Functions

 SkColorInfo ()
 Creates an SkColorInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, and no SkColorSpace. More...
 
 ~SkColorInfo ()
 
 SkColorInfo (SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs)
 Creates SkColorInfo from SkColorType ct, SkAlphaType at, and optionally SkColorSpace cs. More...
 
 SkColorInfo (const SkColorInfo &)
 
 SkColorInfo (SkColorInfo &&)
 
SkColorInfooperator= (const SkColorInfo &)
 
SkColorInfooperator= (SkColorInfo &&)
 
SkColorSpacecolorSpace () const
 
sk_sp< SkColorSpacerefColorSpace () const
 
SkColorType colorType () const
 
SkAlphaType alphaType () const
 
bool isOpaque () const
 
bool gammaCloseToSRGB () const
 
bool operator== (const SkColorInfo &other) const
 Does other represent the same color type, alpha type, and color space? More...
 
bool operator!= (const SkColorInfo &other) const
 Does other represent a different color type, alpha type, or color space? More...
 
SkColorInfo makeAlphaType (SkAlphaType newAlphaType) const
 Creates SkColorInfo with same SkColorType, SkColorSpace, with SkAlphaType set to newAlphaType. More...
 
SkColorInfo makeColorType (SkColorType newColorType) const
 Creates new SkColorInfo with same SkAlphaType, SkColorSpace, with SkColorType set to newColorType. More...
 
SkColorInfo makeColorSpace (sk_sp< SkColorSpace > cs) const
 Creates SkColorInfo with same SkAlphaType, SkColorType, with SkColorSpace set to cs. More...
 
int bytesPerPixel () const
 Returns number of bytes per pixel required by SkColorType. More...
 
int shiftPerPixel () const
 Returns bit shift converting row bytes to row pixels. More...
 

Detailed Description

Describes pixel and encoding.

SkImageInfo can be created from SkColorInfo by providing dimensions.

It encodes how pixel bits describe alpha, transparency; color components red, blue, and green; and SkColorSpace, the range and linearity of colors.

Constructor & Destructor Documentation

◆ SkColorInfo() [1/4]

SkColorInfo::SkColorInfo ( )

Creates an SkColorInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, and no SkColorSpace.

Returns
empty SkImageInfo

◆ ~SkColorInfo()

SkColorInfo::~SkColorInfo ( )

◆ SkColorInfo() [2/4]

SkColorInfo::SkColorInfo ( SkColorType  ct,
SkAlphaType  at,
sk_sp< SkColorSpace cs 
)

Creates SkColorInfo from SkColorType ct, SkAlphaType at, and optionally SkColorSpace cs.

If SkColorSpace cs is nullptr and SkColorInfo is part of drawing source: SkColorSpace defaults to sRGB, mapping into SkSurface SkColorSpace.

Parameters are not validated to see if their values are legal, or that the combination is supported.

Returns
created SkColorInfo

◆ SkColorInfo() [3/4]

SkColorInfo::SkColorInfo ( const SkColorInfo )

◆ SkColorInfo() [4/4]

SkColorInfo::SkColorInfo ( SkColorInfo &&  )

Member Function Documentation

◆ alphaType()

SkAlphaType SkColorInfo::alphaType ( ) const
inline

◆ bytesPerPixel()

int SkColorInfo::bytesPerPixel ( ) const

Returns number of bytes per pixel required by SkColorType.

Returns zero if colorType() is kUnknown_SkColorType.

Returns
bytes in pixel

example: https://fiddle.skia.org/c/@ImageInfo_bytesPerPixel

◆ colorSpace()

SkColorSpace* SkColorInfo::colorSpace ( ) const

◆ colorType()

SkColorType SkColorInfo::colorType ( ) const
inline

◆ gammaCloseToSRGB()

bool SkColorInfo::gammaCloseToSRGB ( ) const

◆ isOpaque()

bool SkColorInfo::isOpaque ( ) const
inline

◆ makeAlphaType()

SkColorInfo SkColorInfo::makeAlphaType ( SkAlphaType  newAlphaType) const

Creates SkColorInfo with same SkColorType, SkColorSpace, with SkAlphaType set to newAlphaType.

Created SkColorInfo contains newAlphaType even if it is incompatible with SkColorType, in which case SkAlphaType in SkColorInfo is ignored.

◆ makeColorSpace()

SkColorInfo SkColorInfo::makeColorSpace ( sk_sp< SkColorSpace cs) const

Creates SkColorInfo with same SkAlphaType, SkColorType, with SkColorSpace set to cs.

cs may be nullptr.

◆ makeColorType()

SkColorInfo SkColorInfo::makeColorType ( SkColorType  newColorType) const

Creates new SkColorInfo with same SkAlphaType, SkColorSpace, with SkColorType set to newColorType.

◆ operator!=()

bool SkColorInfo::operator!= ( const SkColorInfo other) const

Does other represent a different color type, alpha type, or color space?

◆ operator=() [1/2]

SkColorInfo& SkColorInfo::operator= ( const SkColorInfo )

◆ operator=() [2/2]

SkColorInfo& SkColorInfo::operator= ( SkColorInfo &&  )

◆ operator==()

bool SkColorInfo::operator== ( const SkColorInfo other) const

Does other represent the same color type, alpha type, and color space?

◆ refColorSpace()

sk_sp<SkColorSpace> SkColorInfo::refColorSpace ( ) const

◆ shiftPerPixel()

int SkColorInfo::shiftPerPixel ( ) const

Returns bit shift converting row bytes to row pixels.

Returns zero for kUnknown_SkColorType.

Returns
one of: 0, 1, 2, 3, 4; left shift to convert pixels to bytes

example: https://fiddle.skia.org/c/@ImageInfo_shiftPerPixel


The documentation for this struct was generated from the following file: