filltriangle

ivanmason/ra8876/filltriangle

Fill a triangle
filltriangle
@/filltriangle
Fill a triangle
DEV@/ra8876-device
X0number
Point X0
Y0number
Point Y0
X1number
Point X1
Y1number
Point Y1
X2number
Point X2
Y2number
Point Y2
COLnumber
Colour in rgb565 format
UPDpulse
filltriangle
DEV
X0
Y0
X1
Y1
X2
Y2
COL
UPD
DONE
DONEpulse
To use the node in your project you should have the ivanmason/ra8876 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) {
    if (!isInputDirty<input_UPD>(ctx))
        return;

    auto tft = getValue<input_DEV>(ctx);
    int x0 = getValue<input_X0>(ctx);
    int y0 = getValue<input_Y0>(ctx);
    int x1 = getValue<input_X2>(ctx);
    int y1 = getValue<input_Y1>(ctx);
    int x2 = getValue<input_X2>(ctx);
    int y2 = getValue<input_Y2>(ctx);
    uint16_t colour = getValue<input_COL>(ctx);

    tft->fillTriangle(x0,y0,x1,y1,x2,y2,colour);

    emitValue<output_DONE>(ctx, 1);
}