What DanaProcessing is

DanaProcessing ports the shape and feel of the Processing language to C#. Instead of Java's color() function and bit-packed ints, colors are a real Color struct. Instead of a fixed window, a Sketch can be hosted inside Avalonia or the bundled IDE. Everything else — the mental model of Setup() once and Draw() every frame, fill/stroke state, beginShape()/endShape(), noise() — is carried over on purpose.

On this page · 1 entry

The same Sketch has a second renderer built in: pass RendererKind.Renderer3D to Size() and the exact same Setup()/Draw() model gets you real OpenGL geometry — Box()/Sphere(), lights, cameras, materials, custom shaders — no separate engine, no second API to learn (see Getting started in 3D). All of it runs inside a desktop IDE built specifically for this workflow: diagnostics underline mistakes as you type, a // nuget: comment resolves a package before you hit Run, and Run itself compiles in memory and swaps the canvas in well under a second (see The IDE).

Where things live. Drawing state and operations are defined once on GraphicsContext, inherited by both Sketch and PGraphics. Sketch adds lifecycle, input, time, and randomness — things an offscreen buffer doesn't need.

Minimal sketch

The smallest complete sketch: Setup() sets the canvas size once, Draw() runs every frame and paints a circle that follows the mouse.

C#
public class MySketch : Sketch
{
    public override void Setup()
    {
        Size(600, 400);
    }

    public override void Draw()
    {
        Background(20, 20, 30);
        NoStroke();
        Fill(100, 200, 255);
        Ellipse(MouseX, MouseY, 60, 60);
    }
}

Save this in the IDE and press Run — SketchCompiler compiles it in memory with Roslyn and swaps it straight into the canvas.