drawRectFilled method
Future<void>
drawRectFilled(
- int x,
- int y,
- int w,
- int h,
- int borderWidth,
- PaletteColors borderColor,
- PaletteColors fillColor,
Draws a filled rectangle with a border on the display.
Args: x (int): The left pixel position of the rectangle. y (int): The top pixel position of the rectangle. w (int): The width of the rectangle. h (int): The height of the rectangle. borderWidth (int): The width of the border. borderColor (PaletteColors): The color of the border. fillColor (PaletteColors): The fill color of the rectangle.
Implementation
Future<void> drawRectFilled(
int x,
int y,
int w,
int h,
int borderWidth,
PaletteColors borderColor,
PaletteColors fillColor,
) async {
String luaToSend = '';
w = (w ~/ 8) * 8;
if (borderWidth > 0) {
borderWidth = (borderWidth ~/ 8) * 8;
if (borderWidth == 0) {
borderWidth = 8;
}
} else {
await frame.runLua(_drawRectLua(x, y, w, h, fillColor), checked: true);
return;
}
luaToSend += _drawRectLua(x, y, w, h, borderColor);
luaToSend += _drawRectLua(
x + borderWidth,
y + borderWidth,
w - borderWidth * 2,
h - borderWidth * 2,
fillColor,
);
await frame.runLua(luaToSend, checked: true);
}