Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkMask Class Reference

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
 

Detailed Description

SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or the 3-channel 3D format.

These are passed to SkMaskFilter objects.

Member Enumeration Documentation

Enumerator
kJustComputeBounds_CreateMode 

compute bounds and return

kJustRenderImage_CreateMode 

render into preallocate mask

kComputeBoundsAndRenderImage_CreateMode 

compute bounds, alloc image and render into it

Enumerator
kBW_Format 

1bit per pixel mask (e.g. monochrome)

kA8_Format 

8bits per pixel mask (e.g. antialiasing)

k3D_Format 

3 8bit per pixl planes: alpha, mul, add

kARGB32_Format 

SkPMColor.

kLCD16_Format 

565 alpha for r/g/b

Member Function Documentation

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).

uint8_t* SkMask::getAddr1 ( int  x,
int  y 
) const
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.

uint32_t* SkMask::getAddr32 ( int  x,
int  y 
) const
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.

uint8_t* SkMask::getAddr8 ( int  x,
int  y 
) const
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.

uint16_t* SkMask::getAddrLCD16 ( int  x,
int  y 
) const
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.

bool SkMask::isEmpty ( ) const
inline

Returns true if the mask is empty: i.e.

it has an empty bounds.


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