Overview
Pix is a language for drawing pixel art. You define a grid, write
expressions over x and y coordinates or use
built-in shape shortcuts, and export the result as a PNG image.
grid 17 by 17
color {
warm: #e84a00
}
circle (5, 5) radius 4 with color warm
circle (11, 5) radius 4 with color warm
triangle (1, 7) to (15, 7) to (8, 15) with color warm
export "heart" in png scale 8
How it works
The pipeline reads a .pix source file, tokenizes it, parses it
into an abstract syntax tree, evaluates expressions for every pixel position
on the grid, renders matching pixels, and exports the result as a scaled PNG.
- A
gridstatement sets the canvas size. - An optional
colorblock defines named colors. draw,erase,clear, and shape statements compose the image.- One or more
exportstatements save the result.
Language at a glance
| Feature | Syntax |
|---|---|
| Canvas | grid <w> by <h> |
| Draw by expression | draw <condition> with <color> |
| Erase | erase <condition> |
| Clear | clear |
| Shapes | pixel, line, rectangle, triangle, circle |
| Named colors | color { name: #hex } |
| Export | export "name" in png scale <n> |
| Comments | // comment |