38 lines
1.0 KiB
C
38 lines
1.0 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef union {
|
|
uint32_t color;
|
|
struct {
|
|
uint8_t r;
|
|
uint8_t g;
|
|
uint8_t b;
|
|
uint8_t a;
|
|
};
|
|
} image_color_t;
|
|
|
|
typedef struct {
|
|
uint16_t width;
|
|
uint16_t height;
|
|
image_color_t* pixels;
|
|
} image_data_t;
|
|
|
|
image_data_t image_create(uint16_t width, uint16_t height);
|
|
void image_free(image_data_t image);
|
|
|
|
void image_draw_point(image_data_t image, int16_t x, int16_t y, image_color_t color);
|
|
void image_draw_hline(image_data_t image, int16_t x1, int16_t x2, int16_t y, image_color_t color);
|
|
void image_draw_vline(image_data_t image, int16_t x, int16_t y1, int16_t y2, image_color_t color);
|
|
void image_draw_line(image_data_t image, int16_t x1, int16_t y1, int16_t x2, int16_t y2, image_color_t color);
|
|
void image_draw_rect(image_data_t image, int16_t x, int16_t y, uint16_t w, uint16_t h, image_color_t color);
|
|
void image_fill_rect(image_data_t image, int16_t x, int16_t y, uint16_t w, uint16_t h, image_color_t color);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|