<< lib/user-interface/SLCanvasView.sleela SLeeLa Standard Library Definition. Definition: Defines SLCanvasView — a SleelaUI general animated drawing surface. It owns a double-buffered draw context sized to its bounds and, on every frame, invokes a developer draw routine that paints into that context with the comprehensive SleelaUI Draw API (see SLDrawContext), then presents and blits the result into the window. It is the host for custom visualisations and the substrate the SLThrobber is built on. The constructor bottoms out in the `uiCanvasView` built-in (SleelaUI C ABI slui_canvas_view()). The native toolkit drives the draw routine through a C function pointer each frame. From SLeeLa a draw routine is registered with the VM as a `ui*` draw handler keyed to this view's handle; the VM calls back into SLeeLa with an SLDrawContext bound to the view's per-frame surface, the animation time, and the per-frame delta. Set the refresh rate with setFps. An SLCanvasView IS an SLWidget and is an animated widget. Family: user-interface. Native VM/UI work crosses the explicit `ui*` SLVM bridge. >> #sleela 2.5 material; class SLCanvasView extends SLWidget { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 10352; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-07"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } < Create a canvas view inside `parent` with an initial pixel size. > void createIn(SLWidget parent, int width, int height) { widget = uiCanvasView(parent.handle(), width, height); } void createInHandle(int parentHandle, int width, int height) { widget = uiCanvasView(parentHandle, width, height); } < The target refresh rate (frames per second) the window loop honours while > < this view is visible (0 = the window's default). > void setFps(double fps) { if (widget >= 0) { uiCanvasViewSetFps(widget, fps); } } < Register the draw routine for this view. `handlerId` is a VM draw-handler > < ordinal the host has bound to a SLeeLa method; the VM invokes it each frame > < with an SLDrawContext, the animation time, and the per-frame delta. > void setDrawHandler(int handlerId) { if (widget >= 0) { uiCanvasViewSetDraw(widget, handlerId); } } }