adapter library
Renderer integration surface for Flutter hosts and tools, not the consumer API.
The scene painter and its paint cache, fill, grid and outline geometry,
image and raster caches, the widget scene, text shaping and PNG output
internals that vyuh_diagram_flutter.dart deliberately hides. Engine
integration (command groups, transactions, publications) lives in
package:vyuh_diagram_core/adapter.dart.
Classes
- DiagramContentBandPainter
- Shares the scene renderer's geometry, resources and paint implementations. The owning viewport inserts live widgets between these content-only bands.
- DiagramEditingSemantics
- Platform accessibility adapter for the active canonical paragraph buffer. Values and edits use the same projection as the IME, never a second document.
- DiagramEffectPainter
- Dedicated effect layer. It repaints only active effects and reads geometry directly from the current resolved scene.
- DiagramFontLayoutLease
- One font observer across mounted views; one refresh per distinct controller. Leases keep view lifetime separate from controller ownership.
- DiagramFreehandPreview
- Lightweight ink owned by the active pointer gesture.
- DiagramFreehandPreviewPainter
- Paints only the active pen gesture so pointer samples do not repaint the resolved scene beneath it.
- DiagramGridSnapping
- Grid snapping as the canvas shows it, for gestures and headless controllers.
- DiagramImageCache
- Shared asynchronous image resolver for Canvas-painted image shapes.
- DiagramLodPolicy
- When elements drop detail as they shrink on screen.
- DiagramRasterAdmission
- Delays expensive raster admission until an immutable rendering signature settles. Vector painting continues throughout; no scene state is changed.
- DiagramRasterCache
- Disposable raster projections; callers retain canonical geometry and paint vectors while an exact revision is absent. Returned images are borrowed.
- DiagramRenderPolicy
- Runtime tuning for how the canvas retains painted content.
- DiagramScenePaintCache
- Retained paint commands keyed by immutable resolved-element identity. Camera changes and unrelated revisions replay these pictures instead of reshaping text and paths.
- DiagramScenePainter
- Paints a resolved scene: content, the canvas grid, and editing chrome such as selection and hover. contentOnly omits the grid and chrome for output.
- DiagramShapeThumbnailCache
- One DiagramShapeThumbnail per shape definition and content color adaptation, recorded once and kept for as long as the cache, independently of which gallery or tab shows it. The owner disposes the cache after the last CustomPaint using one of its thumbnails is unmounted.
- DiagramTransformCursor
- Screen-space cursor projection for diagram transform handles.
- DiagramWidgetScene
- Native content slots interleaved with the scene's ordinary paint bands. The viewport owns grid, global overlays and canonical canvas input.
- EffectPreviewPainter
- Static thumbnail of an effect, rendered by the same registered definition as the canvas: along a short route, or on a small box when shape is true. Effects that present their element show the box scaled or faded.
- FlutterDiagramTextLine
- A view of one visual line in a retained, already-shaped paragraph. All offsets are UTF-16 offsets relative to this line, never document offsets.
- RenderDiagramEditingSemantics
- Render object behind DiagramEditingSemantics. It describes its subtree as an editable text field and routes accessibility text and selection changes to the widget's callbacks while the field is focused.
- RenderingExtension
- Rendering tuning for a canvas: level of detail at low zoom and how painted content is retained. Without it installed a canvas uses the defaults. A canvas reads its RenderingOptions when it mounts.
- RenderingOptions
- Level of detail at low zoom and how painted content is retained, the options of RenderingExtension.
- WidgetTextProjection
- A UI projection retaining canonical offsets, never a replacement story. Selections cannot bridge a block owned by a mounted native widget.
Enums
- DiagramTransformCursorKind
- The kinds of transform handle that get a custom cursor.
- DiagramVisualDetail
- How much of a shape paints at its current on-screen size.
Extensions
- DiagramBandRendering on DiagramScenePainter
- Paints the content bands of a DiagramScenePainter, the slices of scene content that sit between native widget slots.
Functions
-
createDiagramParagraph(
List< TextRun> runs, TextRole role, DiagramColor foreground, ParagraphAlignment alignment, {required double fontSize, ParagraphDirection direction = ParagraphDirection.ltr, double defaultFontSize = diagramDefaultFontSize, int? maxLines, double? lineHeight}) → TextPainter -
diagramAncestorClipPaths(
ResolvedElement element, ResolvedScene scene) → Iterable< Path> - Visible world-space clipping outlines, shared by content and effect layers. Intersect them in order; each is cached per resolved ancestor.
-
diagramFillPaint(
DiagramFill fill, Rect bounds, {Float64List? shaderMatrix, ColorAdaptation adapt = ColorAdaptation.none}) → Paint -
Shared shape-local surface paint for full rendering and live previews.
adaptre-maps the authored colors, as a canvas theme does. -
diagramLineGeometry(
ResolvedTextLine line) → DiagramTextLineGeometry - Interaction consumes the same shaped artifact as the canonical scene. A renderer must never independently reflow an unshaped resolved line.
-
diagramMarkerGeometry(
ResolvedTextLine line) → DiagramTextLineGeometry -
diagramOutlinePath(
ResolvedOutline outline) → Path - The one outline-to-path conversion shared by canvas, minimap and exports. Coordinates stay in the outline's unrotated space.
-
diagramPngTiles(
int width, int height, int edge) → Iterable< Rect> - Integer pixel partition: resolution and the recorded paint never change.
-
diagramTextRunStyle(
TextRun run, TextRole role, DiagramColor foreground, {double defaultFontSize = diagramDefaultFontSize}) → TextStyle -
diagramVisibleGridSpacing(
{required DiagramGridPattern pattern, required DiagramRect bounds, required double gridSize, required double zoom}) → double - Shared density resolution for grid painting and direct manipulation.
-
diagramWorldOutlinePath(
ResolvedFramedElement element) → Path -
element's outline in world coordinates, including its rotation. -
dispatchDiagramKeyBinding(
DiagramController session, Iterable< DiagramKeyBinding> bindings, KeyEvent event, {String? elementId, String? slotId, bool editing = false}) → bool -
exportDiagramPng(
DiagramPublication publication, {required PngOptions options, ImageProvider< Object> imageProvider(DiagramImageSource)?, DiagramTheme theme = DiagramTheme.light}) → Future<PngSnapshot> -
Renders a captured publication without a mounted canvas or document edit.
Runtime overlays and path effects are not part of canonical document output.
Content paints in its authored colors unless
themeadapts them, as DiagramTheme.dark does. -
exportDiagramSvg(
DiagramPublication publication, {required SvgOptions options, ImageProvider< Object> imageProvider(DiagramImageSource)?}) → Future<SvgSnapshot> - Prepares images through the canvas image loader for the pure SVG codec. Native text preserves line placement; mounted widgets use declared fallbacks.
-
loadOutputResources<
T> (Iterable< T> resources, Future<Object?> load(T), {required int concurrency, required Duration timeout}) → Future<void> - Bounded resource admission with one deadline for the whole operation. Active loads are observed after failure, but no queued load starts afterward. The caller owns cancellation/disposal of active resources.
-
paintDiagramGrid(
Canvas canvas, {required DiagramGridPattern pattern, required DiagramRect bounds, required double gridSize, required double zoom, Color? minorColor, Color? majorColor}) → void - Projects a canonical grid pattern in world coordinates. Density reduction is shared with interaction snapping (DiagramGridSnapping) to avoid hidden subdivisions.
-
rasterizeDiagramPngTile(
Picture picture, Rect tile) → Future< Image> - Replays the immutable picture at an integer offset, without scene layout.
-
replacedWidgetTextBlocks(
ResolvedShape shape, Set< String> mountedWidgetSlotIds) → Set<String> - Shared paint/accessibility/input projection of text replaced by mounted slots. Canonical stories and portable output retain every block.