2019-05-10 05:17:29 +00:00
|
|
|
#include "Display.h"
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
Display::pixelCount() const
|
|
|
|
{
|
|
|
|
return m_pixelCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
CRGB*
|
|
|
|
Display::pixelBacking() const
|
|
|
|
{
|
|
|
|
return m_pixels;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Display::clear()
|
|
|
|
{
|
|
|
|
clear(CRGB(0, 0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Display::clear(const CRGB& color)
|
|
|
|
{
|
|
|
|
for(int i = 0; i < m_pixelCount;i++) {
|
|
|
|
m_pixels[i] = color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CRGB&
|
|
|
|
Display::pixelAt(const PhysicalCoordinates coords)
|
|
|
|
{
|
|
|
|
return pixelAt(m_coordMap->physicalCoordsToIndex(coords));
|
|
|
|
}
|
|
|
|
|
|
|
|
CRGB&
|
|
|
|
Display::pixelAt(const VirtualCoordinates coords)
|
|
|
|
{
|
|
|
|
return pixelAt(m_coordMap->virtualToPhysicalCoords(coords));
|
|
|
|
}
|
|
|
|
|
|
|
|
CRGB&
|
|
|
|
Display::pixelAt(int idx)
|
|
|
|
{
|
|
|
|
const int kx = idx % pixelCount();
|
2023-12-11 06:47:11 +00:00
|
|
|
assert(abs(kx) < pixelCount());
|
2019-05-10 05:17:29 +00:00
|
|
|
if (kx < 0) {
|
|
|
|
return m_pixels[pixelCount() + 1 + kx];
|
|
|
|
} else {
|
|
|
|
return m_pixels[kx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const CoordinateMapping*
|
|
|
|
Display::coordinateMapping() const
|
|
|
|
{
|
|
|
|
return m_coordMap;
|
|
|
|
}
|