Go to the documentation of this file.
24 #include "../Object.h"
25 #include "../Stream.h"
40 Reader(
const DrawingObject& drawing);
56 uint32_t returnOffset;
57 std::unique_ptr<DrawState> state;
64 template <
typename T>
const T* findAsset(
uint16_t id)
const
66 auto asset = assets.
find<T>(id);
67 if(asset ==
nullptr) {
75 auto id = state.reg.penId;
77 auto asset = findAsset<PenAsset>(
id);
78 if(asset !=
nullptr) {
82 return Pen(state.reg.penColor, state.reg.penWidth);
85 Brush getBrush()
const
87 auto id = state.reg.brushId;
89 auto asset = findAsset(
id);
90 if(asset !=
nullptr) {
91 switch(asset->type()) {
93 return *
reinterpret_cast<const PenAsset*
>(asset);
94 case AssetType::SolidBrush:
95 return reinterpret_cast<const SolidBrush*
>(asset)->color;
96 case AssetType::TextureBrush:
97 return reinterpret_cast<const TextureBrush*
>(asset);
99 debug_e(
"[DRAW] Asset #%u is %s, not compatible with Brush",
id, ::
toString(asset->type()).
c_str());
100 return Pen(state.reg.penColor, state.reg.penWidth);
104 return Brush(state.reg.brushColor);
107 bool read(
void* buffer,
uint8_t count)
109 uint8_t len = cache.
read(streamPos, buffer, count);
114 void seek(uint32_t offset)
119 const DrawingObject& drawing;
120 SubroutineMap subroutines;
124 StackEntry* sub{
nullptr};
126 uint32_t streamPos{0};
128 bool definingSubroutine{
false};
size_t read(uint32_t offset, void *buffer, size_t count)
#define debug_e(fmt,...)
Definition: debug_progmem.h:77
const char * c_str() const
Get a constant (un-modifiable) pointer to String content.
Definition: WString.h:616
Asset * find(AssetID id)
Definition: Asset.h:774
Reader(const DrawingObject &drawing)
AssetList assets
Definition: Libraries/Graphics/src/include/Graphics/Object.h:1228
String toString(OpCode opcode)
An asset is used to render an Object, but is not itself drawable.
Definition: Asset.h:94