FastLED
3.10.6
Loading...
Searching...
No Matches
pixel_format.cpp.hpp
Go to the documentation of this file.
1
// ok no header - implementation for fl/fled/detail/pixel_format.h.
2
3
#include "
fl/fled/detail/pixel_format.h
"
4
5
namespace
fl
{
6
namespace
fled
{
7
8
fl::u8
bytesPerLed
(
fl::u8
pixelFormat)
FL_NO_EXCEPT
{
9
switch
(pixelFormat) {
10
case
static_cast<
fl::u8
>
(
PixelFormat::Rgb8
):
return
3;
11
case
static_cast<
fl::u8
>
(
PixelFormat::Gray8
):
return
1;
12
case
static_cast<
fl::u8
>
(
PixelFormat::Rgba8
):
return
4;
13
case
static_cast<
fl::u8
>
(
PixelFormat::Rgbw8
):
return
4;
14
case
static_cast<
fl::u8
>
(
PixelFormat::Rgb565Le
):
return
2;
15
case
static_cast<
fl::u8
>
(
PixelFormat::Rgb16Linear
):
return
6;
16
default
:
return
0;
17
}
18
}
19
20
bool
toPixelStorage
(
PixelFormat
fledFormat,
PixelStorage
* out)
FL_NO_EXCEPT
{
21
if
(!out) {
22
return
false
;
23
}
24
switch
(fledFormat) {
25
case
PixelFormat::Rgb8
:
26
out->mFormat =
fl::PixelFormat::Rgb8
;
27
out->mComponentByteOrder =
ComponentByteOrder::NotApplicable
;
28
return
true
;
29
case
PixelFormat::Rgb16Linear
:
30
out->mFormat =
fl::PixelFormat::Rgb16
;
31
out->mComponentByteOrder =
ComponentByteOrder::LittleEndian
;
32
return
true
;
33
// Known to the container and carried by `bytesPerLed`, but with no
34
// generic storage descriptor to map onto. Listed rather than swept into a
35
// `default:` so that a *seventh* wire format is a compile error naming
36
// this function instead of a silent `false` discovered at playback --
37
// D1 asks for a checked explicit mapping, and the check is worth more
38
// when the compiler performs it.
39
case
PixelFormat::Gray8
:
40
case
PixelFormat::Rgba8
:
41
case
PixelFormat::Rgbw8
:
42
case
PixelFormat::Rgb565Le
:
43
return
false
;
44
}
45
return
false
;
46
}
47
48
}
// namespace fled
49
}
// namespace fl
pixel_format.h
fl::fled::PixelFormat
PixelFormat
Definition
pixel_format.h:16
fl::fled::PixelFormat::Rgb565Le
@ Rgb565Le
Definition
pixel_format.h:21
fl::fled::PixelFormat::Rgb16Linear
@ Rgb16Linear
Definition
pixel_format.h:22
fl::fled::PixelFormat::Rgba8
@ Rgba8
Definition
pixel_format.h:19
fl::fled::PixelFormat::Rgbw8
@ Rgbw8
Definition
pixel_format.h:20
fl::fled::PixelFormat::Gray8
@ Gray8
Definition
pixel_format.h:18
fl::fled::PixelFormat::Rgb8
@ Rgb8
Definition
pixel_format.h:17
fl::fled::bytesPerLed
fl::u8 bytesPerLed(fl::u8 pixelFormat) FL_NO_EXCEPT
Definition
pixel_format.cpp.hpp:8
fl::fled::toPixelStorage
bool toPixelStorage(PixelFormat fledFormat, PixelStorage *out) FL_NO_EXCEPT
Definition
pixel_format.cpp.hpp:20
fl::fled::ComponentByteOrder::LittleEndian
@ LittleEndian
Definition
pixel_format.h:29
fl::fled::ComponentByteOrder::NotApplicable
@ NotApplicable
Definition
pixel_format.h:28
fl::fled
Definition
builder.cpp.hpp:17
fl::fled::PixelStorage
Definition
pixel_format.h:33
fl::u8
unsigned char u8
Definition
stdint.h:131
fl::FL_NO_EXCEPT
InputGamut g FL_NO_EXCEPT
Definition
rgbw.h:121
fl::PixelFormat::Rgb16
@ Rgb16
Definition
pixel.h:15
fl::PixelFormat::Rgb8
@ Rgb8
Definition
pixel.h:14
fl
Base definition for an LED controller.
Definition
crgb.hpp:179
fl
fled
detail
pixel_format.cpp.hpp
Generated on Sun Oct 4 2026 23:09:00 for FastLED by
1.13.2