draw-rectangle

wayland/arduino-tvout/draw-rectangle

Draw a rectangle at X, Y with a specified width and height.
draw-rectangle
@/draw-rectangle
Draw a rectangle at X, Y with a specified width and height.
DEV@/tvout-device
A tvout device.
Xnumber
The x coordinate of upper left corner of the rectangle.
Ynumber
The y coordinate of upper left corner of the rectangle.
Wnumber
The width of the rectangle.
Hnumber
The height of the rectangle.
COLORnumber
The color of the rectangle. Options: 0 = black; 1 = white; 2 = invert.
FILLnumber
Rectangle will be filled with this color. Options: -1 = no fill; 0 = black; 1 = white; 2 = invert.
UPDpulse
Update. Triggers draw circle.
draw-rectangle
DEV
X
Y
W
H
COLOR
FILL
UPD
DONE
DONEpulse
Pulse on completion.
To use the node in your project you should have the wayland/arduino-tvout library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // The node responds only if there is an input pulse
    if (!isInputDirty<input_UPD>(ctx))
        return;

    // Get a pointer to the `TVout` class instance
    auto tv = getValue<input_DEV>(ctx);
    uint8_t x = getValue<input_X>(ctx);
    uint8_t y = getValue<input_Y>(ctx);
    uint8_t w = getValue<input_W>(ctx);
    uint8_t h = getValue<input_H>(ctx);
    char color = getValue<input_COLOR>(ctx);
    char fill = getValue<input_FILL>(ctx);

    tv->draw_rect(x, y, w, h, color, fill);

    emitValue<output_DONE>(ctx, 1);
}