painters_2d library
2D canvas painters for design visualization.
Custom painters for rendering slats, grids, seeds, and hover states on the 2D design canvas.
Classes
- DeletePainter
- Custom painter for a 'delete' display
- DragPainter
- GridPainter
- Custom painter for the grid lines
- HandleHoverPainter
- Custom painter for the cargo hover display
- SeedPainter
- SlatHoverPainter
- Custom painter for the slat hover display
- SlatPainter
- Custom painter for the slats themselves
Constants
- kHandleTextMinScale → const double
Functions
-
calculateSlatAngle(
Offset p1, Offset p2) → double - Function to calculate the angle of a slat based on its two end points
-
calculateSlatExtend(
Offset p1, Offset p2, double gridSize) → Offset - Function to calculate the tiny extension outside of the grid on either side of a slat, based on the slat's angle and the grid size.
-
convertCoordinateSpacetoRealSpace(
Offset inputPosition, String gridMode, double gridSize, double x60Jump, double y60Jump) → Offset -
convertRealSpacetoCoordinateSpace(
Offset inputPosition, String gridMode, double gridSize, double x60Jump, double y60Jump) → Offset -
drawSlat(
List< Offset> coords, Canvas canvas, DesignState appState, ActionState actionState, Paint slatPaint, bool phantomSlat) → void - Paints a slat and takes care of adjustments such as drawing aids, tip extensions, etc.
-
drawSlatDrawingAids(
Canvas canvas, List coords, Offset slatExtendFront, Offset slatExtendBack, double gridSize, Paint rodPaint, Color color, double slatAlpha) → void -
exportSlatsToSvg(
{required List< Slat> slats, required Map<String, Map< layerMap, required DesignState appState, required ActionState actionState, required Map<String, dynamic> >String, dynamic> exportOptions}) → Future<void> - Exports slats and optional visual elements to an SVG file.
-
isColorDark(
Color color) → bool -
multiplyOffsets(
Offset a, Offset b) → Offset -
paintSeedFromArray(
Canvas canvas, Map< int, Offset> coordinates, double gridSize, int rotationAngle, int transverseAngle, {Color color = Colors.red, double alpha = 1.0, bool crosshatch = false, bool printHandles = false, int cols = 16, int rows = 5}) → void -
showSvgExportDialog(
BuildContext context, ActionState actionState, {bool hasGroupConfig = false}) → Future< Map< String, dynamic> ?> - Shows a dialog for selecting SVG export options. Returns null if cancelled, otherwise returns a map of export options.