40#ifndef FL_COLOR_PROFILE_RUNTIME
42#define FL_COLOR_PROFILE_RUNTIME 0
44#define FL_COLOR_PROFILE_RUNTIME (!FL_PLATFORM_HAS_TINY_MEMORY)
48#if defined(FL_IS_AVR) && FL_COLOR_PROFILE_RUNTIME
49#error "Runtime color profiles are unsupported on AVR"
60#ifndef FL_COLOR_PIPELINE_SHARED
61#define FL_COLOR_PIPELINE_SHARED (FL_COLOR_PROFILE_RUNTIME && FL_PLATFORM_HAS_LARGE_MEMORY)
102#if FL_COLOR_PROFILE_RUNTIME
109#if FL_COLOR_PROFILE_RUNTIME
119#if FL_COLOR_PROFILE_RUNTIME
128#if !FL_COLOR_PROFILE_RUNTIME
136 if (profile.native_code_depth == 0 || profile.native_code_depth > 16 ||
146 (profile.response_lut_size != 0 &&
147 profile.response_lut_white1 ==
nullptr))) ||
151 (profile.response_lut_size != 0 &&
152 profile.response_lut_white2 ==
nullptr))) ||
153 (profile.response_lut_size != 0 &&
154 (profile.response_lut_r ==
nullptr || profile.response_lut_g ==
nullptr || profile.response_lut_b ==
nullptr))) {
166 profile.response_lut_size)) {
172 profile.response_lut_size)) {
194 const bool clearing_legacy =
198 if (!had_profile && clearing_legacy && !mWarnedLegacyCleared) {
199 FL_WARN(
"Color profile clears legacy correction/temperature/gamma");
202 mWarnedLegacyCleared =
true;
211 mColorProfile.
mSource = source;
212 mColorProfile.
mGamut = gamut;
223#if FL_COLOR_PROFILE_RUNTIME
225 mColorProfile.
mSource = source;
232#if FL_COLOR_PROFILE_RUNTIME
245#if FL_COLOR_PROFILE_RUNTIME
246 return mColorProfile.
active();
264 bool isColorManaged() const
FL_NO_EXCEPT {
return false; }
266#if FL_COLOR_PROFILE_RUNTIME
267 return mColorProfile.
profile();
279 FL_STATIC_ASSERT(&Profile ==
nullptr,
"Color profiles require the Channels API on a supported non-AVR platform");
282#if FL_COLOR_PROFILE_RUNTIME
284 options.mColorProfile.mStaticProfile = &Profile;
285 options.mColorProfile.mRequested =
true;
294 return xy[0] > 0.0f &&
xy[0] < 1.0f &&
xy[1] > 0.0f &&
xy[1] < 1.0f &&
295 xy[0] +
xy[1] <= 1.0f;
298 return xy.x > 0.0f &&
xy.x < 1.0f &&
xy.y > 0.0f &&
xy.y < 1.0f &&
306 if (size == 0)
return true;
307 if (values ==
nullptr || size < 2 || values[0] != 0 ||
308 values[size - 1] != 65535)
return false;
309 for (u16 i = 1; i < size; ++i) {
310 if (values[i] < values[i - 1])
return false;
318#if FL_COLOR_PROFILE_RUNTIME
320 FL_WARN(
"Legacy correction/temperature clears color profile");
322 mWarnedProfileCleared =
true;
348 return p !=
nullptr && p->
active();
354 return p !=
nullptr && p->
active();
358#if FL_COLOR_PROFILE_RUNTIME
359 bool mWarnedProfileCleared =
false;
360 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.
Shared engine settings, configured before the first transmission.