You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.3 KiB
77 lines
2.3 KiB
#ifndef MONOFORMAT_SCHEMA_HPP
|
|
#define MONOFORMAT_SCHEMA_HPP
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <span>
|
|
|
|
namespace monoformat {
|
|
|
|
enum class SectionType {
|
|
AlwaysDrawn = 1,
|
|
TimeBasedDrawn = 2,
|
|
CustomFont = 32,
|
|
};
|
|
|
|
enum class ElementType {
|
|
Image = 1,
|
|
Animation = 2,
|
|
HScrollImage = 3,
|
|
VScrollImage = 4,
|
|
Line = 5,
|
|
ClippedText = 16,
|
|
HScrollText = 17,
|
|
//VScrollText = 18,
|
|
CurrentTime = 32,
|
|
};
|
|
|
|
enum class LineStyle : std::uint8_t {
|
|
Solid = 0,
|
|
};
|
|
|
|
struct OneBitBufferInterface {
|
|
using Color = bool;
|
|
|
|
virtual ~OneBitBufferInterface() = default;
|
|
virtual bool isPixelSet(std::uint16_t x, std::uint16_t y) const = 0;
|
|
virtual void setPixel(std::uint16_t x, std::uint16_t y, bool value) = 0;
|
|
};
|
|
|
|
struct MemoryOneBitBuffer : public OneBitBufferInterface {
|
|
MemoryOneBitBuffer(std::span<std::byte> buffer, std::uint16_t width, std::uint16_t height);
|
|
virtual ~MemoryOneBitBuffer() override;
|
|
virtual bool isPixelSet(std::uint16_t x, std::uint16_t y) const override;
|
|
virtual void setPixel(std::uint16_t x, std::uint16_t y, bool value) override;
|
|
private:
|
|
std::uint16_t m_width{};
|
|
std::uint16_t m_height{};
|
|
std::span<std::byte> m_buffer;
|
|
};
|
|
|
|
struct ConstMemoryOneBitBuffer : public OneBitBufferInterface {
|
|
ConstMemoryOneBitBuffer(std::span<std::byte const> buffer, std::uint16_t width, std::uint16_t height);
|
|
virtual ~ConstMemoryOneBitBuffer() override;
|
|
virtual bool isPixelSet(std::uint16_t x, std::uint16_t y) const override;
|
|
virtual void setPixel(std::uint16_t x, std::uint16_t y, bool value) override;
|
|
private:
|
|
std::uint16_t m_width{};
|
|
std::uint16_t m_height{};
|
|
std::span<std::byte const> m_buffer;
|
|
};
|
|
|
|
struct ClippedImage : public OneBitBufferInterface {
|
|
ClippedImage(OneBitBufferInterface* underlying, std::uint16_t x, std::uint16_t y, std::uint16_t width, std::uint16_t height);
|
|
virtual ~ClippedImage() override;
|
|
virtual bool isPixelSet(std::uint16_t x, std::uint16_t y) const override;
|
|
virtual void setPixel(std::uint16_t x, std::uint16_t y, bool value) override;
|
|
private:
|
|
OneBitBufferInterface* m_underlying{};
|
|
std::uint16_t m_x{};
|
|
std::uint16_t m_y{};
|
|
std::uint16_t m_width{};
|
|
std::uint16_t m_height{};
|
|
};
|
|
|
|
} // namespace monoformat
|
|
|
|
#endif // MONOFORMAT_SCHEMA_HPP
|
|
|