/ lib / JpegToBmpConverter / JpegToBmpConverter.h
JpegToBmpConverter.h
 1  #pragma once
 2  
 3  class FsFile;
 4  class Print;
 5  class ZipFile;
 6  
 7  class JpegToBmpConverter {
 8    static unsigned char jpegReadCallback(unsigned char* pBuf, unsigned char buf_size,
 9                                          unsigned char* pBytes_actually_read, void* pCallback_data);
10    static bool jpegFileToBmpStreamInternal(class FsFile& jpegFile, Print& bmpOut, int targetWidth, int targetHeight,
11                                            bool oneBit, bool quickMode = false);
12  
13   public:
14    static bool jpegFileToBmpStream(FsFile& jpegFile, Print& bmpOut);
15    // Convert with custom target size (for thumbnails)
16    static bool jpegFileToBmpStreamWithSize(FsFile& jpegFile, Print& bmpOut, int targetMaxWidth, int targetMaxHeight);
17    // Convert to 1-bit BMP (black and white only, no grays)
18    static bool jpegFileTo1BitBmpStream(FsFile& jpegFile, Print& bmpOut);
19    // Convert to 1-bit BMP with custom target size (for thumbnails)
20    static bool jpegFileTo1BitBmpStreamWithSize(FsFile& jpegFile, Print& bmpOut, int targetMaxWidth, int targetMaxHeight);
21    // Quick preview mode: simple threshold instead of dithering (faster but lower quality)
22    static bool jpegFileToBmpStreamQuick(FsFile& jpegFile, Print& bmpOut, int targetMaxWidth, int targetMaxHeight);
23  };