38 _method(width, height, pixels)
53 return _method.PixelCount();
58 return _method.Width();
63 return _method.Height();
69 typename T_BUFFER_METHOD::ColorObject color)
71 _method.SetPixelColor(
PixelIndex(x, y), color);
78 return _method.GetPixelColor(
PixelIndex(x, y));
81 void ClearTo(
typename T_BUFFER_METHOD::ColorObject color)
83 _method.ClearTo(color);
89 uint16_t destPixelCount = destBuffer.
PixelCount();
91 if (indexPixel >= destPixelCount)
97 uint16_t copyCount = destPixelCount - indexPixel;
99 if (copyCount > srcPixelCount)
101 copyCount = srcPixelCount;
104 uint8_t* pDest = T_BUFFER_METHOD::ColorFeature::getPixelAddress(destBuffer.
Pixels, indexPixel);
105 _method.CopyPixels(pDest, _method.Pixels(), copyCount);
117 uint16_t destPixelCount = destBuffer.
PixelCount();
119 for (int16_t y = 0; y < hSrc; y++)
121 for (int16_t x = 0; x < wSrc; x++)
123 uint16_t indexDest = layoutMap(xDest + x, yDest + y);
125 if (indexDest < destPixelCount)
127 const uint8_t* pSrc = T_BUFFER_METHOD::ColorFeature::getPixelAddress(_method.Pixels(),
PixelIndex(xSrc + x, ySrc + y));
128 uint8_t* pDest = T_BUFFER_METHOD::ColorFeature::getPixelAddress(destBuffer.
Pixels, indexDest);
130 _method.CopyPixels(pDest, pSrc, 1);
141 Blt(destBuffer, xDest, yDest, 0, 0,
Width(),
Height(), layoutMap);
146 uint16_t countPixels = destBuffer.
PixelCount();
148 if (countPixels > _method.PixelCount())
150 countPixels = _method.PixelCount();
153 for (uint16_t indexPixel = 0; indexPixel < countPixels; indexPixel++)
155 const uint8_t* pSrc = T_BUFFER_METHOD::ColorFeature::getPixelAddress(_method.Pixels(), indexPixel);
156 uint8_t* pDest = T_BUFFER_METHOD::ColorFeature::getPixelAddress(destBuffer.
Pixels, indexPixel);
158 shader.Apply(indexPixel, pDest, pSrc);
169 static_cast<uint16_t
>(x) <
Width() &&
171 static_cast<uint16_t
>(y) <
Height())
173 result = x + y *
Width();
179 T_BUFFER_METHOD _method;
std::function< uint16_t(int16_t x, int16_t y)> LayoutMapCallback
Definition: LayoutMapCallback.h:39
const uint16_t PixelIndex_OutOfBounds
Definition: LumitronixIFlexBus.h:33
#define PGM_VOID_P
Definition: NeoUtil.h:42
Definition: NeoBuffer.h:33
void Blt(NeoBufferContext< typename T_BUFFER_METHOD::ColorFeature > destBuffer, int16_t xDest, int16_t yDest, LayoutMapCallback layoutMap)
Definition: NeoBuffer.h:136
uint16_t PixelIndex(int16_t x, int16_t y) const
Definition: NeoBuffer.h:162
uint16_t Height() const
Definition: NeoBuffer.h:61
uint16_t PixelCount() const
Definition: NeoBuffer.h:51
NeoBuffer(uint16_t width, uint16_t height, PGM_VOID_P pixels=nullptr)
Definition: NeoBuffer.h:35
~NeoBuffer()
Definition: NeoBuffer.h:42
void Render(NeoBufferContext< typename T_BUFFER_METHOD::ColorFeature > destBuffer, T_SHADER &shader)
Definition: NeoBuffer.h:144
void SetPixelColor(int16_t x, int16_t y, typename T_BUFFER_METHOD::ColorObject color)
Definition: NeoBuffer.h:66
void Blt(NeoBufferContext< typename T_BUFFER_METHOD::ColorFeature > destBuffer, uint16_t indexPixel)
Definition: NeoBuffer.h:86
T_BUFFER_METHOD::ColorObject GetPixelColor(int16_t x, int16_t y) const
Definition: NeoBuffer.h:74
void Blt(NeoBufferContext< typename T_BUFFER_METHOD::ColorFeature > destBuffer, int16_t xDest, int16_t yDest, int16_t xSrc, int16_t ySrc, int16_t wSrc, int16_t hSrc, LayoutMapCallback layoutMap)
Definition: NeoBuffer.h:108
void ClearTo(typename T_BUFFER_METHOD::ColorObject color)
Definition: NeoBuffer.h:81
uint16_t Width() const
Definition: NeoBuffer.h:56
Definition: NeoBufferContext.h:32
uint8_t * Pixels
Definition: NeoBufferContext.h:43
uint16_t PixelCount() const
Definition: NeoBufferContext.h:40