paint method
Draws the stamp on the local system described in the class documentation.
Implementation
@override
void paint(PdfGraphics canvas, PdfPoint size) {
final resolved = resolveFont(canvas.document);
if (background != null) {
canvas.setFillColor(background);
canvas.drawRect(0, 0, size.x, size.y);
canvas.fillPath();
}
if (borderColor != null && borderWidth > 0) {
canvas.setStrokeColor(borderColor);
canvas.setLineWidth(borderWidth);
canvas.drawRect(0, 0, size.x, size.y);
canvas.strokePath();
}
canvas.setFillColor(color);
// The baseline sits above the bottom edge by the depth of the font
// descenders, otherwise letters such as "g" would come out clipped.
canvas.drawString(
resolved,
fontSize,
text,
padding,
padding + (-resolved.descent) * fontSize,
);
}