23typedef enum : int32_t {
76 e->
from_sd ?
"Source: SD card" :
"Source: baked (MRAM)",
86static bool sh_in_rect(int32_t x, int32_t y, int32_t rx, int32_t ry, int32_t rw, int32_t rh)
88 return (x >= rx) && (x < (rx + rw)) && (y >= ry) && (y < (ry + rh));
108 const uint32_t cover =
g_sh.book_src.hdr.cover_image_index;
129 const uint32_t cover =
g_sh.book_src.hdr.cover_image_index;
@ k_book_nil
Absent index / "applies to all chapters".
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
ra8_err_t ra8_gfx_clear(uint32_t color)
Fill the bound framebuffer's clip region with a single colour.
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.
void sh_book_cover_fullscreen(int32_t x, int32_t y, int32_t w, int32_t h)
Draw the open book's cover full-size, aspect-fit into the box.
int32_t sh_cells(int32_t pixels)
Cells of the 8px bitmap font that fit in pixels.
void sh_titlebar(const char *title, const char *right)
Fill the header bar and draw title left + optional right text.
@ k_sh_loupe_w
Lens window width in framebuffer pixels.
@ k_sh_loupe_h
Lens window height in framebuffer pixels.
bool sh_image_loupe_map(const book_src_t *src, uint32_t img_idx, int32_t box_x, int32_t box_y, int32_t box_w, int32_t box_h, int32_t px, int32_t py, int32_t *out_cx, int32_t *out_cy)
Map a framebuffer touch point over an aspect-fit image box to full-resolution source coordinates (lou...
@ k_sh_glyph_h
Bitmap font cell height.
@ k_sh_fb_h
Panel height in pixels.
@ k_sh_pad
Outer margin / content inset.
@ k_sh_linebuf
Per-line draw buffer bytes.
@ k_sh_fb_w
Panel width in pixels.
ra8_err_t sh_image_loupe(const book_src_t *src, uint32_t img_idx, int32_t src_cx, int32_t src_cy, int32_t dst_x, int32_t dst_y)
Draw the magnifier loupe: a k_sh_loupe_zoom-magnified 1:1 window of a full-resolution 4bpp source ima...
sh_cover_act_t
Result of a tap on the cover screen.
@ k_sh_cover_read
Open the reader at chapter 0.
@ k_sh_cover_none
Tap hit nothing actionable.
@ k_sh_cover_toc
Open the table of contents.
sh_state_t g_sh
The single whole-app state instance (defined in main.c).
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 "..".
@ k_sh_col_barfg
Text on the bar.
@ k_sh_col_bg
App background (dark wood).
@ k_sh_col_card
Card / page fill (paper).
@ k_sh_col_sub
Secondary ink (author / hints).
@ k_sh_col_bar
Header / title-bar fill.
@ k_sh_fmt_rabook
book RBKC container (demand-paged chunks).
sh_cover_layout_t
Cover-page geometry (framebuffer pixels).
@ k_sh_cv_toc_y
"Contents" button top.
@ k_sh_cv_title_y
Title baseline.
@ k_sh_cv_box_y
Cover box top.
@ k_sh_cv_btn_pad
Button text inset.
@ k_sh_cv_panel_x
Right text panel left.
@ k_sh_cv_btn_h
Action button height.
@ k_sh_cv_auth_y
Author baseline.
@ k_sh_cv_box_x
Cover box left.
@ k_sh_cv_box_h
Cover box height.
@ k_sh_cv_read_y
"Read" button top.
@ k_sh_cv_box_w
Cover box width.
@ k_sh_cv_btn_w
Action button width.
void sh_cover_loupe_render(void)
Draw the magnifier loupe over the cover at the current pan centre.
bool sh_cover_loupe_map(int32_t px, int32_t py, int32_t *out_cx, int32_t *out_cy)
Map a cover-screen touch to full-res source coordinates for the loupe.
static void sh_cover_button(int32_t y, const char *label)
Draw a filled action button with a left-inset label.
static bool sh_in_rect(int32_t x, int32_t y, int32_t rx, int32_t ry, int32_t rw, int32_t rh)
Inclusive-left / exclusive-right point-in-rect test.
sh_cover_act_t sh_cover_action(int32_t x, int32_t y)
Classify a cover-screen tap into a sh_cover_act_t.
void sh_cover_render(void)
Render the selected book's cover / title page.
One shelf book, sourced from MRAM (baked) or the SD card, in either the .rabook or ....
bool from_sd
true: read sd_name from SD; false: use blob.
char title[k_sh_title_cap]
Display title.
char author[k_sh_author_cap]
Display author.