Constructor.
the canvas to draw to
ReadonlynamePlugin identifier, used for diagnostics.
Dispatches the given symbol to the matching g… method.
the call symbol
the evaluated argument list
the interpreter context (unused by this plugin)
the method's result
Pops the most recently saved drawing state off the context's state stack.
Pairs with gSave. Popping an empty stack is a no-op per the Canvas spec.
t on success
Pushes the current drawing state (styles, transform, clip) onto the
context's state stack. Pairs with gRestore to let Lisp callers manage
state explicitly. Replaces the legacy per-method context.save() calls, which
pushed state on every draw with no matching restore() and grew the stack
unbounded.
t on success
Returns true if this plugin handles the given symbol.
the call symbol
true if apply should be called
Shared implementation of gsave-jpeg / gsave-png. With no argument it
triggers a browser download; with a single string argument it writes the
encoded image to that file path on Node.js.
the evaluated argument list (empty, or one path string)
the image MIME type to encode
the format name used in diagnostics ("jpeg" / "png")
t on success
Parses a color spec from the head of the argument Cons. Accepts
(1 string), (3 numbers — rgb), or (4 numbers — rgba); falls back to
'black' on anything else (legacy behavior — a best-effort color parse
that prints a diagnostic instead of signaling an error).
the argument Cons to parse
CSS color string
StaticfunctionLists every Lisp function name this plugin registers.
the sorted g… function names
Classdesc
Canvas2D drawing plugin for the kei-lisp interpreter. Implements the
KeiLispPlugincontract (name/has/apply) and exposes 75g…Lisp functions that proxy to a 2D rendering context. Failures (wrong arity, type mismatch, closed canvas, canvas-level errors) signal anEvalErrorthat Lisp callers can intercept with(handler-case … (eval-error (e) …)). Two exceptions still go toprocess.stderras diagnostics: asynchronous work (image loading, OffscreenCanvas file writes), which fails after the call has returned, andselectColor's best-effort color parsing, which falls back to black instead of failing.Author
Keisuke Ikeda