TB2026-YDS Firmware
Loading...
Searching...
No Matches

Software rendering into an in-RAM RGB565 framebuffer, blitted by gfx_flush(). More...

Collaboration diagram for Graphics:

Macros

#define GFX_W   176
#define GFX_H   176
#define GFX_BLACK   ((gfx_color_t)0x0000)
#define GFX_WHITE   ((gfx_color_t)0xFFFF)
#define GFX_CHAR_W   6
#define GFX_CHAR_H   8

Typedefs

typedef uint16_t gfx_color_t

Functions

void gfx_clear (gfx_color_t color)
 Fill the whole framebuffer with one color.
void gfx_pixel (int x, int y, gfx_color_t color)
 Set one pixel; off-canvas coordinates are ignored.
void gfx_fill_rect (int x, int y, int w, int h, gfx_color_t color)
 Fill a rectangle, clipped to the canvas.
void gfx_draw_rect (int x, int y, int w, int h, gfx_color_t color)
 Draw a 1px rectangle outline.
void gfx_draw_text (int x, int y, const char *s, gfx_color_t color, int scale)
 Draw an ASCII string (0x20..0x7E) left to right.
void gfx_blit_1bpp (int x, int y, int w, int h, const uint8_t *bitmap, gfx_color_t color)
 Draw a 1-bpp bitmap; set bits are drawn in color, clear bits are skipped.
void gfx_flush (void)
 Blit the framebuffer to the OLED over SPI.
const gfx_color_tgfx_buffer (void)
 Read-only access to the framebuffer (GFX_W*GFX_H pixels).

Detailed Description

Software rendering into an in-RAM RGB565 framebuffer, blitted by gfx_flush().

Macro Definition Documentation

◆ GFX_BLACK

#define GFX_BLACK   ((gfx_color_t)0x0000)

Black.

◆ GFX_CHAR_H

#define GFX_CHAR_H   8

Character cell height.

◆ GFX_CHAR_W

#define GFX_CHAR_W   6

Character cell width: 5px glyph + 1px gap.

◆ GFX_H

#define GFX_H   176

Canvas height in pixels.

◆ GFX_W

#define GFX_W   176

Canvas width in pixels (the SSD1333 panel).

◆ GFX_WHITE

#define GFX_WHITE   ((gfx_color_t)0xFFFF)

White.

Typedef Documentation

◆ gfx_color_t

typedef uint16_t gfx_color_t

A pixel: RGB565, native byte order.

Function Documentation

◆ gfx_blit_1bpp()

void gfx_blit_1bpp ( int x,
int y,
int w,
int h,
const uint8_t * bitmap,
gfx_color_t color )

Draw a 1-bpp bitmap; set bits are drawn in color, clear bits are skipped.

The bitmap is row-major, MSB-first within each byte (bit 7 = leftmost pixel), with each row padded to a whole number of bytes (stride = (w + 7) / 8). This is the format emitted by scripts/icon2c.py. Clear bits leave the framebuffer untouched, so the background shows through (transparency).

Parameters
x,yTop-left position in the framebuffer.
w,hBitmap dimensions in pixels.
bitmap1-bpp pixel data, (w + 7) / 8 * h bytes.
colorColor for set bits.

◆ gfx_buffer()

const gfx_color_t * gfx_buffer ( void )

Read-only access to the framebuffer (GFX_W*GFX_H pixels).

Returns
Pointer to the framebuffer; used by the flush path and by host tests.

◆ gfx_clear()

void gfx_clear ( gfx_color_t color)

Fill the whole framebuffer with one color.

◆ gfx_draw_rect()

void gfx_draw_rect ( int x,
int y,
int w,
int h,
gfx_color_t color )

Draw a 1px rectangle outline.

◆ gfx_draw_text()

void gfx_draw_text ( int x,
int y,
const char * s,
gfx_color_t color,
int scale )

Draw an ASCII string (0x20..0x7E) left to right.

Parameters
x,yTop-left of the first glyph.
sNUL-terminated string; non-printable bytes advance but draw nothing.
colorGlyph color.
scaleInteger pixel scale (clamped to >= 1).

◆ gfx_fill_rect()

void gfx_fill_rect ( int x,
int y,
int w,
int h,
gfx_color_t color )

Fill a rectangle, clipped to the canvas.

◆ gfx_flush()

void gfx_flush ( void )

Blit the framebuffer to the OLED over SPI.

◆ gfx_pixel()

void gfx_pixel ( int x,
int y,
gfx_color_t color )

Set one pixel; off-canvas coordinates are ignored.