Struct std::GuiCanvas
struct GuiCanvas {
?&unsigned char px;
int width;
int height;
int stride;
struct GuiCanvasState st;
struct Vec<struct GuiCanvasState> saved;
struct GuiPath path;
struct Vec<struct GuiEdge> edges;
struct Vec<float> acc;
struct Vec<float> xs;
struct Vec<int> sorted;
struct Vec<int> active;
struct Vec<float> fpts;
struct Vec<int> fcont;
struct Vec<float> dpts;
struct Vec<int> dcont;
struct Vec<float> spts;
struct Vec<int> scont;
struct Vec<float> row;
struct Vec<float> lut;
struct GuiPath scratchPath;
}Fields
target pixels: premultiplied RGBA8888
bytes per row
the save() stack
the current path (begin_path/move_to/...)
scratch buffers, kept between calls to avoid reallocating
flattened polylines: x,y pairs ...
... and (first point, point count, closed) triples
dashed polylines
stroke outline polygons
one row of coverage
gradient colors (256 premultiplied RGBA)
Methods
Draws into an image (premultiplying its pixels first if they're straight-alpha, see GuiImage.premultiplied).
static struct GuiCanvas for_pixels(&unsigned char px, int width, int height, int stride)source · definitionAny premultiplied RGBA8888 buffer.
Point at the window's (possibly reallocated) buffer again. Resets the clip if the size changed.
Back to the initial state (identity transform, black fill, no clip, empty save stack and path).
= drop()
Pre-multiplies the current transform by m (m applies first).
Alternating on/off lengths (n <= GUI_DASH_MAX; an odd count repeats once more, as in SVG); n = 0 turns dashing off.
0 = aliased (hard pixel edges: coverage rounded to 0 or 1).
with the current path
The clip's device-space bounds.
Makes the rectangle transparent (within the clip).
Fills the whole target with 'c', ignoring transform, clip and blend.
The filled outline of stroking 'p' with the current line settings, in user space — e.g. to hit-test or clip to a stroke.
void draw_image_rect(
const &GuiImage img,
float sx,
float sy,
float sw,
float sh,
float dx,
float dy,
float dw,
float dh,
)source · definitionThe (sx,sy,sw,sh) part of the image into (dx,dy,dw,dh).
Draws one line of UTF-8 text with the fill paint at (x, y) (see set_text_baseline/set_text_align). Returns its advance width.
Draws a built layout with its top-left at (x, y).
The straight-alpha color at device pixel (x, y) (transparent if out of bounds).