std1.0.0-beta-7 SafeC docs

std :: gui::gui_canvas

Struct std::GuiPaint

#include <std/gui/gui_canvas.h> source

struct GuiPaint {
    int kind;
    struct GuiColor color;
    float x0;
    float y0;
    float r0;
    float x1;
    float y1;
    float r1;
    int nstops;
    struct GuiColorStop stops[GUI_GRADIENT_MAX_STOPS];
    int spread;
    const ?&GuiImage image;
    struct GuiMatrix matrix;
    int filter;
    float opacity;
}

What to fill or stroke with. A value type: build one, add stops, hand it to set_fill_paint()/set_stroke_paint() (which copy it).

Fields

§int kindsource

GUI_PAINT_*

§struct GuiColor colorsource

SOLID

§float x0source

LINEAR: from (x0,y0) to (x1,y1). RADIAL: from the circle (x0,y0,r0) to the circle (x1,y1,r1). SWEEP: around (x0,y0), starting at angle r0 (radians, clockwise).

§float y0source

LINEAR: from (x0,y0) to (x1,y1). RADIAL: from the circle (x0,y0,r0) to the circle (x1,y1,r1). SWEEP: around (x0,y0), starting at angle r0 (radians, clockwise).

§float r0source

LINEAR: from (x0,y0) to (x1,y1). RADIAL: from the circle (x0,y0,r0) to the circle (x1,y1,r1). SWEEP: around (x0,y0), starting at angle r0 (radians, clockwise).

§float x1source
§float y1source
§float r1source
§int nstopssource
§int spreadsource

GUI_SPREAD_*

§const ?&GuiImage imagesource

IMAGE: the pattern (must outlive the drawing)

§struct GuiMatrix matrixsource

paint space -> user space (pattern/gradient transform)

§int filtersource

GUI_FILTER_* (IMAGE)

§float opacitysource

multiplies the paint's alpha (default 1)

Methods

§static struct GuiPaint solid(struct GuiColor c)source · definition
§static struct GuiPaint linear(float x0, float y0, float x1, float y1)source · definition
§static struct GuiPaint radial(float cx, float cy, float r)source · definition
§static struct GuiPaint radial2(float x0, float y0, float r0, float x1, float y1, float r1)source · definition

Two-circle radial gradient, like the HTML canvas' createRadialGradient.

§static struct GuiPaint sweep(float cx, float cy, float startAngle)source · definition
§static struct GuiPaint pattern(const &GuiImage img)source · definition

An image pattern, its pixel (0,0) at user-space (0,0), one image pixel per user unit (change with set_transform()). Spread: GUI_SPREAD_REPEAT.

§void add_stop(float offset, struct GuiColor c)source · definition

Adds a color stop (stops may be added in any order; beyond GUI_GRADIENT_MAX_STOPS they're ignored).

§void set_transform(struct GuiMatrix m)source · definition
§void set_spread(int spread)source · definition
§void set_filter(int filter)source · definition
§void set_opacity(float opacity)source · definition