ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
sh_cover.c File Reference

Cover / title page for the open book. More...

#include "ra8_gfx.h"
#include "ra8_gfx_font.h"
#include "sh_app.h"
Include dependency graph for sh_cover.c:

Go to the source code of this file.

Enumerations

enum  sh_cover_layout_t : int32_t {
  k_sh_cv_box_x = 32 ,
  k_sh_cv_box_y = 80 ,
  k_sh_cv_box_w = 340 ,
  k_sh_cv_box_h = 490 ,
  k_sh_cv_panel_x = 420 ,
  k_sh_cv_title_y = 110 ,
  k_sh_cv_auth_y = 150 ,
  k_sh_cv_btn_w = 360 ,
  k_sh_cv_btn_h = 52 ,
  k_sh_cv_read_y = 250 ,
  k_sh_cv_toc_y = 326 ,
  k_sh_cv_btn_pad = 16
}
 Cover-page geometry (framebuffer pixels). More...

Functions

static void sh_cover_button (int32_t y, const char *label)
 Draw a filled action button with a left-inset label.
void sh_cover_render (void)
 Render the selected book's cover / title page.
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.
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.
void sh_cover_loupe_render (void)
 Draw the magnifier loupe over the cover at the current pan centre.

Detailed Description

Cover / title page for the open book.

Renders the open book's full cover (decoded straight from its 4bpp image pool) on the left, with the title, author, and two action buttons – "Read this book" and "Table of Contents" – on the right. Tapping the cover or the read button starts the reader; the contents button opens the TOC.

[Ring 6 / App] {World: NS}

Since
0.1.0

Definition in file sh_cover.c.

Enumeration Type Documentation

◆ sh_cover_layout_t

enum sh_cover_layout_t : int32_t

Cover-page geometry (framebuffer pixels).

Enumerator
k_sh_cv_box_x 

Cover box left.

k_sh_cv_box_y 

Cover box top.

k_sh_cv_box_w 

Cover box width.

k_sh_cv_box_h 

Cover box height.

k_sh_cv_panel_x 

Right text panel left.

k_sh_cv_title_y 

Title baseline.

k_sh_cv_auth_y 

Author baseline.

k_sh_cv_btn_w 

Action button width.

k_sh_cv_btn_h 

Action button height.

k_sh_cv_read_y 

"Read" button top.

k_sh_cv_toc_y 

"Contents" button top.

k_sh_cv_btn_pad 

Button text inset.

Definition at line 23 of file sh_cover.c.

Function Documentation

◆ sh_cover_action()

sh_cover_act_t sh_cover_action ( int32_t x,
int32_t y )

◆ sh_cover_button()

void sh_cover_button ( int32_t y,
const char * label )
static

Draw a filled action button with a left-inset label.

Definition at line 39 of file sh_cover.c.

References k_sh_col_bar, k_sh_col_barfg, k_sh_cv_btn_h, k_sh_cv_btn_pad, k_sh_cv_btn_w, k_sh_cv_panel_x, k_sh_glyph_h, ra8_gfx_font_8x16, ra8_gfx_rect(), and ra8_gfx_text_out().

Referenced by sh_cover_render().

◆ sh_cover_loupe_map()

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.

Only rabook covers with a real 4bpp cover image are magnifiable; EPUB covers (decoded JPEG/PNG) and cover-less books return false.

Parameters
[in]pxTouch X in framebuffer pixels.
[in]pyTouch Y in framebuffer pixels.
[out]out_cxReceives the source-image X the point maps to.
[out]out_cyReceives the source-image Y the point maps to.
Returns
true if the point is over a magnifiable cover image.
Since
0.1.0

Definition at line 103 of file sh_cover.c.

References g_sh, k_book_nil, k_sh_cv_box_h, k_sh_cv_box_w, k_sh_cv_box_x, k_sh_cv_box_y, k_sh_fmt_rabook, and sh_image_loupe_map().

Referenced by sh_loupe_held().

◆ sh_cover_loupe_render()

void sh_cover_loupe_render ( void )

Draw the magnifier loupe over the cover at the current pan centre.

Definition at line 124 of file sh_cover.c.

References g_sh, k_book_nil, k_sh_fb_h, k_sh_fb_w, k_sh_fmt_rabook, k_sh_loupe_h, k_sh_loupe_w, and sh_image_loupe().

Referenced by sh_present(), and sh_present_loupe().

◆ sh_cover_render()

◆ sh_in_rect()

bool sh_in_rect ( int32_t x,
int32_t y,
int32_t rx,
int32_t ry,
int32_t rw,
int32_t rh )
static

Inclusive-left / exclusive-right point-in-rect test.

Definition at line 86 of file sh_cover.c.

Referenced by sh_cover_action().