Aldrin_Canvas
pixels
, width
and height
properties of canvas.static uint32_t pixels[WIDTH*HEIGHT];
Aldrin_Canvas ac = { pixels, WIDTH, HEIGHT };
### `aldrin_put_pixel()`
* Puts a pixel on the canvas.
* Syntax: aldrin_put_pixel(ac, x, y, color)
* Parameters:
- `ac`: `Aldrin_Canvas`
- `x`: `uint32_t`: x coordinate of pixel
- `y`: `uint32_t`: y coordinate of pixel
- `color`: `uint32_t`: color code of pixel
* Example:
```c
aldrin_put_pixel(ac, 100, 100, 0x00ff00);
aldrin_fill()
ac
: Aldrin_Canvas
fill_color
: uint32_t
: color code of fillaldrin_fill(ac, 0x00ff00);
aldrin_draw_line()
ac
: Aldrin_Canvas
x1
: uint32_t
: x coordinate of first pointy1
: uint32_t
: y coordinate of first pointx2
: uint32_t
: x coordinate of second pointy2
: uint32_t
: y coordinate of second pointline_color
: uint32_t
: color code of linethickness
: βuint32_t`: thickness of linealdrin_draw_line(ac, 0, 0, 200, 200, 0xff0000, 5);
aldrin_draw_triangle()
ac
: Aldrin_Canvas
x1
: uint32_t
: x coordinate of first pointy1
: uint32_t
: y coordinate of first pointx2
: uint32_t
: x coordinate of second pointy2
: uint32_t
: y coordinate of second pointx3
: uint32_t
: x coordinate of third pointy3
: uint32_t
: y coordinate of third pointline_color
: uint32_t
: color code of linethickness
: βuint32_t`: thickness of linealdrin_draw_triangle(ac, 5, 10, 5, 100, 120, 10, 0xff0000, 1);
aldrin_fill_triangle()
ac
: Aldrin_Canvas
x1
: uint32_t
: x coordinate of first pointy1
: uint32_t
: y coordinate of first pointx2
: uint32_t
: x coordinate of second pointy2
: uint32_t
: y coordinate of second pointx3
: uint32_t
: x coordinate of third pointy3
: uint32_t
: y coordinate of third pointfill_color
: uint32_t
: color code of fillaldrin_fill_triangle(ac, 5, 10, 5, 100, 120, 10, 0xff0000);
aldrin_draw_ellipse()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of ellipsey
: uint32_t
: y coordinate of top-left corner of ellipserx
: uint32_t
: x radius of ellipsery
: uint32_t
: y radius of ellipseline_color
: uint32_t
: color code of linealdrin_draw_ellipse(ac, 0, 0, 90, 50, 0xff0000);
aldrin_fill_ellipse()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of ellipsey
: uint32_t
: y coordinate of top-left corner of ellipserx
: uint32_t
: x radius of ellipsery
: uint32_t
: y radius of ellipsefill_color
: uint32_t
: color code of fillaldrin_fill_ellipse(ac, 0, 0, 90, 50, 0xff0000);
aldrin_draw_circle()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of circley
: uint32_t
: y coordinate of top-left corner of circler
: uint32_t
: radius of circleline_color
: uint32_t
: color code of linealdrin_draw_circle(ac, 0, 0, 50, 0xff0000);
aldrin_fill_circle()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of circley
: uint32_t
: y coordinate of top-left corner of circler
: uint32_t
: radius of circlefill_color
: uint32_t
: color code of fillaldrin_fill_circle(ac, 0, 0, 50, 0xff0000);
aldrin_draw_rectangle()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of rectangley
: uint32_t
: y coordinate of top-left corner of rectanglew
: uint32_t
: width of rectangleh
: uint32_t
: height of rectangleline_color
: uint32_t
: color code of linethickness
: βuint32_t`: thickness of linealdrin_draw_rectangle(ac, 0, 0, 50, 100, 0xff0000, 1);
aldrin_fill_rectangle()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of rectangley
: uint32_t
: y coordinate of top-left corner of rectanglew
: uint32_t
: width of rectangleh
: uint32_t
: height of rectanglefill_color
: uint32_t
: color code of fillaldrin_fill_rectangle(ac, 0, 0, 50, 100, 0xff0000);
aldrin_draw_square()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of rectangley
: uint32_t
: y coordinate of top-left corner of rectanglel
: uint32_t
: lenght (width and height) of rectangleline_color
: uint32_t
: color code of linethickness
: uint32_t
: thickness of linealdrin_draw_square(ac, 0, 0, 100, 0xff0000, 1);
aldrin_fill_square()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of rectangley
: uint32_t
: y coordinate of top-left corner of rectanglel
: uint32_t
: lenght (width and height) of rectanglefill_color
: uint32_t
: color code of fillaldrin_fill_square(ac, 0, 0, 100, 0xff0000);
aldrin_text()
ac
: Aldrin_Canvas
x
: uint32_t
: x coordinate of top-left corner of texty
: uint32_t
: y coordinate of top-left corner of texttext
: char[]
: text to writetext_color
: uint32_t
: color code of texttext_size
: uint32_t
: size of textaldrin_text(ac, 0, 0, "Lorem ipsum dolor! 012.", 0xffffff, 2);
aldrin_get_pixels()
Aldrin_Canvas
.ac
: Aldrin_Canvas
WASM
.aldrin_get_pixels(ac);
aldrin_get_width()
Aldrin_Canvas
.ac
: Aldrin_Canvas
WASM
.aldrin_get_width(ac);
aldrin_get_height()
Aldrin_Canvas
.ac
: Aldrin_Canvas
WASM
.aldrin_get_height(ac);
aldrin_save_ppm()
Aldrin_Canvas
as a ppm file.ac
: Aldrin_Canvas
filename
: char[]
: filename of the ppm fileWASM
.aldrin_save_ppm(ac, "output.ppm");