The library documents itself · Graphics
stzCanvas
41 own methods · 25 forms written with extensions, listed under their method
the source: base/graphics/stzCanvas.ring(opens in a new tab) · All classes · The area reference: Graphics
Under each method, its extensions (Q CS XT Z ZZ IB W U): bold and ticked, it exists; struck, it does not. The extensions and what they mean
Examples: 0 come from the library's tests; 8 were composed from each method's signature and run for this page, on a fresh object, for example o1 = new stzCanvas(1240, 1000). 33 methods have none yet. Examples run on 2026-10-03 12:54 inside the library at commit 0e72e2e2c.
Method
Explanation, as the source carries it
init
(no comment in the source: the name reads as a sentence) initno extension
Id_
identityno extension
Width
(no comment in the source: the name reads as a sentence) widthno extension
composed example
o1 = new stzCanvas(1240, 1000) ? o1.Width() #--> 1240composed from the signature, run for this page
Height
(no comment in the source: the name reads as a sentence) heightno extension
composed example
o1 = new stzCanvas(1240, 1000) ? o1.Height() #--> 1000composed from the signature, run for this page
ShapeCount
(no comment in the source: the name reads as a sentence) shape countno extension
composed example
o1 = new stzCanvas(1240, 1000) ? o1.ShapeCount() #--> 0composed from the signature, run for this page
Stats
[ shapes, shapeVertices, textVertices, drawSegments, builds ]no extension
composed example
o1 = new stzCanvas(1240, 1000) ? @@( o1.Stats() ) #--> [ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]composed from the signature, run for this page
SetBackground
canvas-wide stateQCSXTZZZIBWU
SetFont
(no comment in the source: the name reads as a sentence) set fontQCSXTZZZIBWU
AddRect
adding shapesQCSXTZZZIBWU
composed example
o1 = new stzCanvas(1240, 1000) o1.AddRect(2, 5, 2, 2) ? o1.Content() #--> <svg xmlns="http://www.w3.org/2000/svg" width="1240" height="1000" viewBox="0 0 1240 1000"> #--> <rect x="2" y="5" width="2" height="2" fill="rgb(255,255,255)"/> #--> </svg>composed from the signature, run for this page
AddGradientRect
A rectangle whose fill runs from one colour to another; bVertical picks the axis.QCSXTZZZIBWU
AddCircle
(no comment in the source: the name reads as a sentence) add circleQCSXTZZZIBWU
composed example
o1 = new stzCanvas(1240, 1000) o1.AddCircle(2, 5, 2) ? o1.Content() #--> <svg xmlns="http://www.w3.org/2000/svg" width="1240" height="1000" viewBox="0 0 1240 1000"> #--> <circle cx="2" cy="5" r="2" fill="rgb(255,255,255)"/> #--> </svg>composed from the signature, run for this page
AddRoundRect
A ROUNDED rectangle -- the visual signature of every diagram graphviz draws with style=rounded, which is what an org chart looks like.QCSXTZZZIBWU
AddEllipse
The primitive the DIAGRAM layer was missing. Of graphviz's 24 node shapes, twenty are a circle, a rect or a polygon -- all already here -- and the remaining four (ellipse, egg, cylinder, doublecircle) all need this one. Tessellated engine-side, on the same segment bound as the circle, so a stroked ellipse traces exactly the filled one.QCSXTZZZIBWU
AddImage
Both tiers carry it: the GPU draws a textured quad, and ToSVG() embeds a base64 PNG -- so a picture with a spectrogram in it is still one self-contained file that needs no device.QCSXTZZZIBWU
AddMesh
paVerts is flat -- x, y, r, g, b, a per vertex, pixel space, channels 0..255. paIndices is 0-based triangle indices into it. Both tiers carry it: the GPU draws the triangles through the ordinary shape pipeline (no new shader, no extra draw call), and ToSVG() emits one <polygon> per triangle -- exact for flat-coloured UI geometry, an approximation for a gradient mesh, where the GPU interpolates and SVG cannot.QCSXTZZZIBWU
AddLine
(no comment in the source: the name reads as a sentence) add lineQCSXTZZZIBWU
AddPolyline
paPoints is flat: [ x1,y1, x2,y2, ... ]QCSXTZZZIBWU
AddPolygon
(no comment in the source: the name reads as a sentence) add polygonQCSXTZZZIBWU
AddText
(pnX, pnY) is the BASELINE origin -- where the text sits, not its box.QCSXTZZZIBWU
AddVerticalText
A Latin word inside a column stands upright here, one letter under the next, where a reader would expect it lying on its side. That is named as a limit in SOFTANZA_GRAPHICS_PLAN.md rather than implied.QCSXTZZZIBWU
AddJustifiedText
The engine elongates first and shares whatever is left over the spaces, so the line lands on the width exactly. A width no greater than the text's own leaves the text alone: this stretches, and it never compresses.QCSXTZZZIBWU
Fill
Either way it NAMES the fill, and that flag is what lets a stroke-only shape exist: see _Flush. A shape whose fill was never named and which WAS given a stroke is an outline, not a white blob.QCSXTZZZIBWU
Color
Text reads better as Color(); same act.QCSXTZZZIBWU
Stroke
An outline in its own colour and width. On a filled shape it is drawn ON TOP of the fill, so the two agree on the silhouette.QCSXTZZZIBWU
SetPickTag
A tag rather than a shape index, because a node is several commands -- a fill, a stroke, a label -- and every one of them is the same node to a reader pointing at it. Zero is "no identity", which is what backgrounds and decorations keep.no extension
SetSvgIdent
REFUSES a name that is not an XML name rather than escaping it. A name that arrives as `a b"c` and leaves as `a b"c` is one the consumer cannot write down or select on -- the mangling would be discovered by them and the refusal is discovered here.no extension
ClearSvgIdent
Back to no identity -- the next shapes belong to no element.no extension
Pick
The tag of the TOPMOST tagged shape under a point, or 0 for bare paper. Read straight from the retained display list: the data is already engine-side, so a click costs one crossing and no copy.QCSXTZZZIBWU
composed example
o1 = new stzCanvas(1240, 1000) ? o1.Pick(2, 5) #--> 0composed from the signature, run for this page
SetRegion
Panning a viewer over a huge diagram is the same call with a different origin, which is why this is one feature and not two.no extension
ClearRegion
Back to the whole picture.no extension
ToSVG
Vector. Needs NO device -- always available, everywhere.also written: Contentno extension
ToPNG
Four is the knee and the rest is a bad trade: five through seven buy 1.3% for another 2.4 ms, and nine spends 5.1x the time of one to beat four by 4%. So four is the default and the dial is exposed, because a caller writing one file for a page and a caller writing nine hundred for a test suite are not answering the same question.QCSXTZZZIBWU
ToPNGHiRes
4x MSAA antialiases a shape's edges and still beads a thin near-axis line light and dark along its length: its four samples are fixed, so a half-pixel diagonal catches them unevenly. Rendering at 2x gives sixteen effective samples where the line is and the bead fills in. It is not the default -- a test that compares rendered bytes wants the plain render, and a nine-hundred-file suite does not want to pay 4x the fill -- so a FIGURE meant to be shown asks for it and a check does not. Two is the knee; three and four are for print.QCSXTZZZIBWU
ToPixels
Raw RGBA8 bytes of the GPU tier, for a caller that wants the pixels themselves (comparisons, compositing, tests).no extension
ToPixelsHiRes
...and the supersampled pixels, box-averaged down: what ToPNGHiRes writes, for a caller that wants the bytes rather than a file.no extension
CanDrawPixels
(no comment in the source: the name reads as a sentence) can draw pixelsno extension
Flush
AND A CALLER CLOSING A GROUP OF SHAPES, which is the second reason and was found the hard way. SetFont, Fill and Stroke are deliberately RETROACTIVE on a pending shape -- that is what makes AddTextQ(..).Fill(..) work -- so the LAST shape of a group stays open until something else is added. A label engine drew ninety-six names and then wrote a caption at another size, and the caption resized the ninety-sixth name. Flush() is how a group is closed on purpose.QCSXTZZZIBWU
Resize
Empty the display list, keeping the background and the GPU buffers. What an ANIMATED canvas calls at the top of each frame -- without it the list grows by a frame's worth of shapes forever. Change the canvas's extents. The engine scene and this face are resized by the SAME call, so Width()/Height() cannot drift from what is actually being drawn -- which they did, silently, the first time a window retargeted a canvas: the face kept answering its construction size while the scene had moved on.QCSXTZZZIBWU
composed example
o1 = new stzCanvas(1240, 1000) ? o1.Resize(2, 5) #--> 1composed from the signature, run for this page
Clear
(no comment in the source: the name reads as a sentence) clearQCSXTZZZIBWU
Show
Put the picture in front of a person. A real WINDOW when this machine has one (GR5) -- Escape or the X button closes it, and the picture never touches the disk. Otherwise the old path: write a PNG (or an SVG with no device) and ask the OS to open it, which is what a headless box or a machine without stz_window.dll still deserves. Returns the frame count when it opened a window, the file path when it fell back -- so a caller can always tell which happened.no extension
Free
(no comment in the source: the name reads as a sentence) freeno extension

