FastLED 3.10.6
Loading...
Searching...
No Matches

◆ set_input_gamut()

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

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

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