tft-lcd-draw-triangle

bradzilla84/color-tft-lcd-driver-mcufriend-kbv/tft-lcd-draw-triangle

Draw a Triangle from 3 Points
tft-lcd-draw-triangle
@/tft-lcd-draw-triangle
Draw a Triangle from 3 Points
IN@/tft-lcd-device
Pos1Xnumber
Point1 X
Pos1Ynumber
Point1 Y
Pos2Xnumber
Point2 X
Pos2Ynumber
Point2 Y
Pos3Xnumber
Point3 X
Pos3Ynumber
Point3 Y
FILLboolean
Do you want to fill the Triangle?
Colorbradzilla84/color-rgb-hsl/rgb-color-pack
Color to Fill/Outline with
INITpulse
Pulse to update
tft-lcd-draw-triangle
IN
OUT
Pos1X
Pos1Y
Pos2X
Pos2Y
Pos3X
Pos3Y
FILL
Color
INIT
OK
OKpulse
Pulse on Complete
OUT@/tft-lcd-device
To use the node in your project you should have the bradzilla84/color-tft-lcd-driver-mcufriend-kbv 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_INIT>(ctx)){
        emitValue<output_OUT>(ctx, getValue<input_IN>(ctx));
        return;}

    auto tft = getValue<input_IN>(ctx);
    auto color = getValue<input_Color>(ctx);


    if (getValue<input_FILL>(ctx)){
        tft->fillTriangle(getValue<input_Pos1X>(ctx),getValue<input_Pos1Y>(ctx),getValue<input_Pos2X>(ctx),getValue<input_Pos2Y>(ctx),getValue<input_Pos3X>(ctx),getValue<input_Pos3Y>(ctx),color.Hex);
    }
    else
    {
        tft->drawTriangle(getValue<input_Pos1X>(ctx),getValue<input_Pos1Y>(ctx),getValue<input_Pos2X>(ctx),getValue<input_Pos2Y>(ctx),getValue<input_Pos3X>(ctx),getValue<input_Pos3Y>(ctx),color.Hex);
    }

    emitValue<output_OUT>(ctx, getValue<input_IN>(ctx));
    emitValue<output_OK>(ctx, 1);
}