14 int randX = random(-blurRange, blurRange);
15 int randSkip = random(1, blurRange);
19 for (
int j = 0; j < randSkip; j++) {
20 if (randSkip < blurRange / 2 && valid) {
21 colorBuffer[i].
R = (uint16_t)pixelColors[tIndex].B;
22 colorBuffer[i].
G = (uint16_t)pixelColors[tIndex].R;
23 colorBuffer[i].
B = (uint16_t)pixelColors[tIndex].G;
25 colorBuffer[i].
R = (uint16_t)pixelColors[tIndex].R;
26 colorBuffer[i].
G = (uint16_t)pixelColors[tIndex].G;
27 colorBuffer[i].
B = (uint16_t)pixelColors[tIndex].B;
41 pixelColors[i].
R = colorBuffer[i].
R;
42 pixelColors[i].
G = colorBuffer[i].
G;
43 pixelColors[i].
B = colorBuffer[i].
B;
Defines the GlitchX effect class for applying glitch effects along the X-axis to pixel groups.
float ratio
A scaling ratio used for dynamic effect adjustments.
GlitchX(uint8_t pixels)
Constructs a GlitchX effect with a specified number of pixels.
void ApplyEffect(IPixelGroup *pixelGroup) override
Applies the glitch effect along the X-axis to the given pixel group.
const uint8_t pixels
The number of pixels to distort.
Interface for managing and interacting with a collection of pixels.
virtual RGBColor * GetColors()=0
Retrieves the array of colors for the pixel group.
virtual RGBColor * GetColorBuffer()=0
Retrieves the color buffer for the pixel group.
virtual uint16_t GetPixelCount()=0
Retrieves the total number of pixels in the group.
virtual bool GetOffsetXIndex(uint16_t count, uint16_t *index, int x1)=0
Retrieves an offset X-axis index for a given pixel.
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
Represents an RGB color and provides methods for manipulation.
uint8_t B
Blue component of the color (0-255).
uint8_t G
Green component of the color (0-255).
uint8_t R
Red component of the color (0-255).