Getting Started
Installation
Download the latest binary from the
releases page
and place it in a directory in your PATH.
tar xzf pix-v*.tar.gz
sudo mv pix /usr/local/bin/ Building from source
Alternatively, build from source with Cargo:
git clone https://github.com/halleyfante/pix.git
cd pix/compiler
cargo build --release
The compiled binary will be at compiler/target/release/pix.
Your first program
Create a file called hello.pix:
grid 17 by 17
circle (8, 8) radius 7 with #e84a00
export "hello" in png scale 8
Run it:
pix hello.pix
This produces hello.png in the current directory.
Program structure
Every Pix program follows this structure:
- A
gridstatement to set the canvas size (required, exactly one). - An optional
colorblock to define named colors. - Any number of
draw,erase,clear, and shape statements. - One or more
exportstatements to save the result.
Statements are processed in order. Later draw operations overwrite earlier
ones, and erase removes previously drawn pixels.
Comments
Use // to add comments. Everything after // until
the end of the line is ignored.
// This is a comment
grid 17 by 17 // inline comment