FastLED 3.9.15
Loading...
Searching...
No Matches

◆ set_input_gamut() [2/2]

void fl::set_input_gamut ( DiodeProfile * profile,
InputGamut g,
const float white_xy[2] )

Definition at line 242 of file rgbw.cpp.hpp.

243 {
244 if (profile == nullptr) return;
245 auto apply = [profile](const float r[2], const float gp[2],
246 const float b[2], const float w[2]) {
247 profile->input_xy_r[0] = r[0]; profile->input_xy_r[1] = r[1];
248 profile->input_xy_g[0] = gp[0]; profile->input_xy_g[1] = gp[1];
249 profile->input_xy_b[0] = b[0]; profile->input_xy_b[1] = b[1];
250 profile->input_xy_w[0] = w[0]; profile->input_xy_w[1] = w[1];
251 };
252 switch (g) {
253 case InputGamut::Native: {
254 // For Native, the input gamut tracks this profile's LED primaries —
255 // copy them over rather than picking a fixed sRGB-like fallback.
256 const float d65[2] = {0.31272f, 0.32903f};
257 const float* w = (white_xy != nullptr) ? white_xy : d65;
258 apply(profile->xy_r, profile->xy_g, profile->xy_b, w);
260 return;
261 }
263 white_xy != nullptr ? white_xy : kRec709.xy_w);
264 invalidate_colorimetric_caches_for(profile); return;
266 white_xy != nullptr ? white_xy : kRec2020.xy_w);
267 invalidate_colorimetric_caches_for(profile); return;
269 white_xy != nullptr ? white_xy : kDciP3D65.xy_w);
270 invalidate_colorimetric_caches_for(profile); return;
272 white_xy != nullptr ? white_xy : kDciP3D60.xy_w);
273 invalidate_colorimetric_caches_for(profile); return;
274 }
275 // Default-fallthrough for forward-compat with future enum additions:
276 // leave the profile's input_xy_* untouched — also nothing to invalidate.
277}
void invalidate_colorimetric_caches_for(const DiodeProfile *profile) FL_NOEXCEPT
Definition rgbw.cpp.hpp:503
float input_xy_b[2]
Definition rgbw.h:68
float xy_g[2]
Definition rgbw.h:56
float input_xy_r[2]
Definition rgbw.h:66
float xy_b[2]
Definition rgbw.h:57
float input_xy_g[2]
Definition rgbw.h:67
float input_xy_w[2]
Definition rgbw.h:69
float xy_r[2]
Definition rgbw.h:55

References DciP3D60, DciP3D65, FL_NOEXCEPT, Native, Rec2020, Rec709, fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_b, fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_g, fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_r, and fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_w.

Referenced by set_input_gamut(), CFastLED::setInputGamut(), and CFastLED::setInputGamut().

+ Here is the caller graph for this function: