psychic-ui 0.0.0
Loading...
Searching...
No Matches
psychic_ui::paint Namespace Reference

Classes

struct  Box

Functions

void fill (SkCanvas *canvas, const SkRRect &shape, const Color color, const bool antiAlias)
void fill (SkCanvas *canvas, const SkRect &shape, const Color color, const bool antiAlias)
void stroke (SkCanvas *canvas, const SkRRect &shape, const Color color, const float width, const bool antiAlias)
bool icon (SkCanvas *canvas, const std::string_view name, const SkRect &rect, const Color color, const float strokeWidth, IconRegistry *registry)
void arrow (SkCanvas *canvas, const SkRect &bounds, const Color color, const bool antiAlias)
void disc (SkCanvas *canvas, const SkPoint center, const float radius, const Color color, const bool antiAlias)
void circle (SkCanvas *canvas, const SkPoint center, const float radius, const Color color, const float width, const bool antiAlias)

Variables

constexpr float iconStroke = 1.3f

Detailed Description

Painting primitives for skins: no state, everything comes from the arguments

Small shapes skins draw: arrows, circles

Function Documentation

◆ arrow()

void psychic_ui::paint::arrow ( SkCanvas * canvas,
const SkRect & bounds,
Color color,
bool antiAlias = true )

A filled triangle pointing right, filling its bounds (a submenu's arrow)

◆ circle()

void psychic_ui::paint::circle ( SkCanvas * canvas,
SkPoint center,
float radius,
Color color,
float width = 0.0f,
bool antiAlias = true )

A circle's outline; a width of 0 is a hairline, one pixel whatever the scale

◆ disc()

void psychic_ui::paint::disc ( SkCanvas * canvas,
SkPoint center,
float radius,
Color color,
bool antiAlias = true )

A filled circle

◆ icon()

bool psychic_ui::paint::icon ( SkCanvas * canvas,
std::string_view name,
const SkRect & rect,
Color color,
float strokeWidth = iconStroke,
IconRegistry * registry = nullptr )

Draws a registered icon (IconRegistry::shared(), or registry) in color: its grid fills the largest square centered in rect, whose corner is put on a device pixel when the canvas only scales and translates. strokeWidth is in units of a 16-unit grid, whatever the icon's own grid, so every icon has the same weight at the same size: at 16 px a width of 1.3 is 1.3 px, at 20 px 1.625 px. Returns false, drawing nothing, for an unknown name (reported once).

Variable Documentation

◆ iconStroke

float psychic_ui::paint::iconStroke = 1.3f
inlineconstexpr

The default iconStrokeWidth: Pivotal's stroke, 1.3 units of a 16-unit grid