39#ifndef FL_COLOR_PROFILE_RUNTIME
41#define FL_COLOR_PROFILE_RUNTIME 0
43#define FL_COLOR_PROFILE_RUNTIME (!FL_PLATFORM_HAS_TINY_MEMORY)
47#if defined(FL_IS_AVR) && FL_COLOR_PROFILE_RUNTIME
48#error "Runtime color profiles are unsupported on AVR"
59#ifndef FL_COLOR_PIPELINE_SHARED
60#define FL_COLOR_PIPELINE_SHARED (FL_COLOR_PROFILE_RUNTIME && FL_PLATFORM_HAS_LARGE_MEMORY)
101#if FL_COLOR_PROFILE_RUNTIME
107#if FL_COLOR_PROFILE_RUNTIME
117#if FL_COLOR_PROFILE_RUNTIME
126#if !FL_COLOR_PROFILE_RUNTIME
134 if (profile.native_code_depth == 0 || profile.native_code_depth > 16 ||
144 (profile.response_lut_size != 0 &&
145 profile.response_lut_white1 ==
nullptr))) ||
149 (profile.response_lut_size != 0 &&
150 profile.response_lut_white2 ==
nullptr))) ||
151 (profile.response_lut_size != 0 &&
152 (profile.response_lut_r ==
nullptr || profile.response_lut_g ==
nullptr || profile.response_lut_b ==
nullptr))) {
164 profile.response_lut_size)) {
170 profile.response_lut_size)) {
192 const bool clearing_legacy =
196 if (!had_profile && clearing_legacy && !mWarnedLegacyCleared) {
197 FL_WARN(
"Color profile clears legacy correction/temperature/gamma");
200 mWarnedLegacyCleared =
true;
209 mColorProfile.
mSource = source;
210 mColorProfile.
mGamut = gamut;
221#if FL_COLOR_PROFILE_RUNTIME
223 mColorProfile.
mSource = source;
230#if FL_COLOR_PROFILE_RUNTIME
243#if FL_COLOR_PROFILE_RUNTIME
244 return mColorProfile.
active();
262 bool isColorManaged() const
FL_NO_EXCEPT {
return false; }
264#if FL_COLOR_PROFILE_RUNTIME
265 return mColorProfile.
profile();
277 FL_STATIC_ASSERT(&Profile ==
nullptr,
"Color profiles require the Channels API on a supported non-AVR platform");
280#if FL_COLOR_PROFILE_RUNTIME
282 options.mColorProfile.mStaticProfile = &Profile;
283 options.mColorProfile.mRequested =
true;
292 return xy[0] > 0.0f &&
xy[0] < 1.0f &&
xy[1] > 0.0f &&
xy[1] < 1.0f &&
293 xy[0] +
xy[1] <= 1.0f;
296 return xy.x > 0.0f &&
xy.x < 1.0f &&
xy.y > 0.0f &&
xy.y < 1.0f &&
304 if (size == 0)
return true;
305 if (values ==
nullptr || size < 2 || values[0] != 0 ||
306 values[size - 1] != 65535)
return false;
307 for (u16 i = 1; i < size; ++i) {
308 if (values[i] < values[i - 1])
return false;
316#if FL_COLOR_PROFILE_RUNTIME
318 FL_WARN(
"Legacy correction/temperature clears color profile");
320 mWarnedProfileCleared =
true;
346 return p !=
nullptr && p->
active();
352 return p !=
nullptr && p->
active();
356#if FL_COLOR_PROFILE_RUNTIME
357 bool mWarnedProfileCleared =
false;
358 bool mWarnedLegacyCleared =
false;
unsigned int xy(unsigned int x, unsigned int y)
Portable compile-time identifiers for LED channel buses.
#define BINARY_DITHER
Enable dithering using binary dithering (only option)
#define DISABLE_DITHER
Disable dithering.
Declares dithering options and types.
@ UncorrectedTemperature
Uncorrected temperature (0xFFFFFF)
@ UncorrectedColor
Uncorrected color (0xFFFFFF)
Determines which platform system definitions to include.
Centralized logging categories for FastLED hardware interfaces and subsystems.
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
constexpr int type_rank< T >::value
void installColorPipelineHooks() FL_NO_EXCEPT
Point the hooks at the real implementations.
void notifyColorProfileClearedByLegacy() FL_NO_EXCEPT
Bus
Portable public bus selector.
Base definition for an LED controller.
Payload shared by every color-profile notification.
Includes defintions for RGB and HSV pixels.
5-channel RGB + warm-W + cool-W (RGBWW / RGBCCT) configuration types (issue #2558,...
#define FL_STATIC_ASSERT(...)
Representation of an 8-bit RGB pixel (Red, Green, Blue)
static ChannelEvents & instance() FL_NO_EXCEPT
fl::function_list< void(const ColorProfileEvent &)> onColorProfileWarning
static bool validPrimaries(const RgbPrimaries &primaries) FL_NO_EXCEPT
bool setColorProfile(const EmitterProfile &profile) FL_NO_EXCEPT
void clearColorProfile() FL_NO_EXCEPT
static bool validChromaticity(Chromaticity xy) FL_NO_EXCEPT
fl::optional< float > mGamma
Rgbww rgbww() const FL_NO_EXCEPT
bool isRgbw() const FL_NO_EXCEPT
True if this channel emits 4-channel RGBW.
void warnProfileCleared() FL_NO_EXCEPT
static bool validResponseLut(const u16 *values, u16 size) FL_NO_EXCEPT
fl::variant< fl::Empty, Rgbw, Rgbww > mWhiteCfg
White-channel selection (variant): Empty = plain RGB, Rgbw = 4-channel, Rgbww = 5-channel.
bool hasColorProfile() const FL_NO_EXCEPT
void setLegacyTemperature(CRGB temperature) FL_NO_EXCEPT
static ChannelOptions withColorProfile() FL_NO_EXCEPT
const EmitterProfile * emitterProfile() const FL_NO_EXCEPT
void setLegacyCorrection(CRGB correction) FL_NO_EXCEPT
static bool validChromaticity(const float xy[2]) FL_NO_EXCEPT
bool hasTargetWhite() const FL_NO_EXCEPT
bool setColorProfile(const EmitterProfile &profile, SourceProfile source, bool global_source, GamutPolicy gamut=GamutPolicy::ChromaCompress) FL_NO_EXCEPT
void requestColorManagement(SourceProfile source=SourceProfile::linearSrgb()) FL_NO_EXCEPT
Rgbw rgbw() const FL_NO_EXCEPT
bool setTargetWhite(Chromaticity white) FL_NO_EXCEPT
FL_DEPRECATED("Ask the channel: Channel::isColorManaged()") bool isColorManaged() const FL_NO_EXCEPT
static bool finitePositive(float value) FL_NO_EXCEPT
bool setColorProfile(const EmitterProfile &profile, SourceProfile source, GamutPolicy gamut=GamutPolicy::ChromaCompress) FL_NO_EXCEPT
Chromaticity targetWhite() const FL_NO_EXCEPT
bool isRgbww() const FL_NO_EXCEPT
True if this channel emits 5-channel RGBWW.
Optional channel configuration parameters All fields have sensible defaults and can be overridden as ...
CIE 1931 xy chromaticity, independent of encoded storage and chipset.
bool mUseGlobalSourceDefault
const EmitterProfile * profile() const FL_NO_EXCEPT
const EmitterProfile * mStaticProfile
fl::shared_ptr< const ColorProfileStorage > mStorage
bool active() const FL_NO_EXCEPT
Immutable profile binding carried by a channel.
FASTLED_FORCE_INLINE bool active() const FL_NO_EXCEPT
static Rgbw value() FL_NO_EXCEPT
FASTLED_FORCE_INLINE bool active() const FL_NO_EXCEPT
static Rgbww value() FL_NO_EXCEPT
static constexpr SourceProfile linearSrgb() FL_NO_EXCEPT
A source declaration, not a container or an output-device selection.