Skia
2D Graphics Library
SkImageInfo.h File Reference
#include "include/core/SkColorSpace.h"
#include "include/core/SkMath.h"
#include "include/core/SkRect.h"
#include "include/core/SkSize.h"
#include "include/private/SkTFitsIn.h"
#include "include/private/SkTo.h"
Include dependency graph for SkImageInfo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SkColorInfo
 Describes pixel and encoding. More...
 
struct  SkImageInfo
 Describes pixel dimensions and encoding. More...
 

Macros

#define SK_EXTENDED_COLOR_TYPES
 Temporary macro that allows us to add new color types without breaking Chrome compile. More...
 

Enumerations

enum  SkAlphaType {
  kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType,
  kLastEnum_SkAlphaType = kUnpremul_SkAlphaType
}
 
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,
  kBGRA_1010102_SkColorType, kRGB_101010x_SkColorType, kBGR_101010x_SkColorType, kGray_8_SkColorType,
  kRGBA_F16Norm_SkColorType, kRGBA_F16_SkColorType, kRGBA_F32_SkColorType, kR8G8_unorm_SkColorType,
  kA16_float_SkColorType, kR16G16_float_SkColorType, kA16_unorm_SkColorType, kR16G16_unorm_SkColorType,
  kR16G16B16A16_unorm_SkColorType, kLastEnum_SkColorType = kR16G16B16A16_unorm_SkColorType
}
 
enum  SkYUVColorSpace {
  kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace, kRec709_SkYUVColorSpace, kBT2020_SkYUVColorSpace,
  kIdentity_SkYUVColorSpace, kLastEnum_SkYUVColorSpace = kIdentity_SkYUVColorSpace
}
 

Functions

static bool SkAlphaTypeIsOpaque (SkAlphaType at)
 Returns true if SkAlphaType equals kOpaque_SkAlphaType. More...
 
SK_API int SkColorTypeBytesPerPixel (SkColorType ct)
 Returns the number of bytes required to store a pixel, including unused padding. More...
 
SK_API bool SkColorTypeIsAlwaysOpaque (SkColorType ct)
 Returns true if SkColorType always decodes alpha to 1.0, making the pixel fully opaque. More...
 
SK_API bool SkColorTypeValidateAlphaType (SkColorType colorType, SkAlphaType alphaType, SkAlphaType *canonical=nullptr)
 Returns true if canonical can be set to a valid SkAlphaType for colorType. More...
 

Macro Definition Documentation

◆ SK_EXTENDED_COLOR_TYPES

#define SK_EXTENDED_COLOR_TYPES

Temporary macro that allows us to add new color types without breaking Chrome compile.

Enumeration Type Documentation

◆ SkAlphaType

Enumerator
kUnknown_SkAlphaType 

uninitialized

kOpaque_SkAlphaType 

pixel is opaque

kPremul_SkAlphaType 

pixel components are premultiplied by alpha

kUnpremul_SkAlphaType 

pixel components are independent of alpha

kLastEnum_SkAlphaType 

last valid value

◆ SkColorType

Enumerator
kUnknown_SkColorType 

uninitialized

kAlpha_8_SkColorType 

pixel with alpha in 8-bit byte

kRGB_565_SkColorType 

pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word

kARGB_4444_SkColorType 

pixel with 4 bits for alpha, red, green, blue; in 16-bit word

kRGBA_8888_SkColorType 

pixel with 8 bits for red, green, blue, alpha; in 32-bit word

kRGB_888x_SkColorType 

pixel with 8 bits each for red, green, blue; in 32-bit word

kBGRA_8888_SkColorType 

pixel with 8 bits for blue, green, red, alpha; in 32-bit word

kRGBA_1010102_SkColorType 

10 bits for red, green, blue; 2 bits for alpha; in 32-bit word

kBGRA_1010102_SkColorType 

10 bits for blue, green, red; 2 bits for alpha; in 32-bit word

kRGB_101010x_SkColorType 

pixel with 10 bits each for red, green, blue; in 32-bit word

kBGR_101010x_SkColorType 

pixel with 10 bits each for blue, green, red; in 32-bit word

kGray_8_SkColorType 

pixel with grayscale level in 8-bit byte

kRGBA_F16Norm_SkColorType 

pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word

kRGBA_F16_SkColorType 

pixel with half floats for red, green, blue, alpha; in 64-bit word

kRGBA_F32_SkColorType 

pixel using C float for red, green, blue, alpha; in 128-bit word

kR8G8_unorm_SkColorType 
kA16_float_SkColorType 
kR16G16_float_SkColorType 
kA16_unorm_SkColorType 
kR16G16_unorm_SkColorType 
kR16G16B16A16_unorm_SkColorType 
kLastEnum_SkColorType 

last valid value

◆ SkYUVColorSpace

Enumerator
kJPEG_SkYUVColorSpace 

describes full range

kRec601_SkYUVColorSpace 

describes SDTV range

kRec709_SkYUVColorSpace 

describes HDTV range

kBT2020_SkYUVColorSpace 

describes UHDTV range, non-constant-luminance

kIdentity_SkYUVColorSpace 

maps Y->R, U->G, V->B

kLastEnum_SkYUVColorSpace 

last valid value

Function Documentation

◆ SkAlphaTypeIsOpaque()

static bool SkAlphaTypeIsOpaque ( SkAlphaType  at)
inlinestatic

Returns true if SkAlphaType equals kOpaque_SkAlphaType.

kOpaque_SkAlphaType is a hint that the SkColorType is opaque, or that all alpha values are set to their 1.0 equivalent. If SkAlphaType is kOpaque_SkAlphaType, and SkColorType is not opaque, then the result of drawing any pixel with a alpha value less than 1.0 is undefined.

◆ SkColorTypeBytesPerPixel()

SK_API int SkColorTypeBytesPerPixel ( SkColorType  ct)

Returns the number of bytes required to store a pixel, including unused padding.

Returns zero if ct is kUnknown_SkColorType or invalid.

Returns
bytes per pixel

◆ SkColorTypeIsAlwaysOpaque()

SK_API bool SkColorTypeIsAlwaysOpaque ( SkColorType  ct)

Returns true if SkColorType always decodes alpha to 1.0, making the pixel fully opaque.

If true, SkColorType does not reserve bits to encode alpha.

Returns
true if alpha is always set to 1.0

◆ SkColorTypeValidateAlphaType()

SK_API bool SkColorTypeValidateAlphaType ( SkColorType  colorType,
SkAlphaType  alphaType,
SkAlphaType canonical = nullptr 
)

Returns true if canonical can be set to a valid SkAlphaType for colorType.

If there is more than one valid canonical SkAlphaType, set to alphaType, if valid. If true is returned and canonical is not nullptr, store valid SkAlphaType.

Returns false only if alphaType is kUnknown_SkAlphaType, color type is not kUnknown_SkColorType, and SkColorType is not always opaque. If false is returned, canonical is ignored.

Parameters
canonicalstorage for SkAlphaType
Returns
true if valid SkAlphaType can be associated with colorType