Banjo API 0.0.1
Multi-purpose C99 API
|
2D drawing facilities More...
Functions | |
void | bj_bitmap_draw_line (bj_bitmap *p_bitmap, int x0, int y0, int x1, int y1, uint32_t pixel) |
Draws a line of pixels in the given bitmap. | |
void | bj_bitmap_draw_rectangle (bj_bitmap *p_bitmap, const bj_rect *p_area, uint32_t pixel) |
Draws a rectangle in the given bitmap. | |
void | bj_bitmap_draw_filled_rectangle (bj_bitmap *p_bitmap, const bj_rect *p_area, uint32_t pixel) |
Draws a filled rectangle in the given bitmap. | |
void | bj_bitmap_draw_triangle (bj_bitmap *p_bitmap, int x0, int y0, int x1, int y1, int x2, int y2, uint32_t color) |
Draws the edges of a triangle given its 3 corners. | |
void bj_bitmap_draw_filled_rectangle | ( | bj_bitmap * | p_bitmap, |
const bj_rect * | p_area, | ||
uint32_t | pixel ) |
The function draws an filled rectangle by filling all pixels within p_area
.
p_bitmap | The bitmap object. |
p_area | The rectangle to draw. |
pixel | The line pixel value. |
This function does not perform any bound checking on the pixel coordinates. It is up to you to ensure the coordinates lie between [0, bj_bitmap->width * bj_bitmap->height]. Writing outside of these bounds will result in undefined behavior or corrupted memory access.
void bj_bitmap_draw_line | ( | bj_bitmap * | p_bitmap, |
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1, | ||
uint32_t | pixel ) |
The line is drawn for each pixel between p0 and p1.
p_bitmap | The bitmap object. |
x0 | The X coordinate of the first point in the line. |
y0 | The Y coordinate of the first point in the line. |
x1 | The X coordinate of the second point in the line. |
y1 | The Y coordinate of the second point in the line. |
pixel | The line pixel value. |
This function does not perform any bound checking on the pixel coordinates. It is up to you to ensure the coordinates lie between [0, bj_bitmap->width * bj_bitmap->height]. Writing outside of these bounds will result in undefined behavior or corrupted memory access.
The function draws an rectangle outline using 4 consecutive calls to bj_bitmap_draw_line.
p_bitmap | The bitmap object. |
p_area | The rectangle to draw. |
pixel | The line pixel value. |
This function does not perform any bound checking on the pixel coordinates. It is up to you to ensure the coordinates lie between [0, bj_bitmap->width * bj_bitmap->height]. Writing outside of these bounds will result in undefined behavior or corrupted memory access.
void bj_bitmap_draw_triangle | ( | bj_bitmap * | p_bitmap, |
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
uint32_t | color ) |
p_bitmap | The bitmap object. |
x0 | The X coordinate of the first triangle vertex. |
y0 | The Y coordinate of the first triangle vertex. |
x1 | The X coordinate of the second triangle vertex. |
y1 | The Y coordinate of the second triangle vertex. |
x2 | The X coordinate of the third triangle vertex. |
y2 | The Y coordinate of the third triangle vertex. |
color | The line color. |
This function does not perform any bound checking on the pixel coordinates. It is up to you to ensure the coordinates lie between [0, bj_bitmap->width * bj_bitmap->height]. Writing outside of these bounds will result in undefined behavior or corrupted memory access.