UiCanvas class

Canvas abstraction for cross-platform rendering operations.

This class provides a unified interface for drawing operations on Flutter's canvas system, supporting both direct canvas rendering and picture recording for cached tile generation. It includes performance tracking and optimized drawing methods for map rendering.

Key features:

  • Direct canvas and picture recorder support
  • Performance metrics tracking (actions, bitmaps, text, paths)
  • Optimized drawing methods for map elements
  • Matrix transformations and clipping support

Constructors

UiCanvas(Canvas _uiCanvas, Size _size)
Creates a canvas wrapper for an existing Flutter canvas.
UiCanvas.forRecorder(double width, double height)
Creates a canvas with picture recording for cached tile generation.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes of canvas resources and finalizes picture recording.
drawCircle(double x, double y, double radius, UiPaint paint) → void
drawIcon({required TextPainter textPainter, required double left, required double top, UiMatrix? matrix}) → void
Draws a Flutter icon using a TextPainter at the specified position.
drawLine(double x1, double y1, double x2, double y2, UiPaint paint) → void
drawPath(UiPath path, UiPaint paint) → void
drawPathText(String text, LineSegmentPath lineString, Mappoint reference, UiPaint paint, UiTextPaint textPaint, double maxTextWidth) → void
drawPicture({required SymbolImage symbolImage, required double left, required double top, required UiPaint paint, UiMatrix? matrix}) → void
drawRect(UiRect rect, UiPaint paint) → void
drawText(String text, double x, double y, UiPaint paint, UiTextPaint textPaint, double maxTextWidth) → void
draws the given text so that the center of the text in at the given x/y coordinates
drawTextRotated(Paragraph paragraph, double theta, MappointRelative reference) → void
drawTilePicture({required TilePicture picture, required double left, required double top}) → void
draws the given picture at the specified position. Note that the picture is NOT disposed in this method.
expose() Canvas
fillColorFromNumber(int color) → void
finalizeBitmap() Future<TilePicture>
Stops the recording and returns a TilePicture object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(Offset focalPoint, double scale) → void
setClip(double left, double top, double width, double height) → void
toString() String
A string representation of this object.
override
translate(double dx, double dy) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited