forked from Makuna/NeoPixelBus
segment example use of NeoDib
This commit is contained in:
@@ -157,7 +157,9 @@ public:
|
||||
}
|
||||
|
||||
template <typename T_SHADER>
|
||||
void Render(NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> destBuffer, T_SHADER& shader, uint16_t startIndex = 0)
|
||||
void Render(NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> destBuffer,
|
||||
T_SHADER& shader,
|
||||
uint16_t startIndex = 0)
|
||||
{
|
||||
uint16_t countPixels = destBuffer.PixelCount;
|
||||
|
||||
@@ -175,7 +177,7 @@ public:
|
||||
|
||||
template <typename T_SHADER>
|
||||
void Render(NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> destBuffer,
|
||||
NeoBufferContext<typename T_BUFFER_METHOD::ColorObject> srcBufferB,
|
||||
const NeoBuffer<T_BUFFER_METHOD>& srcBufferB,
|
||||
T_SHADER& shader,
|
||||
uint16_t startIndex = 0)
|
||||
{
|
||||
@@ -189,7 +191,8 @@ public:
|
||||
for (uint16_t indexPixel = 0; indexPixel < countPixels; indexPixel++)
|
||||
{
|
||||
typename T_BUFFER_METHOD::ColorObject color = _method.GetPixelColor(indexPixel);
|
||||
destBuffer.Pixels[indexPixel + startIndex] = shader.Apply(color, srcBufferB.Pixels[indexPixel]);
|
||||
typename T_BUFFER_METHOD::ColorObject colorB = srcBufferB.GetPixelColor(indexPixel);
|
||||
destBuffer.Pixels[indexPixel + startIndex] = shader.Apply(color, colorB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +212,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
T_BUFFER_METHOD _method;
|
||||
};
|
||||
|
||||
|
@@ -54,6 +54,24 @@ public:
|
||||
_pixels = nullptr;
|
||||
}
|
||||
|
||||
NeoBufferMethod& operator=(const NeoBufferMethod& other)
|
||||
{
|
||||
uint16_t pixelCount = PixelCount();
|
||||
uint16_t pixelCountOther = other.PixelCount();
|
||||
|
||||
if (pixelCount > pixelCountOther)
|
||||
{
|
||||
pixelCount = pixelCountOther;
|
||||
}
|
||||
|
||||
for (size_t index = 0; index < pixelCount; index++)
|
||||
{
|
||||
_pixels[index] = other._pixels[index];
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator NeoBufferContext<T_COLOR_OBJECT>()
|
||||
{
|
||||
return NeoBufferContext<T_COLOR_OBJECT>(Pixels(), PixelCount());
|
||||
|
@@ -25,6 +25,7 @@ License along with NeoPixel. If not, see
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "RgbColorBase.h"
|
||||
#include "SegmentDigit.h"
|
||||
|
||||
//
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
// ending at the decimal point
|
||||
// "abcdefg."
|
||||
// ------------------------------------------------------------------------
|
||||
struct SevenSegDigit
|
||||
struct SevenSegDigit : RgbColorBase
|
||||
{
|
||||
typedef uint8_t ElementType;
|
||||
typedef NeoSevenSegCurrentSettings SettingsObject;
|
||||
@@ -191,6 +191,10 @@ struct SevenSegDigit
|
||||
// ------------------------------------------------------------------------
|
||||
static SevenSegDigit LinearBlend(const SevenSegDigit& left, const SevenSegDigit& right, uint8_t progress);
|
||||
|
||||
static SevenSegDigit PgmRead(PGM_VOID_P pPixelSrc)
|
||||
{
|
||||
return _PgmReadByBytes<SevenSegDigit>(pPixelSrc);
|
||||
}
|
||||
|
||||
uint32_t CalcTotalTenthMilliAmpere(const SettingsObject& settings)
|
||||
{
|
||||
|
Reference in New Issue
Block a user