GRB48 Color Feature (#581)

This commit is contained in:
Michael Miller
2022-06-13 10:46:10 -07:00
committed by GitHub
parent 20f2eeb535
commit 65de521c2a
2 changed files with 44 additions and 1 deletions

View File

@@ -33,8 +33,10 @@ NeoRbgFeature KEYWORD1
NeoBgrFeature KEYWORD1 NeoBgrFeature KEYWORD1
NeoRgbw64Feature KEYWORD1 NeoRgbw64Feature KEYWORD1
NeoRgb48Feature KEYWORD1 NeoRgb48Feature KEYWORD1
NeoGrb48Feature KEYWORD1
NeoRgbUcs8903Feature KEYWORD1 NeoRgbUcs8903Feature KEYWORD1
NeoRgbwUcs8904Feature KEYWORD1 NeoRgbwUcs8904Feature KEYWORD1
NeoGrb48Ws2816Feature KEYWORD1
NeoWrgbTm1814Feature KEYWORD1 NeoWrgbTm1814Feature KEYWORD1
NeoRgbTm1914Feature KEYWORD1 NeoRgbTm1914Feature KEYWORD1
NeoGrbTm1914Feature KEYWORD1 NeoGrbTm1914Feature KEYWORD1

View File

@@ -710,4 +710,45 @@ public:
}; };
typedef NeoRgb48Feature NeoRgbUcs8903Feature; typedef NeoRgb48Feature NeoRgbUcs8903Feature;
typedef NeoRgbw64Feature NeoRgbwUcs8904Feature; typedef NeoRgbw64Feature NeoRgbwUcs8904Feature;
class NeoGrb48Feature : public Neo6ByteElementsNoSettings
{
public:
static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
{
uint16_t* p = reinterpret_cast<uint16_t*>(getPixelAddress(pPixels, indexPixel));
*p++ = color.G;
*p++ = color.R;
*p = color.B;
}
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
const uint16_t* p = reinterpret_cast<const uint16_t*>(getPixelAddress(pPixels, indexPixel));
color.G = *p++;
color.R = *p++;
color.B = *p;
return color;
}
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
{
ColorObject color;
const uint16_t* p = reinterpret_cast<const uint16_t*>(getPixelAddress(reinterpret_cast<const uint8_t*>(pPixels), indexPixel));
color.G = pgm_read_word(p++);
color.R = pgm_read_word(p++);
color.B = pgm_read_word(p);
return color;
}
};
typedef NeoGrb48Feature NeoGrbWs2816Feature;