SkImageInfo Reference

Image Info

Overview

Overview Subtopic

name description
Constructor functions that construct SkImageInfo
Member Function static functions and member methods
Operator operator overloading methods
Related Function similar methods grouped together

Constant

name description

Alpha Type

Enum SkAlphaType

enum SkAlphaType {
kUnknown_SkAlphaType,
kOpaque_SkAlphaType,
kPremul_SkAlphaType,
kUnpremul_SkAlphaType,
kLastEnum_SkAlphaType = kUnpremul_SkAlphaType,
};

Describes how to interpret the alpha component of a pixel.

Constants

kUnknown_SkAlphaType 0
kOpaque_SkAlphaType 1All pixels are stored as opaque.
kPremul_SkAlphaType 2All pixels have their alpha premultiplied in their color components. This is the natural format for the rendering target pixels.
kUnpremul_SkAlphaType 3All pixels have their color components stored without any regard to the alpha. e.g. this is the default configuration for PNG images. kUnpremul_SkAlphaType is supported only for input images. Rendering cannot generate this on output.

Example

See Also

incomplete

Color Type

Color Type Native

Enum SkColorType

enum SkColorType {
kUnknown_SkColorType,
kAlpha_8_SkColorType,
kRGB_565_SkColorType,
kARGB_4444_SkColorType,
kRGBA_8888_SkColorType,
kRGB_888x_SkColorType,
kBGRA_8888_SkColorType,
kRGBA_1010102_SkColorType,
kRGB_101010x_SkColorType,
kGray_8_SkColorType,
kRGBA_F16_SkColorType,
kLastEnum_SkColorType = kRGBA_F16_SkColorType,
kN32_SkColorType = kBGRA_8888_SkColorType,
kN32_SkColorType = kRGBA_8888_SkColorType,
};

Describes how to interpret the components of a pixel.

kN32_SkColorType selects the native 32-bit Color ARGB format. On Little_Endian processors, pixels containing 8-bit Color ARGB components pack into 32-bit kBGRA_8888_SkColorType. On Big_Endian processors, pixels pack into 32-bit kRGBA_8888_SkColorType.

Constants

kUnknown_SkColorType 0
kAlpha_8_SkColorType 1
kRGB_565_SkColorType 2
kARGB_4444_SkColorType 3
kRGBA_8888_SkColorType 4
kRGB_888x_SkColorType 5
kBGRA_8888_SkColorType 6
kRGBA_1010102_SkColorType 7
kRGB_101010x_SkColorType 8
kGray_8_SkColorType 9
kRGBA_F16_SkColorType 10

Constants

kN32_SkColorType 4

Example

See Also

incomplete

YUV ColorSpace

Enum SkYUVColorSpace

enum SkYUVColorSpace {
kJPEG_SkYUVColorSpace,
kRec601_SkYUVColorSpace,
kRec709_SkYUVColorSpace,
kLastEnum_SkYUVColorSpace = kRec709_SkYUVColorSpace,
};

Describes the color space a YUV pixel.

Constants

kJPEG_SkYUVColorSpace 0Standard JPEG color space.
kRec601_SkYUVColorSpace 1SDTV standard Rec. 601 color space. Uses "studio swing" [16, 235] color range. See http://en.wikipedia.org/wiki/Rec._601 for details.
kRec709_SkYUVColorSpace 2HDTV standard Rec. 709 color space. Uses "studio swing" [16, 235] color range. See http://en.wikipedia.org/wiki/Rec._709 for details.

Example

See Also

incomplete

Enum SkDestinationSurfaceColorMode

enum class SkDestinationSurfaceColorMode {
kLegacy,
kGammaAndColorSpaceAware,
};

Constants

SkDestinationSurfaceColorMode::kLegacy 0
SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware 1

Example

See Also

incomplete

Struct SkImageInfo

Describes Image dimensions and pixel type. Used for both source images and render-targets (surfaces).

Member Function

