v2026.11.2
All Bundles
Bundle

The SDL2 backend of System.Plot: it draws the same PlotScene the SVG writer does, to a window you can zoom, pan and hover, or to a PNG file. Compile with -lib plot_sdl,plot,sdl2,gen_collect. Saving a PNG needs no window and no display; a window needs one. Not available in the web playground. Design: docs/PLOT_DESIGN.md.

SdlCanvas

Draws a PlotScene with an SDL2 Renderer: lines (anti-aliased, or thick, or dashed), polylines, polygons, rectangles with opacity, circles, and text. Text uses SDL_ttf when a font file is found (the shipped lib/sdl/fonts/lato.ttf, or the one given to SetFont) and falls back to SDL2_gfx's built-in 8x8 bitmap font, which cannot rotate or bold.

Operations

Draw #

Clears the target to white and draws a scene on it. Call Present (or save) afterwards.

method : public : Draw(scene:PlotScene) ~ Nil

Parameters

NameTypeDescription
scenePlotScenewhat to draw

GetFont #

The font file text will use.

method : public : GetFont() ~ String

Return

TypeDescription
Stringthe path, or an empty string for the bitmap fallback

New # constructor

Constructor

New(renderer:Renderer, width:Int, height:Int)

Parameters

NameTypeDescription
rendererRendererthe renderer to draw on
widthIntwidth of the render target in pixels
heightIntheight of the render target in pixels

Overlay #

Draws a scene over what is already there, without clearing, for readouts and labels.

method : public : Overlay(scene:PlotScene) ~ Nil

Parameters

NameTypeDescription
scenePlotScenewhat to draw

Release #

Frees the cached fonts. Call it when finished drawing, before Font->Quit.

method : public : Release() ~ Nil

SetFont #

Uses a font file for text instead of the shipped one.

method : public : SetFont(path:String) ~ Nil

Parameters

NameTypeDescription
pathStringa TrueType font file, or empty for the bitmap fallback

Start # function

Starts what drawing needs: SDL_ttf and PNG support. Safe to call more than once.

function : Start() ~ Bool

Return

TypeDescription
Booltrue when SDL_ttf started (text then uses a real font); false means drawing still works with the bitmap font