Cherry-pick merge from pablohc/crosspoint-reader@2d8cbcf, based on upstream PR #556 by martinbrook with pablohc's refresh optimization. - Add JPEG decoder (picojpeg) and PNG decoder (PNGdec) with 4-level grayscale Bayer dithering for e-ink display - Add pixel caching system (.pxc files) for fast image re-rendering - Integrate image extraction from EPUB HTML parser (<img> tag support) - Add ImageBlock/PageImage types with serialization support - Add image-aware refresh optimization (double FAST_REFRESH technique) - Add experimental displayWindow() partial refresh support - Bump section cache version 12->13 to invalidate stale caches - Resolve TAG_PageImage=3 to avoid conflict with mod's TAG_PageTableRow=2 Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
771 B
C++
32 lines
771 B
C++
#pragma once
|
|
#include <SdFat.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "Block.h"
|
|
|
|
class ImageBlock final : public Block {
|
|
public:
|
|
ImageBlock(const std::string& imagePath, int16_t width, int16_t height);
|
|
~ImageBlock() override = default;
|
|
|
|
const std::string& getImagePath() const { return imagePath; }
|
|
int16_t getWidth() const { return width; }
|
|
int16_t getHeight() const { return height; }
|
|
|
|
bool imageExists() const;
|
|
|
|
BlockType getType() override { return IMAGE_BLOCK; }
|
|
bool isEmpty() override { return false; }
|
|
|
|
void render(GfxRenderer& renderer, const int x, const int y);
|
|
bool serialize(FsFile& file);
|
|
static std::unique_ptr<ImageBlock> deserialize(FsFile& file);
|
|
|
|
private:
|
|
std::string imagePath;
|
|
int16_t width;
|
|
int16_t height;
|
|
};
|