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
Orange circle
A filled circle centered on a 17x17 grid, scaled 8x

Run it:

pix hello.pix

This produces hello.png in the current directory.

Program structure

Every Pix program follows this structure:

  1. A grid statement to set the canvas size (required, exactly one).
  2. An optional color block to define named colors.
  3. Any number of draw, erase, clear, and shape statements.
  4. One or more export statements 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