paint method
Implementation
@override
void paint(PCanvas pCanvas, [GraphicContext? graphicContext]) {
graphicContext = resolveGraphicContext(graphicContext);
var position = graphicContext.position;
var x = position.x;
var y = position.y;
var scaleX = graphicContext.scaleX;
var scaleY = graphicContext.scaleY;
var pathPoints2 = pathPoints.toList(growable: false);
final length = pathPoints2.length;
for (var i = 0; i < length; ++i) {
var e = pathPoints2[i];
if (e is num) {
var x1 = e;
pathPoints2[i] = x + (x1 * scaleX);
var y1 = pathPoints2[++i] as num;
pathPoints2[i] = y + (y1 * scaleY);
} else if (e is Point) {
pathPoints2[i] = e.scale(scaleX, scaleY).incrementXY(x, y);
} else if (e is List<num>) {
var cubic = e.toList(growable: false);
assert(cubic.length == 6);
cubic[0] *= scaleX;
cubic[1] *= scaleY;
cubic[2] *= scaleX;
cubic[3] *= scaleY;
cubic[4] *= scaleX;
cubic[5] *= scaleY;
cubic[0] += x;
cubic[1] += y;
cubic[2] += x;
cubic[3] += y;
cubic[4] += x;
cubic[5] += y;
pathPoints2[i] = cubic;
}
}
var backgroundColor = graphicContext.backgroundColor;
if (!backgroundColor.isFullyTransparent) {
pCanvas.fillPath(pathPoints2, PStyle(color: backgroundColor),
closePath: closePath);
}
var color = graphicContext.color;
if (!color.isFullyTransparent) {
pCanvas.strokePath(pathPoints2, PStyle(color: color),
closePath: closePath);
}
}