Files
Crosspoint/lib/Epub/Epub/blocks/ImageBlock.h
T

36 lines
949 B
C++

#pragma once
#include <HalStorage.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;
bool hasValidCache() const;
bool needsDecode() const;
void renderPlaceholder(GfxRenderer& renderer, int x, int y) const;
static void clearSessionRenderFailures();
BlockType getType() override { return IMAGE_BLOCK; }
bool isEmpty() override { return false; }
void render(GfxRenderer& renderer, const int x, const int y);
bool serialize(HalFile& file);
static std::unique_ptr<ImageBlock> deserialize(HalFile& file);
private:
std::string imagePath;
int16_t width;
int16_t height;
};