24typedef enum : uint32_t {
33void sh_fit(
char* dst,
size_t cap,
const char* src, int32_t max_chars)
35 size_t limit = (max_chars < 1) ? 1U : (size_t)max_chars;
39 const size_t len =
strlen(src);
49 dst[keep + 2U] =
'\0';
63 for (uint32_t k = 0U; k < n; ++k) {
64 dst[pos++] = tmp[n - 1U - k];
71 for (int32_t i = 0; i < width; ++i) {
72 (void)
ra8_gfx_rect(r.
x + i, r.
y + i, r.
w - (2 * i), r.
h - (2 * i), colour,
false);
85 if (right !=
nullptr) {
size_t strlen(const char *s)
Calculate string length.
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
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.
ra8_err_t ra8_gfx_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color, bool filled)
Draw an axis-aligned rectangle.
Bitmap font descriptor + bundled font handles for ra8_gfx.
const ra8_gfx_font_t ra8_gfx_font_8x16
Bundled 8x16 IBM PC VGA bitmap font, ASCII 0x20..0x7E.
Shared contract for the ereader_shelf multi-screen e-reader.
@ k_sh_glyph_h
Bitmap font cell height.
@ k_sh_glyph_w
Bitmap font cell width.
@ k_sh_pad
Outer margin / content inset.
@ k_sh_bar_h
Header / title-bar height.
@ k_sh_fb_w
Panel width in pixels.
@ k_sh_dec_base
Decimal formatting base.
@ k_sh_col_barfg
Text on the bar.
@ k_sh_col_bar
Header / title-bar fill.
int32_t sh_cells(int32_t pixels)
Cells of the 8px bitmap font that fit in pixels.
void sh_border(ra8_ui_rect_t r, uint32_t colour, int32_t width)
Draw a width-thick rectangle outline in colour.
void sh_titlebar(const char *title, const char *right)
Fill the header bar and draw title left + optional right text.
sh_util_const_t
Local layout constants.
@ k_sh_ellipsis_min
Chars kept before the ".." truncation.
size_t sh_fmt_uint(char *dst, size_t pos, uint32_t v)
Append unsigned v as decimal into dst at pos; returns new pos.
void sh_fit(char *dst, size_t cap, const char *src, int32_t max_chars)
Copy src into dst (cap bytes), truncating past max_chars with "..".
Axis-aligned rectangle in framebuffer pixel coordinates.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).