|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Bind a .rabook image-pool figure as a zoom source (#478). More...
#include <stdint.h>#include "book.h"#include "book_paged.h"#include "ra8_err.h"#include "zoom.h"Go to the source code of this file.
Data Structures | |
| struct | zoom_book_src_t |
| One .rabook raster figure, ready to be magnified. More... | |
Functions | |
| ra8_err_t | zoom_book_src_init (zoom_book_src_t *bs, const book_src_t *src, uint32_t img_idx) |
| Look up one image in a book source and prepare it for magnification. | |
| ra8_err_t | zoom_book_src_bind (zoom_book_src_t *bs, zoom_source_t *out) |
| Present a bound figure to the zoom engine as a zoom_source_t. | |
| ra8_err_t | zoom_book_read (void *ctx, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *out, uint32_t out_stride) |
| zoom_read_fn over a .rabook image pool. | |
Bind a .rabook image-pool figure as a zoom source (#478).
The EPUB half of the tap-to-zoom viewer. A reflow page lays a figure out at whatever size the column allows; tapping it should open the retained image, not the laid-out thumbnail, and let the reader magnify into it – which is the whole reason .rabook import stopped downscaling (#210-213, #476).
This adapter is deliberately thin, because the work is already done: book_src_image_rect owns the image-pool addressing contract, serves both retained depths (4 bpp packed and 8 bpp continuous tone) as gray8, and faults a paged book frame-by-frame so a figure larger than RAM still reads. All this file does is present that call as a zoom_read_fn and remember the two things the engine needs – the descriptor and its extent.
The TU compiles to nothing when book_paged.h is not on the include path, so an app that only magnifies tiled comics does not drag book in.
Definition in file zoom_book.h.
|
nodiscard |
zoom_read_fn over a .rabook image pool.
Bound by zoom_book_src_bind; not normally called directly. It forwards to book_src_image_rect, which is where the gray4 nibble parity, the gray8 passthrough and the bounded paged reads all live.
| [in] | ctx | The zoom_book_src_t binding. |
| [in] | x | Rectangle left edge, source pixels. |
| [in] | y | Rectangle top edge, source pixels. |
| [in] | w | Rectangle width, source pixels (> 0). |
| [in] | h | Rectangle height, source pixels (> 0). |
| [out] | out | gray8 destination of at least out_stride * h bytes. |
| [in] | out_stride | Bytes between successive output rows (>= w). |
| k_ra8_ok | The rectangle was written as gray8. |
| k_ra8_err_null_ptr | ctx or out is NULL. |
| k_ra8_err_* | Propagated verbatim from book_src_image_rect. |
ctx is a bound zoom_book_src_t. out content is unspecified.
|
nodiscard |
Present a bound figure to the zoom engine as a zoom_source_t.
| [in] | bs | Binding populated by zoom_book_src_init. |
| [out] | out | Source descriptor to fill. |
| k_ra8_ok | out is ready to hand to zoom_view_open. |
| k_ra8_err_null_ptr | bs, out, or bs->src is NULL. |
| k_ra8_err_invalid_arg | The bound extent is unusable (zero or too large). |
bs was populated by zoom_book_src_init. bs outlives every view bound to out. bs is not modified.
|
nodiscard |
Look up one image in a book source and prepare it for magnification.
Reads the descriptor once, and fails closed on anything the viewer cannot magnify: a vector (SVG) entry, or a zero extent. A raster is accepted at either retained depth – book_src_image_rect normalises both to gray8, which is the only depth the engine reads.
| [out] | bs | Binding to populate. |
| [in] | src | Book source, already bound resident or paged. |
| [in] | img_idx | Image index, < src->hdr.image_count. |
| k_ra8_ok | bs describes a magnifiable raster. |
| k_ra8_err_null_ptr | bs or src is NULL. |
| k_ra8_err_not_supported | The entry is SVG, not a raster. |
| k_ra8_err_invalid_arg | The entry has a zero width or height. |
| k_ra8_err_* | Propagated from book_src_image. |
src was populated by book_src_resident() / book_src_paged(). bs addresses writable storage for one zoom_book_src_t. bs is not left partially bound.