Element
Base sealed class for all drawable elements on the canvas.
The Element type system allows the renderer to handle different drawing primitives uniformly. Use pattern matching or when expressions to handle different element types.
See also
Inheritors
Types
Bitmap element placed on the canvas. bytes is the raw encoded payload (PNG / JPEG / WebP) and the source of truth — the renderer decodes it into an androidx.compose.ui.graphics.ImageBitmap on demand and caches the result keyed by id. Resize / rotate / move / select reuse the standard two-point AABB infrastructure.
One sample along a freehand pen stroke.
Block-level plain-text element. Single style applies to the whole block; rich-text features (inline bold / italic spans, links, cursor-within-text editing) are intentionally NOT in scope here and are tracked separately.
Functions
Scale points so the bounding box matches newBounds. For two-point shapes this snaps start/end to the new bbox corners (preserving orientation of the original drag direction). For freedraw paths every point is scaled linearly. Rotation unchanged.
Absolute rotation in degrees.