mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
33 lines
818 B
C++
33 lines
818 B
C++
#pragma once
|
|
#include <SdFat.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "Block.h"
|
|
|
|
class ImageBlock final : public Block {
|
|
public:
|
|
ImageBlock(const std::string& imagePath, int16_t width, int16_t height);
|
|
~ImageBlock() override = default;
|
|
|
|
const std::string& getImagePath() const { return imagePath; }
|
|
int16_t getWidth() const { return width; }
|
|
int16_t getHeight() const { return height; }
|
|
|
|
bool imageExists() const;
|
|
|
|
void layout(GfxRenderer& renderer) override;
|
|
BlockType getType() override { return IMAGE_BLOCK; }
|
|
bool isEmpty() override { return false; }
|
|
|
|
void render(GfxRenderer& renderer, const int x, const int y);
|
|
bool serialize(FsFile& file);
|
|
static std::unique_ptr<ImageBlock> deserialize(FsFile& file);
|
|
|
|
private:
|
|
std::string imagePath;
|
|
int16_t width;
|
|
int16_t height;
|
|
};
|