circle-outline-colored

xod/graphics/circle-outline-colored

Represents a circle with a custom style.
circle-outline-colored
@/circle-outline-colored
Represents a circle with a custom style.
Cxod/color/color
Circle color.
GFX@/graphics
Xnumber
X coordinate of the center point of the circle on the canvas.
Ynumber
Y coordinate of the center point of the circle on the canvas.
Rnumber
Radius of the circle.
circle-outline-colored
C
GFX
X
Y
R
GFX'
GFX'@/graphics

C++ implementation

#include <Circle.h>

node {
    uint8_t mem[sizeof(CircleOutline)];
    CircleOutline* circleOutlineColored;
    int16_t x, y, r;
    XColor strokeColor;

    void evaluate(Context ctx) {
        auto gfx = getValue<input_GFX>(ctx);
        strokeColor = getValue<input_C>(ctx);

        int16_t x = (int16_t)getValue<input_X>(ctx);
        int16_t y = (int16_t)getValue<input_Y>(ctx);
        int16_t r = (int16_t)getValue<input_R>(ctx);

        if (isSettingUp()) {
            circleOutlineColored = new (mem) CircleOutline(gfx);
        }

        if (isSettingUp() || x != x || y != y || r != r || isInputDirty<input_C>(ctx)) {
            x = x;
            y = y;
            r = r;
            circleOutlineColored->setPosition(x, y, r);
            circleOutlineColored->setStyle(&strokeColor);
            emitValue<output_GFXU0027>(ctx, circleOutlineColored);
        }

        if (isInputDirty<input_GFX>(ctx)) {
            emitValue<output_GFXU0027>(ctx, circleOutlineColored);
        }
    }

}