Initial commit
This commit is contained in:
54
README.MD
Normal file
54
README.MD
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user