A lightweight pixel art editor built with C++17 and SDL2.
- CMake 3.16+
- C++17 compiler (GCC 7+, Clang 5+, MSVC 2017+)
- SDL2 2.0.5+
macOS
brew install sdl2Ubuntu/Debian
sudo apt update
sudo apt install libsdl2-devArch Linux
sudo pacman -S sdl2Windows
vcpkg install sdl2:x64-windowscd pixel-art-editor
mkdir build && cd build
cmake ..
make -j
./TinyCanvas
# Custom canvas size
./TinyCanvas 64 64| Key | Tool | Description |
|---|---|---|
P |
Pencil | Freehand pixel drawing |
E |
Eraser | Remove pixels with background color |
L |
Line | Draw straight lines between two points |
R |
Rectangle | Draw rectangular outlines |
C |
Circle | Draw circular outlines from center |
F |
Fill | Flood fill connected regions |
I |
Color Picker | Sample color from canvas |
| Input | Action |
|---|---|
| Scroll Wheel | Zoom in/out (1x - 128x) |
| Middle-Click Drag | Pan canvas (works anywhere) |
| Right-Click Drag | Pan canvas (on canvas area) |
Space or Cmd/Ctrl+0 |
Fit canvas to view |
+ / = |
Zoom in |
- |
Zoom out |
G |
Toggle pixel grid overlay |
F11 or Cmd/Ctrl+Enter |
Toggle fullscreen |
| Input | Action |
|---|---|
| Left-Click Palette | Set foreground color |
| Right-Click Palette | Set background color |
X |
Swap foreground/background colors |
| Left-Click Canvas | Draw/apply tool with foreground color |
| Keys | Action |
|---|---|
Cmd/Ctrl + S |
Save as BMP (artwork.bmp) |
Cmd/Ctrl + O |
Load BMP file |
Cmd/Ctrl + N |
Clear canvas (new artwork) |
| Keys | Action |
|---|---|
Cmd/Ctrl + Z |
Undo (up to 100 steps) |
Cmd/Ctrl + Shift + Z |
Redo |
Launch with specific dimensions:
./TinyCanvas 128 64 # 128x64 canvas
./TinyCanvas 16 16 # Tiny 16x16 icon- Export: Saves to
artwork.bmpin current directory - Import: Loads any BMP file and resizes canvas to match
- Format: Standard Windows BMP (RGBA32) with alpha channel
- 60 FPS rendering with VSync
- Efficient flood fill with BFS and bounds checking
- Delta time compensation for consistent zoom/pan
- Full undo history under 10MB for typical canvases
pixel-art-editor/
├── src/
│ ├── main.cpp # Entry point
│ ├── editor.h/cpp # Main editor logic & rendering
│ ├── canvas.h/cpp # Canvas operations & drawing algorithms
│ ├── types.h # Core structs (Color, Point, Tool enum)
│ └── font.h # 5x7 bitmap font for UI text
├── CMakeLists.txt # Build configuration
├── .gitignore # Git ignore rules
└── README.md
cmake -DCMAKE_BUILD_TYPE=Debug ..
makecmake -DCMAKE_BUILD_TYPE=Release ..
make
./TinyCanvasrm -rf build/
mkdir build && cd build
cmake ..
makeSDL2 Not Found
If CMake cannot find SDL2, ensure it's installed and pkg-config can locate it:
pkg-config --modversion sdl2