renderbug-cpp/src/JsonCoordinateMapping.h

33 lines
940 B
C
Raw Normal View History

#pragma once
#include <Figments.h>
#include <ArduinoJson.h>
struct JsonCoordinateMapping : CoordinateMapping {
struct Span {
int length = 0;
int x = 0;
int y = 0;
2023-12-26 10:29:49 +00:00
bool reverse = false;
uint16_t physicalIdx = 0;
Span() {}
2023-12-26 10:29:49 +00:00
Span(int length, int x, int y, bool rev, uint16_t idx) : length(length), x(x), y(y), reverse(rev), physicalIdx(idx) {}
};
2023-12-26 10:29:49 +00:00
uint8_t rotation = 0;
Span displayMap[32];
int strideCount = 0;
void load(const JsonArray& strides);
void loadDefault();
VirtualCoordinates physicalToVirtualCoords(const PhysicalCoordinates localCoords) const override;
PhysicalCoordinates virtualToPhysicalCoords(const VirtualCoordinates virtualCoords) const override;
int physicalCoordsToIndex(const PhysicalCoordinates localCoords) const override;
unsigned int physicalPixelCount() const override;
2023-12-26 10:29:49 +00:00
VirtualCoordinates rotate(const VirtualCoordinates coords, uint8_t rotation) const;
};