Files
MeowOS-For-R3P2/patch_v2/reader_app/engine/rdimg.h
T
AskaEth 0294553096 reader(R2): EPUB/FB2/MOBI/CBZ 加载器落地
- rdsrc 统一文档源抽象:TXT/FB2/EPUB/MOBI/CBZ 都产出「UTF-8 段序列+目录+元数据+图片」,
  与 R1 rdtxt 段契约一致;book.c 改喂 rd_src(文本)或图页(CBZ)。
- EPUB:miniz 解 ZIP → 自写 rdxml 回调解析 OPF(spine/manifest)+NCX/nav → 正文 XHTML 用
  rdhtml 逐行粗解析(坏标签/未闭合/实体容错,不建 DOM),章节按 RDSRC_SEG_MAX 分片。
- FB2:rdxml 严格解析抽 section 段落 + base64 内嵌图;段题进正文+目录。
- MOBI/AZW3:vendor libmobi 最小调用面(mobi_init→load→parse_kf7/8→parse_rawml_opt→
  flow/resources),HTML 走 rdhtml 同款粗解析;LGPL-3.0 合规见 NOTICE(版权+全文+锁定 commit)。
- CBZ:miniz 解 ZIP → 自然序图片序列,rdimg(stb_image) 解码+降采样,阅读页图页模式。
- 目录显示与跳转(EPUB NCX/FB2 section/MOBI 标题);书架开放四格式;进度按
  (段,字符偏移)(TXT/FB2/EPUB/MOBI)/页号(CBZ)。
- 宿主单测 loaders_smoke(四格式抽取/目录/图片/base64/页序)+ qemu-mipsel
  formats_smoke/book_smoke;R1 test_reader_core 58/0 不回归。
- build_reader.sh 集成 miniz/libmobi/stb/zlib 头;NOTICE 入仓;交叉 -Wall -Wextra 0 warning。

新 reader md5: e29036599300eb277b1c960a75b65dbf
2026-09-02 03:11:55 +08:00

27 lines
1005 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* rdimg.h — stb_image 封装:解码图片 → 降采样 → RGB565 缓冲。CBZ 页面 / 封面用。
* 内存纪律:解码后立即降采样到目标尺寸(≤屏宽),原位图用完即释;采样用行拷贝(线性)。
*/
#ifndef RDIMG_H
#define RDIMG_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* 解码 data[0..size) 为图片,等比缩放到 max_w×max_h 内(不放大原图,只缩小),
* 输出 RGB565 缓冲 *out565(malloc,调用方 free);*ow 与 *oh 为缩放后尺寸。
* 目标缩放:长边 ≥ max 才缩,否则原尺寸。0=成功;负值=解码失败。 */
int rdimg_decode_scale(const uint8_t *data, size_t size, int max_w, int max_h,
uint16_t **out565, int *ow, int *oh);
/* 解码只取尺寸(不缩放,只填充 w/h for 布局预估)。0=成功。 */
int rdimg_probe_wh(const uint8_t *data, size_t size, int *w, int *h);
#ifdef __cplusplus
}
#endif
#endif /* RDIMG_H */