2026-01-09 13:56:28 +00:00
2026-01-09 14:13:25 +01:00
2026-01-09 14:13:25 +01:00
2026-01-09 14:13:25 +01:00
2026-01-09 14:13:25 +01:00
2026-01-09 13:56:28 +00:00
2026-01-09 14:13:25 +01:00

Pix

Simple c++ image library

- Handles only ppm (p3) format

Setup

- copy include folder to your project includes

Usage

#include "pix.hpp"

int		main(void) {
	// Create image, args: <width> <height>
	pix::Image img(500, 400);
	
	// Clear image with color, arg: <color>
	img.fillImg({200, 50, 200}); 
	
	// draw rectangle, args: <pos> <size> <color>
	img.drawRect({2, 2}, {300, 150}, {0, 0, 255});
	img.drawRect({10, 10}, {16, 16}, {150, 10, 150});

	// draw circle, args: <pos> <radius> <color>
	img.drawCircle({250, 200}, 180, {0, 0, 0});

	// print text, args: <str> <pos> <color>
	img.print("42421234567890", {20, 100}, {0, 255, 0});
	img.print("101", {450, 300}, {255, 0, 0});
	img.print("PiX = 42", {350, 50}, {0, 255, 255});
	img.print("hello world !", {210, 320}, {200, 200, 255});

	// draw line, args: <pos1> <pos2> <color>
	img.line({10, 10}, {490, 390}, {0, 255, 0});

	// save image, arg: <filepath>
	img.saveAs("out.ppm");
	return 0;
}

output

Todo

- Bezier/spline
- antialiasing
- triangles

References

- ft_rubik
Description
A simple C++ header only image processing library
Readme 36 KiB
Languages
C++ 99.7%
Shell 0.3%