Public Access
Enter on a picture shows it: shrunk to fit the screen, or at its own size with Enter again and the arrows to move. Dithered to the screen's 256 colours; a colour the screen has exactly is left alone, so screenshots are shown as they are. The picture is decoded once, straight into the screen's buffer, and kept there (App::retainsContent): no copy in memory. Decoding runs on the storage task, so the keys keep working and a 12 megapixel photograph appears as it comes instead of tripping the watchdog. PNG, BMP and GIF are read by decoders of our own, host-tested against files made by Pillow; the PNG one needs 32 KB where the display library's needed 44 KB in one block, which the device often doesn't have. JPEG uses the library's TJpgDec. Also corrects two sentences that still gave 16 KB as the editing limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
21 lines
964 B
C++
21 lines
964 B
C++
#pragma once
|
|
|
|
#include "image_file.h"
|
|
|
|
namespace roro::files {
|
|
|
|
// A PNG, decoded a row at a time (issue #45): every colour type and bit depth, not interlaced.
|
|
// Pixels that are mostly transparent are not handed on. `rowNeeded` lets rows be left out (they
|
|
// are still decoded: a row is stored as its difference from the one before); `enough` says that
|
|
// from this row on nothing is wanted, and the decoding stops there.
|
|
//
|
|
// Memory while it runs: the window the file's compression refers back into (what its header asks
|
|
// for, 32 KB at most), two rows of the picture, and about 3 KB. The display library's decoder
|
|
// wanted 44 KB in one block, which this device often doesn't have.
|
|
//
|
|
// "" or why it can't be shown.
|
|
std::string readPng(const ImageRead& read, uint32_t size, const ImagePixels& pixels, const std::function<bool(int y)>& rowNeeded = nullptr,
|
|
const std::function<bool(int y)>& enough = nullptr);
|
|
|
|
} // namespace roro::files
|