FastLED 3.9.15
Loading...
Searching...
No Matches
five_bit_hd_gamma.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <stdint.h>
7
8#include "fl/namespace.h"
9#include "fl/force_inline.h"
10#include "crgb.h"
11
12namespace fl {
13
18
19// Applies gamma correction for the RGBV(8, 8, 8, 5) color space, where
20// the last byte is the brightness byte at 5 bits.
21// To override this five_bit_hd_gamma_bitshift you'll need to define
22// FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE in your build settings
23// then define the function anywhere in your project.
24// Example:
25// FASTLED_NAMESPACE_BEGIN
26// void five_bit_hd_gamma_bitshift(
27// uint8_t r8, uint8_t g8, uint8_t b8,
28// uint8_t r8_scale, uint8_t g8_scale, uint8_t b8_scale,
29// uint8_t* out_r8,
30// uint8_t* out_g8,
31// uint8_t* out_b8,
32// uint8_t* out_power_5bit) {
33// cout << "hello world\n";
34// }
35// FASTLED_NAMESPACE_END
36
38 CRGB colors_scale,
39 uint8_t global_brightness,
40 CRGB* out_colors,
41 uint8_t *out_power_5bit);
42
43
44// Exposed for testing.
45uint8_t five_bit_bitshift(uint16_t r16, uint16_t g16, uint16_t b16, uint8_t brightness, CRGB* out, uint8_t* out_power_5bit);
46
47#ifdef FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE
48// This function is located somewhere else in your project, so it's declared
49// extern here.
50extern void five_bit_hd_gamma_bitshift(CRGB colors,
51 CRGB colors_scale,
52 uint8_t global_brightness,
53 CRGB* out_colors,
54 uint8_t *out_power_5bit);
55#else
58 CRGB colors_scale,
59 uint8_t global_brightness,
60 CRGB* out_colors,
61 uint8_t *out_power_5bit) {
63 colors_scale,
64 global_brightness,
65 out_colors,
66 out_power_5bit);
67}
68#endif // FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE
69
70// Simple gamma correction function that converts from
71// 8-bit color component and converts it to gamma corrected 16-bit
72// color component. Fast and no memory overhead!
73// To override this function you'll need to define
74// FASTLED_FIVE_BIT_HD_GAMMA_BITSHIFT_FUNCTION_OVERRIDE in your build settings
75// and then define your own version anywhere in your project. Example:
76// FASTLED_NAMESPACE_BEGIN
77// void five_bit_hd_gamma_function(
78// uint8_t r8, uint8_t g8, uint8_t b8,
79// uint16_t* r16, uint16_t* g16, uint16_t* b16) {
80// cout << "hello world\n";
81// }
82// FASTLED_NAMESPACE_END
83#ifdef FASTLED_FIVE_BIT_HD_GAMMA_FUNCTION_OVERRIDE
84// This function is located somewhere else in your project, so it's declared
85// extern here.
86extern void five_bit_hd_gamma_function(CRGB color,
87 uint16_t *r16, uint16_t *g16, uint16_t *b16);
88#else
90 uint16_t *r16, uint16_t *g16, uint16_t *b16);
91#endif // FASTLED_FIVE_BIT_HD_GAMMA_FUNCTION_OVERRIDE
92
93} // namespace fl
94
UISlider brightness("Brightness", 255, 0, 255, 1)
Defines the red, green, and blue (RGB) pixel struct.
#define FASTLED_FORCE_INLINE
Definition force_inline.h:7
Implements the FastLED namespace macros.
FiveBitGammaCorrectionMode
@ kFiveBitGammaCorrectionMode_Null
@ kFiveBitGammaCorrectionMode_BitShift
void __builtin_five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)
uint8_t five_bit_bitshift(uint16_t r16, uint16_t g16, uint16_t b16, uint8_t brightness, CRGB *out, uint8_t *out_power_5bit)
void five_bit_hd_gamma_function(CRGB color, uint16_t *r16, uint16_t *g16, uint16_t *b16)
FASTLED_FORCE_INLINE void five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54