Initial commit

This commit is contained in:
2026-01-09 14:13:25 +01:00
commit 2377aa0f50
7 changed files with 804 additions and 0 deletions

54
README.MD Normal file
View File

@@ -0,0 +1,54 @@
# Pix
## Simple c++ image library
- Handles only ppm (p3) format
## Setup
- copy include folder to your project includes
## Usage
```C
#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;
}
```
[thumbnail]: https://gitlab.com/lejulien-42/pix/-/raw/main/thumbnail.png
![output][thumbnail]
## Todo
- Bezier/spline
- antialiasing
- triangles
## References
- ft_rubik