2020-05-08 22:10:49 +02:00
|
|
|
#pragma once
|
2012-08-25 13:19:58 +02:00
|
|
|
|
2020-05-08 22:10:49 +02:00
|
|
|
#include <climits>
|
|
|
|
#include <cstdint>
|
2022-02-09 22:46:07 +01:00
|
|
|
|
|
|
|
#define BLOCK_SIZE 16
|
2012-08-25 13:19:58 +02:00
|
|
|
|
|
|
|
struct PixelAttribute {
|
2022-02-09 22:46:07 +01:00
|
|
|
PixelAttribute() : height(INT16_MIN), thickness(0) {};
|
|
|
|
|
2020-05-08 22:10:49 +02:00
|
|
|
int16_t height;
|
2015-03-18 22:49:19 +01:00
|
|
|
uint8_t thickness;
|
2022-02-09 22:46:07 +01:00
|
|
|
|
|
|
|
inline bool valid_height() const {
|
2020-05-08 22:10:49 +02:00
|
|
|
return height != INT16_MIN;
|
2012-08-25 13:27:40 +02:00
|
|
|
}
|
2012-08-25 13:19:58 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class PixelAttributes
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PixelAttributes();
|
2012-09-01 14:36:14 +02:00
|
|
|
virtual ~PixelAttributes();
|
2022-02-09 22:46:07 +01:00
|
|
|
|
2012-08-25 13:19:58 +02:00
|
|
|
void setWidth(int width);
|
|
|
|
void scroll();
|
2022-02-09 22:46:07 +01:00
|
|
|
|
2020-05-08 22:10:49 +02:00
|
|
|
inline PixelAttribute &attribute(int z, int x) {
|
|
|
|
return m_pixelAttributes[z + 1][x + 1];
|
|
|
|
};
|
2012-08-25 13:19:58 +02:00
|
|
|
|
|
|
|
private:
|
2012-09-01 14:36:14 +02:00
|
|
|
void freeAttributes();
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum Line {
|
|
|
|
FirstLine = 0,
|
|
|
|
LastLine = BLOCK_SIZE,
|
|
|
|
EmptyLine = BLOCK_SIZE + 1,
|
2012-09-01 16:17:58 +02:00
|
|
|
LineCount = BLOCK_SIZE + 2
|
2012-09-01 14:36:14 +02:00
|
|
|
};
|
|
|
|
PixelAttribute *m_pixelAttributes[BLOCK_SIZE + 2]; // 1px gradient + empty
|
|
|
|
int m_width;
|
2012-08-25 13:19:58 +02:00
|
|
|
};
|