mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#pragma once
|
|
#include <SdFat.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
class GfxRenderer;
|
|
|
|
struct ImageDimensions {
|
|
int16_t width;
|
|
int16_t height;
|
|
};
|
|
|
|
struct RenderConfig {
|
|
int x, y;
|
|
int maxWidth, maxHeight;
|
|
bool useGrayscale = true;
|
|
bool useDithering = true;
|
|
bool performanceMode = false;
|
|
std::string cachePath; // If non-empty, decoder will write pixel cache to this path
|
|
};
|
|
|
|
class ImageToFramebufferDecoder {
|
|
public:
|
|
virtual ~ImageToFramebufferDecoder() = default;
|
|
|
|
virtual bool decodeToFramebuffer(const std::string& imagePath, GfxRenderer& renderer, const RenderConfig& config) = 0;
|
|
|
|
virtual bool getDimensions(const std::string& imagePath, ImageDimensions& dims) const = 0;
|
|
|
|
virtual bool supportsFormat(const std::string& extension) const = 0;
|
|
virtual const char* getFormatName() const = 0;
|
|
|
|
protected:
|
|
// Size validation helpers
|
|
static constexpr int MAX_SOURCE_WIDTH = 2048;
|
|
static constexpr int MAX_SOURCE_HEIGHT = 1536;
|
|
|
|
bool validateImageDimensions(int width, int height, const std::string& format);
|
|
void warnUnsupportedFeature(const std::string& feature, const std::string& imagePath);
|
|
}; |