Skip to content
Snippets Groups Projects
Select Git revision
  • 588fd6b822f47836a0ffbbde3ce85b2101773c7f
  • main default protected
  • phhw
  • captouch-threshold
  • t
  • dos
  • test2
  • test
  • slewtest
  • simtest
  • view-think
  • vm-pending
  • media-buf
  • scope
  • passthrough
  • wave
  • vsync
  • dos-main-patch-50543
  • json-error
  • rahix/big-flow3r
  • pippin/media_framework
  • v1.3.0
  • v1.2.0
  • v1.2.0+rc1
  • v1.1.1
  • v1.1.0
  • v1.1.0+rc1
  • v1.0.0
  • v1.0.0+rc6
  • v1.0.0+rc5
  • v1.0.0+rc4
  • v1.0.0+rc3
  • v1.0.0+rc2
  • v1.0.0+rc1
34 results

ctx.wasm

Blame
  • Forked from flow3r / flow3r firmware
    Source project has a limited visibility.
    gfx.h 1.76 KiB
    #ifndef GFX_H
    #define GFX_H
    #include "fonts.h"
    #include "framebuffer.h"
    #include <stddef.h>
    
    struct gfx_region {
    	struct framebuffer *fb;
    	size_t x;
    	size_t y;
    	size_t width;
    	size_t height;
    };
    
    void gfx_setpixel(struct gfx_region *r, int x, int y, Color c);
    struct gfx_region gfx_screen(struct framebuffer *fb);
    void gfx_putchar(sFONT *font, struct gfx_region *reg, int x, int y, char ch,
    						        Color fg, Color bg);
    void gfx_puts(sFONT *font, struct gfx_region *reg, int x, int y,
    			   const char *str, Color fg, Color bg);
    Color gfx_color_rgb_f(struct gfx_region *reg, float r, float g, float b);
    Color gfx_color_rgb(struct gfx_region *reg, uint8_t r, uint8_t g, uint8_t b);
    void gfx_clear_to_color(struct gfx_region *reg, Color c);
    void gfx_clear(struct gfx_region *reg);
    void gfx_circle(struct gfx_region *reg, int x, int y, int r, int t, Color c);
    void gfx_circle_fill(struct gfx_region *reg, int x, int y, int r, Color c);
    void gfx_rectangle(struct gfx_region *reg, int x, int y, int w, int h,
    						      int t, Color c);
    void gfx_rectangle_fill(struct gfx_region *reg, int x, int y, int w, int h,
    								  Color c);
    void gfx_line(struct gfx_region *reg, int x1, int y1, int x2, int y2,
    						     int t, Color c);
    void gfx_update(struct gfx_region *reg);
    
    enum gfx_color {
    	WHITE,
    	BLACK,
    	RED,
    	GREEN,
    	BLUE,
    	YELLOW,
    
    	COLORS
    };
    
    enum gfx_encoding {
    	GFX_RAW,
    	GFX_MONO,
    	GFX_RLE_MONO
    };
    
    struct gfx_color_rgb {
    	uint8_t r;
    	uint8_t g;
    	uint8_t b;
    } extern const gfx_colors_rgb[COLORS];
    
    Color gfx_color(struct gfx_region *reg, enum gfx_color color);
    
    void gfx_copy_region(struct gfx_region *reg, int x, int y, int w, int h,
    		         	enum gfx_encoding encoding, size_t size,
    							 const void *p);
    void gfx_copy_raw(struct gfx_region *reg, const void *p, size_t size);
    
    #endif