FastLED 3.10.8
Loading...
Searching...
No Matches

◆ set_input_gamut() [2/4]

void fl::set_input_gamut ( DiodeProfile & profile_ref,
InputGamut g,
const float * white_xy )

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

250 {
251 DiodeProfile* const profile = &profile_ref;
252 auto apply = [profile](const float r[2], const float gp[2],
253 const float b[2], const float w[2]) {
254 profile->input_xy_r[0] = r[0]; profile->input_xy_r[1] = r[1];
255 profile->input_xy_g[0] = gp[0]; profile->input_xy_g[1] = gp[1];
256 profile->input_xy_b[0] = b[0]; profile->input_xy_b[1] = b[1];
257 profile->input_xy_w[0] = w[0]; profile->input_xy_w[1] = w[1];
258 };
259 switch (g) {
260 case InputGamut::Native: {
261 // For Native, the input gamut tracks this profile's LED primaries —
262 // copy them over rather than picking a fixed sRGB-like fallback.
263 const float d65[2] = {0.31272f, 0.32903f};
264 const float* w = (white_xy != nullptr) ? white_xy : d65;
265 apply(profile->xy_r, profile->xy_g, profile->xy_b, w);
267 return;
268 }
270 white_xy != nullptr ? white_xy : kRec709.xy_w);
271 invalidate_colorimetric_caches_for(profile); return;
273 white_xy != nullptr ? white_xy : kRec2020.xy_w);
274 invalidate_colorimetric_caches_for(profile); return;
276 white_xy != nullptr ? white_xy : kDciP3D65.xy_w);
277 invalidate_colorimetric_caches_for(profile); return;
279 white_xy != nullptr ? white_xy : kDciP3D60.xy_w);
280 invalidate_colorimetric_caches_for(profile); return;
281 }
282 // Default-fallthrough for forward-compat with future enum additions:
283 // leave the profile's input_xy_* untouched — also nothing to invalidate.
284}
void invalidate_colorimetric_caches_for(const DiodeProfile *profile) FL_NO_EXCEPT
Definition rgbw.cpp.hpp:623
InputGamut g
Definition rgbw.h:125
float input_xy_b[2]
Definition rgbw.h:71
float xy_g[2]
Definition rgbw.h:59
float input_xy_r[2]
Definition rgbw.h:69
float xy_b[2]
Definition rgbw.h:60
float input_xy_g[2]
Definition rgbw.h:70
float input_xy_w[2]
Definition rgbw.h:72
float xy_r[2]
Definition rgbw.h:58

References DciP3D60, DciP3D65, FL_NO_EXCEPT, g, fl::DiodeProfile::input_xy_b, fl::DiodeProfile::input_xy_g, fl::DiodeProfile::input_xy_r, fl::DiodeProfile::input_xy_w, Native, Rec2020, Rec709, fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_b, fl::DiodeProfile::xy_b, fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_g, fl::DiodeProfile::xy_g, fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_r, fl::DiodeProfile::xy_r, and fl::anonymous_namespace{rgbw.cpp.hpp}::NamedGamut::xy_w.

Referenced by FL_DEPRECATED(), make_diode_profile(), set_input_gamut(), set_input_gamut(), and set_input_gamut().

+ Here is the caller graph for this function: