Skia
2DGraphicsLibrary
|
SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or the 3-channel 3D format. More...
#include <SkMask.h>
Public Types | |
enum | Format { kBW_Format, kA8_Format, k3D_Format, kARGB32_Format, kLCD16_Format } |
enum | { kCountMaskFormats = kLCD16_Format + 1 } |
enum | CreateMode { kJustComputeBounds_CreateMode, kJustRenderImage_CreateMode, kComputeBoundsAndRenderImage_CreateMode } |
Public Member Functions | |
bool | isEmpty () const |
Returns true if the mask is empty: i.e. More... | |
size_t | computeImageSize () const |
Return the byte size of the mask, assuming only 1 plane. More... | |
size_t | computeTotalImageSize () const |
Return the byte size of the mask, taking into account any extra planes (e.g. More... | |
uint8_t * | getAddr1 (int x, int y) const |
Returns the address of the byte that holds the specified bit. More... | |
uint8_t * | getAddr8 (int x, int y) const |
Returns the address of the specified byte. More... | |
uint16_t * | getAddrLCD16 (int x, int y) const |
Return the address of the specified 16bit mask. More... | |
uint32_t * | getAddr32 (int x, int y) const |
Return the address of the specified 32bit mask. More... | |
void * | getAddr (int x, int y) const |
Returns the address of the specified pixel, computing the pixel-size at runtime based on the mask format. More... | |
Static Public Member Functions | |
static uint8_t * | AllocImage (size_t bytes) |
static void | FreeImage (void *image) |
Public Attributes | |
uint8_t * | fImage |
SkIRect | fBounds |
uint32_t | fRowBytes |
Format | fFormat |
SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or the 3-channel 3D format.
These are passed to SkMaskFilter objects.
enum SkMask::CreateMode |
enum SkMask::Format |
size_t SkMask::computeImageSize | ( | ) | const |
Return the byte size of the mask, assuming only 1 plane.
Does not account for k3D_Format. For that, use computeTotalImageSize(). If there is an overflow of 32bits, then returns 0.
size_t SkMask::computeTotalImageSize | ( | ) | const |
Return the byte size of the mask, taking into account any extra planes (e.g.
k3D_Format). If there is an overflow of 32bits, then returns 0.
void* SkMask::getAddr | ( | int | x, |
int | y | ||
) | const |
Returns the address of the specified pixel, computing the pixel-size at runtime based on the mask format.
This will be slightly slower than using one of the routines where the format is implied by the name e.g. getAddr8 or getAddr32.
x,y must be contained by the mask's bounds (this is asserted in the debug build, but not checked in the release build.)
This should not be called with kBW_Format, as it will give unspecified results (and assert in the debug build).
|
inline |
Returns the address of the byte that holds the specified bit.
Asserts that the mask is kBW_Format, and that x,y are in range. x,y are in the same coordiate space as fBounds.
|
inline |
Return the address of the specified 32bit mask.
In the debug build, this asserts that the mask's format is 32bits, and that (x,y) are contained in the mask's fBounds.
|
inline |
Returns the address of the specified byte.
Asserts that the mask is kA8_Format, and that x,y are in range. x,y are in the same coordiate space as fBounds.
|
inline |
Return the address of the specified 16bit mask.
In the debug build, this asserts that the mask's format is kLCD16_Format, and that (x,y) are contained in the mask's fBounds.
|
inline |
Returns true if the mask is empty: i.e.
it has an empty bounds.