class documentation
class JPEG(jpegdec.JPEGDecoder):
Constructor: JPEG(screen_width, screen_height, buffer_size, buffer_num)
JPEG decoder for Picoware.
| Method | __del__ |
Clean up decoder resources. |
| Method | __init__ |
Initialize the JPEG decoder with display and buffer settings. |
| Method | draw |
Draw a JPEG file at position (x, y) on the display. |
| Method | draw |
Draw a JPEG image from bytes data into a BytesIO buffer. |
| Method | _cleanup |
Wait for the decoder core and reset the running flag. |
| Method | _decode |
Decode a JPEG from a file, streaming buffers as needed. |
| Method | _get |
Return the decoder option for the given scale factor. |
| Method | _get |
Return (scale, (auto_x, auto_y)) so the image fits the display. |
| Method | _init |
Allocate the file buffer and split it into decode buffers. |
| Method | _read |
Read data from the file into a buffer. |
| Method | _start |
Start decoding a JPEG from the given buffer. |
| Method | _test |
Check which buffers cover the requested data range. |
| Instance Variable | _buffer |
Undocumented |
| Instance Variable | _buffer |
Undocumented |
| Instance Variable | _buffers |
Undocumented |
| Instance Variable | _buffers |
Undocumented |
| Instance Variable | _buffers |
Undocumented |
| Instance Variable | _decoder |
Undocumented |
| Instance Variable | _filebuffer |
Undocumented |
| Instance Variable | _max |
Undocumented |
| Instance Variable | _max |
Undocumented |
def __init__(self, screen_width:
int = 320, screen_height: int = 320, buffer_size: int = 1024 * 8, buffer_num: int = 2):
¶
Initialize the JPEG decoder with display and buffer settings.
| Parameters | |
screenint | Maximum display width. Defaults to 320. |
screenint | Maximum display height. Defaults to 320. |
bufferint | Size of each decode buffer. Defaults to 1024 * 8. |
bufferint | Number of decode buffers. Defaults to 2. |
Draw a JPEG file at position (x, y) on the display.
| Parameters | |
x:int | Horizontal draw position in pixels. |
y:int | Vertical draw position in pixels. |
filestr | Path to the .jpg / .jpeg file. |
| storage | Storage class instance. Defaults to None. |
| Returns | |
bool | True on success, False on failure. |
Draw a JPEG image from bytes data into a BytesIO buffer.
| Parameters | |
x:int | Horizontal draw position in pixels. |
y:int | Vertical draw position in pixels. |
| buf | Bytes data containing the JPEG image. |
| Returns | |
bool | True on success, False on failure. |
Decode a JPEG from a file, streaming buffers as needed.
| Parameters | |
| fi | The file object to read from. |
| fsize | The total file size. |
x:int | Horizontal draw position. |
y:int | Vertical draw position. |
| Returns | |
bool | True on success, False on failure. |
Return the decoder option for the given scale factor.
| Parameters | |
| scale | The scale factor (1, 0.5, 0.25, or 0.125). |
| Returns | |
int | The decoder option value. |
Return (scale, (auto_x, auto_y)) so the image fits the display.
| Parameters | |
w:int | The image width. |
h:int | The image height. |
| Returns | |
tuple[float, tuple[int, int]] | The scale and auto offset. |
Read data from the file into a buffer.
| Parameters | |
| fi | The file object to read from. |
| buf | The buffer to fill. |
Start decoding a JPEG from the given buffer.
| Parameters | |
| fsize | The total file size. |
| buf | The initial buffer data. |
x:int | Horizontal draw position. |
y:int | Vertical draw position. |
| Returns | |
bool | True if decoding started successfully. |