28typedef enum : uint8_t {
37typedef enum : uint32_t {
45typedef enum : uint8_t {
95 const int32_t cx0 = (x >= cl) ? x : cl;
96 const int32_t cy0 = (y >= ct) ? y : ct;
97 const int64_t xr = (int64_t)x + (int64_t)gw;
98 const int64_t yr = (int64_t)y + (int64_t)gh;
99 const int32_t cx1 = (xr < (int64_t)cr) ? (int32_t)xr : cr;
100 const int32_t cy1 = (yr < (int64_t)cb) ? (int32_t)yr : cb;
101 if ((cx1 <= cx0) || (cy1 <= cy0)) {
106 const uint8_t flo = (uint8_t)(vfg & (uint16_t)
k_mask_byte);
108 const uint8_t blo = (uint8_t)(vbg & (uint16_t)
k_mask_byte);
112 for (int32_t sy = cy0; sy < cy1; sy++) {
113 const uint32_t grow = (uint32_t)(sy - y);
114 uint8_t* p =
g_gfx_text_state.fb + ((size_t)sy * stride) + ((
size_t)cx0 * bpp);
115 for (int32_t sx = cx0; sx < cx1; sx++) {
116 const uint32_t gcol = (uint32_t)(sx - x);
119 const bool on = ((gd[byte_idx] >> bit) & 0x01U) != 0U;
153 if ((cp < font->first_codepoint) || (cp > font->
last_codepoint)) {
158 const uint32_t row_bytes =
172 for (uint32_t row = 0; row < font->
glyph_height; row++) {
173 for (uint32_t col = 0; col < font->
glyph_width; col++) {
176 const bool on = ((gd[byte_idx] >> bit) & 0x01U) != 0U;
189 if ((str ==
nullptr) || (font ==
nullptr)) {
199 for (uint32_t i = 0; i < max_chars; i++) {
200 const char c = str[i];
213 if ((str ==
nullptr) || (font ==
nullptr) || (out_w ==
nullptr) || (out_h ==
nullptr)) {
218 for (uint32_t i = 0; i < max_chars; i++) {
219 if (str[i] ==
'\0') {
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
@ k_ra8_gfx_format_rgb565
16-bit RGB565, little-endian in memory.
@ k_ra8_gfx_max_dim
Maximum supported edge length.
Module-private declarations shared across the ra8_gfx software rasteriser TUs.
ra8_gfx_state_t g_gfx_text_state
Single module-wide framebuffer binding shared by every ra8_gfx TU.
void priv_gfx_text_plot(int32_t x, int32_t y, uint32_t color)
Plot a single pixel with bounds checking against the active clip.
uint16_t priv_gfx_text_pack_565(uint32_t color)
Pack a 32-bit colour into a single RGB565 word.
ra8_gfx_glyph_bits_t
Constants for monochrome glyph bit extraction.
@ k_glyph_bits_per_byte
Glyph bits per byte.
@ k_glyph_msb_index
Glyph msb index.
ra8_gfx_byte_idx_t
Per-byte indices for RGB888 packing.
ra8_gfx_color_masks_t
Per-channel masks for colour conversion.
static void internal_render_glyph(int32_t x, int32_t y, const ra8_gfx_font_t *font, uint8_t cp, uint32_t fg, uint32_t bg)
Render a single glyph at (x,y).
static void internal_blit_glyph_565(int32_t x, int32_t y, int32_t gw, int32_t gh, uint32_t row_bytes, const uint8_t *gd, uint32_t fg, uint32_t bg)
Blit one 1-bpp glyph cell into an RGB565 framebuffer, clipped on screen.
ra8_err_t ra8_gfx_text_size(const char *str, const ra8_gfx_font_t *font, uint32_t *out_w, uint32_t *out_h)
Compute rendered pixel dimensions of a string.
ra8_err_t ra8_gfx_text_out(int32_t x, int32_t y, const char *str, const ra8_gfx_font_t *font, uint32_t fg_color, uint32_t bg_color)
Render a NUL-terminated ASCII string.
Monochrome, fixed-width bitmap font descriptor.
uint8_t bytes_per_glyph
Bytes occupied by one glyph (rows * ceil(width/8)).
uint8_t last_codepoint
Highest stored codepoint (typically 0x7E, '~').
uint8_t glyph_width
Glyph width in pixels.
uint8_t glyph_height
Glyph height in pixels.
uint8_t first_codepoint
Lowest stored codepoint (typically 0x20, space).
const uint8_t * glyph_data
Packed glyph bitmaps; size = bytes_per_glyph * glyph_count.