Skip to content

Commit

Permalink
Use share gamma8 method
Browse files Browse the repository at this point in the history
  • Loading branch information
netmindz committed Oct 21, 2023
1 parent 501c674 commit 4f1e0c3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions usermods/usermod_v2_animartrix/usermod_v2_animartrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ class ANIMartRIXMod:public ANIMartRIX {
setSpeedFactor(speedFactor);
}
void setPixelColor(int x, int y, rgb pixel) {
SEGMENT.setPixelColorXY(x, y, CRGB(
pgm_read_byte(&gamma8[(uint8_t) pixel.red]),
pgm_read_byte(&gamma8[(uint8_t) pixel.green]),
pgm_read_byte(&gamma8[(uint8_t) pixel.blue])
));
SEGMENT.setPixelColorXY(x, y, applyGamma(pixel));
}

CRGB applyGamma(rgb pixel) {
uint8_t r = (uint8_t) pixel.red;
uint8_t g = (uint8_t) pixel.green;
uint8_t b = (uint8_t) pixel.blue;
return CRGB(gamma8(r), gamma8(g), gamma8(b));
}

void setPixelColor(int index, rgb pixel) {
SEGMENT.setPixelColor(index, CRGB(
pgm_read_byte(&gamma8[(uint8_t) pixel.red]),
pgm_read_byte(&gamma8[(uint8_t) pixel.green]),
pgm_read_byte(&gamma8[(uint8_t) pixel.blue])
));
SEGMENT.setPixelColor(index, applyGamma(pixel));
}

// Add any extra custom effects not part of the ANIMartRIX libary here
Expand Down

0 comments on commit 4f1e0c3

Please sign in to comment.