diff options
Diffstat (limited to 'render.h')
-rw-r--r-- | render.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/render.h b/render.h new file mode 100644 index 0000000..36bafe4 --- /dev/null +++ b/render.h @@ -0,0 +1,48 @@ +#ifndef render_h +#define render_h + +#include "rect.h" + +typedef struct { + unsigned char r, g, b, a; +} Colour; + +Colour make_colour(unsigned rgb, unsigned char a); +Colour make_red(void); +Colour make_green(void); +Colour make_blue(void); +Colour make_cyan(void); +Colour make_pink(void); +Colour make_yellow(void); +Colour make_aliceblue(void); +Colour blend(Colour dst, Colour src); +Colour blend_mod(Colour dst, Colour src, Colour mod); + +typedef struct { + Colour* t; + int w, h; + Rect clip; +} Renderer; + +void ren_begin(Renderer* r, Colour* t, int w, int h); +void ren_end(Renderer* r); +void ren_clear(Renderer* r); +void ren_clearc(Renderer* r, Colour c); +void ren_clip(Renderer* r, const Rect* c); +void ren_point(Renderer* r, Colour c, int x, int y); +void ren_char( + Renderer* r, + Colour c, + int x, + int y, + char ch +); +void ren_text( + Renderer* r, + Colour c, + int x, + int y, + const char* t +); + +#endif |