name description
ByteSizeOverflowed incomplete
Make creates Image Info from dimensions, Color Type, Alpha Type, Color Space
MakeA8 creates Image Info with kAlpha_8_SkColorType, kPremul_SkAlphaType
MakeN32 creates Image Info with Native Color Type
MakeN32Premul creates Image Info with Native Color Type, kPremul_SkAlphaType
MakeS32 creates Image Info with Native Color Type, sRGB Color Space
MakeUnknown creates Image Info with kUnknown_SkColorType, kUnknown_SkAlphaType
alphaType incomplete
bounds incomplete
bytesPerPixel incomplete
colorSpace incomplete
colorType incomplete
computeByteSize incomplete
computeMinByteSize incomplete
computeOffset incomplete
dimensions incomplete
flatten incomplete
gammaCloseToSRGB incomplete
height incomplete
isEmpty incomplete
isOpaque incomplete
makeAlphaType creates Image Info with changed Alpha Type
makeColorSpace creates Image Info with changed Color Space
makeColorType creates Image Info with changed Color Type
makeWH creates Image Info with changed dimensions
minRowBytes incomplete
minRowBytes64 incomplete
refColorSpace incomplete
reset incomplete
shiftPerPixel incomplete
unflatten incomplete
validRowBytes incomplete
validate incomplete
width incomplete

Related Function

name description
Property metrics and attributes
Utility rarely called management functions

Constructor

name description
Make creates Image Info from dimensions, Color Type, Alpha Type, Color Space
MakeA8 creates Image Info with kAlpha_8_SkColorType, kPremul_SkAlphaType
MakeN32 creates Image Info with Native Color Type
MakeN32Premul creates Image Info with Native Color Type, kPremul_SkAlphaType
MakeN32Premul(int width, int height, sk sp<SkColorSpace> cs = nullptr)
MakeN32Premul(const SkISize& size)
MakeS32 creates Image Info with Native Color Type, sRGB Color Space
MakeUnknown creates Image Info with kUnknown_SkColorType, kUnknown_SkAlphaType
MakeUnknown(int width, int height)
MakeUnknown()
SkImageInfo() creates with zero dimensions, kUnknown_SkColorType, kUnknown_SkAlphaType
makeAlphaType creates Image Info with changed Alpha Type
makeColorSpace creates Image Info with changed Color Space
makeColorType creates Image Info with changed Color Type
makeWH creates Image Info with changed dimensions
reset incomplete

SkImageInfo

SkImageInfo()

Return Value

incomplete

Example

See Also

incomplete


Make

static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at,
                        sk_sp<SkColorSpace> cs = nullptr)

Parameters

width incomplete
height incomplete
ct incomplete
at incomplete
cs incomplete

Return Value

incomplete

Example

See Also

incomplete


MakeN32

static SkImageInfo MakeN32(int width, int height, SkAlphaType at, sk_sp<SkColorSpace> cs = nullptr)

Sets Color Type to kN32_SkColorType.

Parameters

width incomplete
height incomplete
at incomplete
cs incomplete

Return Value

incomplete

Example

See Also

incomplete


MakeS32

static SkImageInfo MakeS32(int width, int height, SkAlphaType at)

Creates Image Info marked as sRGB with kN32_SkColorType swizzle.

Parameters

width incomplete
height incomplete
at incomplete

Return Value

incomplete

Example

See Also

incomplete


MakeN32Premul

static SkImageInfo MakeN32Premul(int width, int height, sk_sp<SkColorSpace> cs = nullptr)

Sets Color Type to kN32_SkColorType, and the Alpha Type to kPremul_SkAlphaType.

Parameters

width incomplete
height incomplete
cs incomplete

Return Value

incomplete

Example

See Also

incomplete


static SkImageInfo MakeN32Premul(const SkISize& size)

Parameters

size incomplete

Return Value

incomplete

Example

See Also

incomplete


MakeA8

static SkImageInfo MakeA8(int width, int height)

Parameters

width incomplete
height incomplete

Return Value

incomplete

Example

See Also

incomplete


MakeUnknown

static SkImageInfo MakeUnknown(int width, int height)

Parameters

width incomplete
height incomplete

Return Value

incomplete

Example

See Also

incomplete


static SkImageInfo MakeUnknown()

Return Value

incomplete

Example

See Also

incomplete


Property

name description
alphaType incomplete
bounds incomplete
bytesPerPixel incomplete
colorSpace incomplete
colorType incomplete
dimensions incomplete
gammaCloseToSRGB incomplete
height incomplete
isEmpty incomplete
isOpaque incomplete
minRowBytes incomplete
minRowBytes64 incomplete
refColorSpace incomplete
shiftPerPixel incomplete
width incomplete

width

int width() const

Return Value

incomplete

Example

See Also

incomplete


height

int height() const

Return Value

incomplete

Example

See Also

incomplete


colorType

SkColorType colorType() const

Return Value

