Import std.image.canvas
std.image.canvas
Canvas: drawing on an Image, through the runtime's fb_image_ functions. A pixel is the square from its (x, y) to (x + 1, y + 1), so the line along y = 5.5 from x = 0 covers row 5's pixels to their middles both ways. Each Fill fills a region by the nonzero rule, FillText a font's glyphs, and each Stroke what its line covers, LineWidth wide, with its Join at each corner and its Cap at each end, all drawn over the image by their color's alpha: by the exact part of each pixel the region covers, antialiased, or wholly where it holds the pixel's center.
std/image/canvas.fb
Types
LineCap
enum
Public Enum LineCap
How a stroke's open ends end.
-
Where the line does.
-
In a half circle.
-
Half the line's width past where the line does.
LineJoin
enum
Public Enum LineJoin
How a stroke's corners are filled on their outside.
-
To where its sides' edges meet, unless that's more than MiterLimit times the width from the inside corner, when it's a bevel.
-
In the circle of the line's width.
-
Cut straight across.
Canvas
class
Public Class Canvas
What draws on an Image: lines, shapes, paths, images, and text, filled or stroked, in a color or a gradient.
-
A canvas for drawing on
image, antialiased, with lines 1 wide, butt caps, and miter joins up to 4 times the width, as SVG's are. -
The image it draws on.
-
Whether it draws each pixel by the part of it what's drawn covers, or else wholly when what's drawn holds its center.
-
How wide a stroke is. Panics when it's given one that's negative or not finite.
-
How a stroke's ends are drawn.
-
How a stroke's corners are filled on their outside.
-
How far a miter goes, from the inside corner, times the line's width, before it's a bevel. Panics when it's given one below 1 or not finite.
-
Fills the rectangle. Panics when its corner or size isn't finite, its size is negative, or its far corner is past what a Float holds.
-
Strokes the rectangle's edges, closed. Panics as FillRect does.
-
Strokes the line from
atob. Panics when either isn't finite. -
Strokes the line through the
points, open. Panics when one isn't finite. -
Strokes the polygon's edges, closed from its last point back to its first. Panics when a point isn't finite.
-
Fills the polygon, by the nonzero rule. Panics when a point isn't finite.
-
Fills the region of
rings, each closed, by the nonzero rule, as std.math's polygons are, so a ring the other way around from the one it's in is a hole. Panics when a point isn't finite. -
Fills the circle. Panics when its center or
radiusisn't finite, or its radius is negative. -
Strokes the circle. Panics as FillCircle does.
-
Fills the ellipse of the
radiiacross and down. Panics when its center orradiiaren't finite, or a radius is negative. -
Strokes the ellipse, its outline LineWidth wide. Panics as FillEllipse does.
-
@PanicsAtCaller Public Method FillText(text: String, font: Font, size: Float, position: Vec2, color: Color32)method #Fills the
textin thefontatsizepixels an em, its first line's baseline fromposition, as one region: each glyph after the last's advance and the kerning between them, unrounded, each line feed a line's height down, and a code point thefonthas no glyph for its .notdef. Panics when thesizeisn't finite or is negative, or thepositionisn't finite.
Report an issue with this page or with FutureBlitz on GitHub.