SwapPixelColor (#221)

This commit is contained in:
Michael Miller
2018-08-16 12:49:53 -07:00
committed by GitHub
parent e4b47d435e
commit 4959a386f7
2 changed files with 8 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ PixelsSize KEYWORD2
PixelCount KEYWORD2 PixelCount KEYWORD2
SetPixelColor KEYWORD2 SetPixelColor KEYWORD2
GetPixelColor KEYWORD2 GetPixelColor KEYWORD2
SwapPixelColor KEYWORD2
CalculateBrightness KEYWORD2 CalculateBrightness KEYWORD2
Darken KEYWORD2 Darken KEYWORD2
Lighten KEYWORD2 Lighten KEYWORD2

View File

@@ -322,7 +322,14 @@ public:
} }
} }
void SwapPixelColor(uint16_t indexPixelOne, uint16_t indexPixelTwo)
{
auto colorOne = GetPixelColor(indexPixelOne);
auto colorTwo = GetPixelColor(indexPixelTwo);
SetPixelColor(indexPixelOne, colorTwo);
SetPixelColor(indexPixelTwo, colorOne);
};
protected: protected:
const uint16_t _countPixels; // Number of RGB LEDs in strip const uint16_t _countPixels; // Number of RGB LEDs in strip