healthrian_render_canvas 0.0.1
healthrian_render_canvas: ^0.0.1 copied to clipboard
A library to render JSON descriptions onto a Canvas.
healthrian_render_canvas #
A library to render JSON descriptions onto a Canvas.
This package provides the HealthrianRenderCanvas class, which takes a JSON map describing drawing elements (rectangles, text, lines, etc.) and renders them into a PNG image (Uint8List).
Features #
- Parse JSON drawing instructions.
- Support for:
- Rectangles
- Text (with custom fonts and weights)
- Lines and Polylines
- Circles
- ECG grids/waveforms
- Images (Base64 encoded)
- Output to
Uint8List(PNG format).
Usage #
import 'package:healthrian_render_canvas/healthrian_render_canvas.dart';
final canvas = HealthrianRenderCanvas(width: 2480, height: 3508); // A4 300dpi example
final jsonData = {
'document': {
'layers': [
{
'elements': [
{
'type': 'rectangle',
'x': 10,
'y': 10,
'width': 100,
'height': 50,
'fill': '#FF0000'
}
]
}
]
}
};
final pngBytes = await canvas.render(jsonData);