draw-circle

wayland/vidor-graphics/draw-circle

Draw a circle.
draw-circle
@/draw-circle
Draw a circle.
GFX@/gfx-device
A Vidor graphics device.
Xnumber
Centre-point x coordinate.
Ynumber
Centre-point y coordinate.
Rnumber
Radius of circle (pixels).
Colorxod/color/color
Color of circle.
Alphanumber
Alpha compositing. Takes a value from 0 to 255.
Fillboolean
TRUE to fill circle with colour, FALSE to draw outline only.
UPDpulse
Update
draw-circle
GFX
X
Y
R
Color
Alpha
Fill
UPD
Done
Donepulse
Pulse on completion.
To use the node in your project you should have the wayland/vidor-graphics 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

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_UPD

node {
    void evaluate(Context ctx) {

        if (!isInputDirty<input_UPD>(ctx))
            return;

        auto gfx = getValue<input_GFX>(ctx);
        auto color = getValue<input_Color>(ctx);
        uint32_t color32 = gfx->Color(color.r, color.g, color.b);
        if (getValue<input_Fill>(ctx)){
            gfx->fillCircle(
            getValue<input_X>(ctx),
            getValue<input_Y>(ctx),
            getValue<input_R>(ctx),
            color32,
            getValue<input_Alpha>(ctx));
        } else {
            gfx->drawCircle(
            getValue<input_X>(ctx),
            getValue<input_Y>(ctx),
            getValue<input_R>(ctx),
            color32,
            getValue<input_Alpha>(ctx)
            );
        }
        emitValue<output_Done>(ctx, 1);
    }
}