incomplete

Example

See Also

incomplete


alphaType

SkAlphaType alphaType() const

Return Value

incomplete

Example

See Also

incomplete


colorSpace

SkColorSpace* colorSpace() const

Return Value

incomplete

Example

See Also

incomplete


refColorSpace

sk_sp<SkColorSpace> refColorSpace() const

Return Value

incomplete

Example

See Also

incomplete


isEmpty

bool isEmpty() const

Return Value

incomplete

Example

See Also

incomplete


isOpaque

bool isOpaque() const

Return Value

incomplete

Example

See Also

incomplete


dimensions

SkISize dimensions() const

Return Value

incomplete

Example

See Also

incomplete


bounds

SkIRect bounds() const

Return Value

incomplete

Example

See Also

incomplete


gammaCloseToSRGB

bool gammaCloseToSRGB() const

Return Value

incomplete

Example

See Also

incomplete


makeWH

SkImageInfo makeWH(int newWidth, int newHeight) const

Creates Image Info with the same Color Type and Alpha Type as this info, but with the specified width and height.

Parameters

newWidth incomplete
newHeight incomplete

Return Value

incomplete

Example

See Also

incomplete


makeAlphaType

SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const

Parameters

newAlphaType incomplete

Return Value

incomplete

Example

See Also

incomplete


makeColorType

SkImageInfo makeColorType(SkColorType newColorType) const

Parameters

newColorType incomplete

Return Value

incomplete

Example

See Also

incomplete


makeColorSpace

SkImageInfo makeColorSpace(sk_sp<SkColorSpace> cs) const

Parameters

cs incomplete

Return Value

incomplete

Example

See Also

incomplete


bytesPerPixel

int bytesPerPixel() const

Return Value

incomplete

Example

See Also

incomplete


shiftPerPixel

int shiftPerPixel() const

Return Value

incomplete

Example

See Also

incomplete


minRowBytes64

uint64_t minRowBytes64() const

Return Value

incomplete

Example

See Also

incomplete


minRowBytes

size_t minRowBytes() const

Return Value

incomplete

Example

See Also

incomplete


computeOffset

size_t computeOffset(int x, int y, size_t rowBytes) const

Parameters

x incomplete
y incomplete
rowBytes incomplete

Return Value

incomplete

Example

See Also

incomplete


Operator

name description
operator!=(const SkImageInfo& other) const incomplete
operator==(const SkImageInfo& other) const incomplete

operator==

bool operator==(const SkImageInfo& other) _const

Parameters

other incomplete

Return Value

incomplete

Example

See Also

incomplete


operator!=

bool operator!=(const SkImageInfo& other) _const

Parameters

other incomplete

Return Value

incomplete

Example

See Also

incomplete


unflatten

void unflatten(SkReadBuffer& buffer)

Parameters

buffer incomplete

Example

See Also

incomplete


flatten

void flatten(SkWriteBuffer& buffer) const

Parameters

buffer incomplete

Example

See Also

incomplete


computeByteSize

size_t computeByteSize(size_t rowBytes) const

Returns the size (in bytes) of the image buffer that this info needs, given the specified rowBytes. The rowBytes must be >= this->minRowBytes. if (height == 0) { return 0; } else { return (height - 1) * rowBytes + width * bytes_per_pixel.

If the calculation overflows this returns SK MaxSizeT.

Parameters

rowBytes incomplete

Return Value

incomplete

Example

See Also

incomplete


computeMinByteSize

size_t computeMinByteSize() const

Returns the minimum size (in bytes) of the image buffer that this info needs. If the calculation overflows, or if the height is 0, this returns 0.

Return Value

incomplete

Example

See Also

incomplete


ByteSizeOverflowed

static bool ByteSizeOverflowed(size_t byteSize)

Returns true if the result of computeByteSize (or computeMinByteSize) overflowed

Parameters

byteSize incomplete

Return Value

incomplete

Example

See Also

incomplete


validRowBytes

bool validRowBytes(size_t rowBytes) const

Parameters

rowBytes incomplete

Return Value

incomplete

Example

See Also

incomplete


reset

void reset()

Example

See Also

incomplete


Utility

name description
ByteSizeOverflowed incomplete
computeByteSize incomplete
computeMinByteSize incomplete
computeOffset incomplete
flatten incomplete
unflatten incomplete
validRowBytes incomplete
validate incomplete

validate

void validate() const

Example

See Also

incomplete