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

◆ toFledPixelFormat()

bool fl::fled::toFledPixelFormat ( const PixelStorage & storage,
const VideoColor & color,
PixelFormat * out )

Definition at line 289 of file color.cpp.hpp.

290 {
291 if (!out) {
292 return false;
293 }
294 const bool validPrimaries = color.primaries == ColorPrimaries::Bt709 ||
295 color.primaries == ColorPrimaries::DisplayP3 ||
296 color.primaries == ColorPrimaries::Bt2020 ||
297 color.primaries == ColorPrimaries::Custom;
298 const bool validTransfer = color.transfer == ColorTransfer::Srgb ||
299 color.transfer == ColorTransfer::Bt709 ||
300 color.transfer == ColorTransfer::Linear;
301 if (!validPrimaries || !validTransfer || color.matrix != ColorMatrix::Rgb ||
302 color.range != ColorRange::Full) {
303 return false;
304 }
305 if (color.primaries == ColorPrimaries::Custom) {
306 for (fl::size_t i = 0; i < 8; ++i) {
307 const float value = color.customPrimaries[i];
308 if (!(value == value) || value <= 0.0f || value > 1.0f) {
309 return false;
310 }
311 }
312 }
313 switch (storage.mFormat) {
317 return false;
318 }
319 *out = PixelFormat::Rgb8;
320 return true;
324 return false;
325 }
327 return true;
328 default:
329 return false;
330 }
331}
ComponentByteOrder mComponentByteOrder
ColorPrimaries primaries
Definition color.h:85
ColorTransfer transfer
Definition color.h:86
fl::PixelFormat mFormat
float customPrimaries[8]
Definition color.h:92
constexpr int type_rank< T >::value
fl::size_t size_t
Definition s16x16x4.h:62

References Bt2020, Bt709, Custom, DisplayP3, fl::FL_NO_EXCEPT, Full, Linear, LittleEndian, NotApplicable, Rgb, fl::Rgb16, Rgb16Linear, Rgb8, fl::Rgb8, Srgb, and fl::type_rank< T >::value.