basic library
Basic public API exports for iwb_canvas_engine.
This is the primary v2 entrypoint and recommended default import.
Classes
- ActionCommitted
- A committed action with stable actionId and affected nodeIds.
- Background
- Background visual settings: solid color and optional grid.
- BackgroundSnapshot
- Immutable background snapshot.
- Camera
- Viewport state for converting between view and scene coordinates.
- CameraSnapshot
- Immutable camera state snapshot.
- CommonNodePatch
- Patch for common node fields shared by all node variants.
- EditTextRequested
- Request from the engine to edit a TextNode at position.
- GridSettings
- Grid rendering configuration.
- GridSnapshot
- Immutable grid settings snapshot.
- ImageNode
- Raster image node referenced by imageId and drawn at size.
- ImageNodePatch
- ImageNodeSnapshot
- ImageNodeSpec
- Layer
- A z-ordered collection of nodes.
- LayerSnapshot
- Immutable layer snapshot.
- LineNode
- Straight segment node defined by start and end points.
- LineNodePatch
- LineNodeSnapshot
- LineNodeSpec
- NodePatch
- Partial node update request for v2 write APIs.
- NodeSnapshot
- Immutable base node snapshot.
- NodeSpec
- Immutable node creation spec for v2 write APIs.
-
PatchField<
T> - PathNode
- SVG-path based vector node.
- PathNodePatch
- PathNodeSnapshot
- PathNodeSpec
- PointerInputSettings
-
Thresholds and timings used by
PointerInputTracker. - RectNode
- Box node with optional fill and stroke.
- RectNodePatch
- RectNodeSnapshot
- RectNodeSpec
- Scene
- A mutable scene graph used by the canvas engine.
- SceneControllerInteractiveV2
- SceneDefaults
- Default values used by the engine for palettes and tool settings.
- SceneNode
- Base class for all nodes stored in a Scene.
- ScenePalette
- Palette presets for tool colors and background/grid options.
- ScenePaletteSnapshot
- Immutable palette snapshot.
- ScenePathMetricsCacheV2
- SceneSnapshot
- Immutable scene snapshot exposed by the v2 public API.
- SceneStaticLayerCacheV2
- SceneStrokePathCacheV2
- SceneTextLayoutCacheV2
- SceneViewInteractiveV2
- StrokeNode
- Freehand polyline stroke node.
- StrokeNodePatch
- StrokeNodeSnapshot
- StrokeNodeSpec
- TextNode
- Text node with a fixed layout box (size) and basic styling.
- TextNodePatch
- TextNodeSnapshot
- TextNodeSpec
- Transform2D
- A 2D affine transform represented as a 2×3 matrix.
Enums
- ActionType
- Discrete actions emitted by interactive controllers for app-level undo/redo.
- CanvasMode
- Public input types for canvas interaction controllers.
- DrawTool
- Active drawing tool when CanvasMode.draw is enabled.
- NodeType
- Supported node variants in a Scene.
- PatchFieldState
- Tri-state wrapper for patch fields in the v2 public API.
- PathFillRule
- Fill rule for PathNode geometry.
- V2PathFillRule
- Path fill rule value in the v2 public model.
Extensions
Constants
-
schemaVersionsRead
→ const Set<
int> - JSON schema versions accepted by this package.
- schemaVersionWrite → const int
- JSON schema version written by this package.
Functions
-
aabbForTransformedRect(
{required Rect localRect, required Offset position, required double rotationDeg, required double scaleX, required double scaleY}) → Rect - Computes an axis-aligned bounding box for a transformed rectangle.
-
aabbFromPoints(
Iterable< Offset> points) → Rect -
Returns the axis-aligned bounding box for
points. -
decodeScene(
Map< String, dynamic> json) → SceneSnapshot - Decodes a SceneSnapshot from a JSON map (already parsed).
-
decodeSceneFromJson(
String json) → SceneSnapshot - Decodes a SceneSnapshot from a JSON string.
-
distancePointToSegment(
Offset point, Offset a, Offset b) → double -
Returns the shortest distance from
pointto the segmenta-b. -
distanceSegmentToSegment(
Offset a1, Offset a2, Offset b1, Offset b2) → double - Returns the shortest distance between two line segments.
-
distanceSquaredPointToSegment(
Offset point, Offset a, Offset b) → double -
Returns squared shortest distance from
pointto segmenta-b. -
distanceSquaredSegmentToSegment(
Offset a1, Offset a2, Offset b1, Offset b2) → double -
Returns squared shortest distance between line segments
a1-a2andb1-b2. -
encodeScene(
SceneSnapshot snapshot) → Map< String, dynamic> -
Encodes
snapshotinto a JSON-serializable map. -
encodeSceneToJson(
SceneSnapshot snapshot) → String -
Encodes
snapshotto a JSON string. -
reflectPointHorizontal(
Offset point, double axisY) → Offset -
Mirrors
pointacross the horizontal axis that passes throughaxisY. -
reflectPointVertical(
Offset point, double axisX) → Offset -
Mirrors
pointacross the vertical axis that passes throughaxisX. -
rotatePoint(
Offset point, Offset center, double degrees) → Offset -
Rotates
pointaroundcenterbydegrees. -
segmentsIntersect(
Offset a1, Offset a2, Offset b1, Offset b2) → bool -
Returns true if segments
a1-a2andb1-b2intersect. -
toScene(
Offset viewPoint, Offset cameraOffset) → Offset - Converts a point from view/screen coordinates to scene coordinates.
-
toView(
Offset scenePoint, Offset cameraOffset) → Offset - Converts a point from scene coordinates to view/screen coordinates.
Typedefs
- ImageResolverV2 = Image? Function(String imageId)
- NodeId = String
- Stable node identifier used for selection and action events.
- SceneController = SceneControllerInteractiveV2
- SceneView = SceneViewInteractiveV2
Exceptions / Errors
- SceneJsonFormatException
- Thrown when scene JSON fails schema validation.