tiny-skia-cpp
A C++20 2D rendering library (port of tiny-skia)
Loading...
Searching...
No Matches
tiny_skia::Mask Class Reference

8-bit alpha mask for clipping. More...

#include <tiny_skia/Mask.h>

Public Member Functions

std::vector< std::uint8_t > release ()
 Releases the underlying byte buffer.
 
void fillPath (const Path &path, FillRule fillRule, bool antiAlias, Transform transform)
 Draws a filled path onto the mask (white=255 where filled).
 
void intersectPath (const Path &path, FillRule fillRule, bool antiAlias, Transform transform)
 Intersects (AND) a path with the current mask contents.
 
void invert ()
 Inverts all mask values (255 - x).
 
void clear ()
 Clears the mask to zero.
 

Static Public Member Functions

static std::optional< MaskfromSize (std::uint32_t width, std::uint32_t height)
 Creates a zero-filled mask. Returns nullopt for zero dimensions.
 
static std::optional< MaskfromVec (std::vector< std::uint8_t > data, IntSize size)
 Creates a mask from existing data. Returns nullopt if size mismatches.
 
static Mask fromPixmap (const PixmapView &pixmap, MaskType maskType)
 Extracts a mask from a pixmap's alpha or luminance channel.
 

Detailed Description

Create with fromSize() (zero-filled), then draw paths with fillPath() or derive from a pixmap with fromPixmap(). Pass to Painter methods to clip drawing to the mask.


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