Skip to content
Snippets Groups Projects
Select Git revision
  • 1a32b8a72d88530133bc31eb19632f0b353408f8
  • master default protected
  • display-framerate
  • genofire/ble-card10-timeread
  • schneider/fundamental-test
  • schneider/ble-buffers
  • ios-workarounds
  • schneider/maxim-sdk-update
  • rahix/simple_menu
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • koalo/wip/i2c-for-python
  • renze/safe_mode
  • renze/hatchery_apps
  • koalo/factory-reset
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • schneider/bonding
  • schneider/bootloader-update-9a0d158
  • schneider/bsec
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
30 results

gfx.h

Blame
  • Forked from card10 / 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