fillRect method
Fill a rectangle (x
,y
, width
x height
).
Implementation
@override
void fillRect(num x, num y, num width, num height, PStyle style) {
x = transform.x(x);
y = transform.y(y);
var clip = _clip;
if (clip != null) {
var box = PRectangle(x, y, width, height);
var r = clip.intersection(box);
if (r.isZeroDimension) return;
x = r.x;
y = r.y;
width = r.width;
height = r.height;
}
if (width <= 0 || height <= 0) return;
var x2 = (x + width).toInt() - 1;
var y2 = (y + height).toInt() - 1;
var color = style.color ?? PColor.colorGrey;
img.fillRect(_bitmap,
x1: x.toInt(), y1: y.toInt(), x2: x2, y2: y2, color: color.imageColor);
}