# Canvas Server

A minimal, scriptable GTK3 drawing canvas written in Vala. It reads drawing instructions asynchronously from standard input (`STDIN`) and renders them using Cairo.

## Project Structure

* `canvas_server.vala` - The core application source code.
* `Makefile` - Build configuration.
* `demo.sh` - An example shell script demonstrating canvas commands.

## Requirements

* `valac` (Vala compiler)
* `libgtk-3-dev` (GTK+ 3 development headers)
* `glib-2.0`

## Build & Install

To compile the application:

```bash
make
```

To build with debug symbols:

```bash
make debug
```

To clean up binary files:

```bash
make clean
```

Optionally install system-wide:

```bash
sudo make install
```

## Usage

Pipe commands directly into the executable using a shell script, `echo`, or a FIFO pipe:

```bash
chmod +x demo.sh
./demo.sh | ./canvas_server
```

## Command Protocol

Each command must be sent on a new line:

| Command | Arguments | Description |
| :--- | :--- | :--- |
| `clear` | *(none)* | Clears the entire canvas |
| `color` | `#HEX` or name | Sets active RGBA stroke/fill color (e.g., `#ff0000`, `blue`) |
| `line` | `x1 y1 x2 y2` | Draws a line between two coordinates |
| `rect` | `x y width height` | Draws a rectangle outline |
| `plot` | `x y diameter` | Draws a filled circle centered at `(x, y)` |

Lines starting with `#` or empty lines are ignored.