drawRect method
Draw a rect
on this image with color
, use the mode
Implementation
@override
void drawRect(Rect rect, Color color, [BlendMode mode = BlendMode.srcOver]) {
BlendModeAction blend = BlendModeAction(mode);
int maxX = min(_width, rect.right.round());
int minY = max(0, rect.top.round());
int maxY = min(_height, rect.bottom.round());
for (int x = max(0, rect.left.round()); x < maxX; x++) {
for (int y = minY; y < maxY; y++) {
Color oColor = getColor(x, y);
setColor(x, y, blend.blend(color, oColor));
}
}
}