|
TinyGPU
|
Decodes baseline JPEG images into a TinyGPU ISurface, using pschatzmann/TinyJPEG (https://github.com/pschatzmann/TinyJPEG) as the underlying decoder. More...
#include <JPEGParser.h>

Public Member Functions | |
| JPEGParser (ISurface< RGB_T > &target) | |
| void | setSwapBytes (bool swap) |
| void | setScale (uint8_t scale) |
| Sets the output reduction factor: 1 (full size), 2, 4, or 8. | |
| bool | decode (const uint8_t *data, size_t size) |
| template<typename FileT > | |
| bool | decode (FileT &file) |
| const char * | errorMessage () const |
| Returns the latest error message, if any. | |
Protected Member Functions | |
| bool | setError (const char *message) |
| bool | checkResult (JRESULT result) |
Static Protected Member Functions | |
| static bool | onBlock (tinyjpeg::TinyJPEGDecoder &decoder, int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t *data) |
Protected Attributes | |
| ISurface< RGB_T > & | target_ |
| tinyjpeg::TinyJPEGDecoder | decoder_ |
| const char * | errorMessage_ = nullptr |
Decodes baseline JPEG images into a TinyGPU ISurface, using pschatzmann/TinyJPEG (https://github.com/pschatzmann/TinyJPEG) as the underlying decoder.
TinyJPEG is a separate, optional Arduino/CMake library - install it alongside TinyGPU and #include <TinyGPU/IO/JPEGParser.h> explicitly (this header is not pulled in by TinyGPU.h) to opt in to JPEG support.
TinyJPEG streams decoded pixels one MCU block at a time rather than requiring memory for the whole decoded frame, so decode() resizes the target surface once (from the JPEG's own header) and then just fans each block out to setPixel() as it arrives - no intermediate frame buffer beyond the target surface itself.
|
inlineexplicit |
|
inlineprotected |
|
inline |
Decodes a JPEG held entirely in memory into the target surface at (0, 0). Resizes the target surface to the JPEG's own dimensions first.
|
inline |
Decodes a JPEG read from any file-like object (Arduino's fs::File, SD's File, or anything else exposing available()/read()/position()/ seek() - see TinyJPEG's docs/decoding.md) into the target surface at (0, 0). Resizes the target surface to the JPEG's own dimensions first. file is read from its current position and left wherever the decode stopped; this method rewinds to that starting position only between reading the header and decoding the pixels.
|
inline |
Returns the latest error message, if any.
|
inlinestaticprotected |
|
inlineprotected |
|
inline |
Sets the output reduction factor: 1 (full size), 2, 4, or 8.
|
inline |
Overrides the byte-swap behavior set in the constructor (see its comment) - some panels/wiring need the opposite of the true default that's otherwise correct.
|
protected |
|
protected |
|
protected |