FastLED
3.10.6
Loading...
Searching...
No Matches
pixel_format.h
Go to the documentation of this file.
1
#pragma once
2
3
// Public pixel-format boundary for .fled v1 containers. PixelFormat owns
4
// stable serialized wire identifiers; fl::PixelFormat describes generic
5
// storage and deliberately has a separate numeric domain.
6
7
#include "
fl/codec/pixel.h
"
8
#include "
fl/stl/int.h
"
9
#include "
fl/stl/noexcept.h
"
10
11
namespace
fl
{
12
namespace
fled
{
13
14
struct
VideoColor
;
15
16
enum class
PixelFormat
:
fl::u8
{
17
Rgb8
= 0x00,
// 3 bpp - R, G, B
18
Gray8
= 0x01,
// 1 bpp - Y
19
Rgba8
= 0x02,
// 4 bpp - R, G, B, A
20
Rgbw8
= 0x03,
// 4 bpp - R, G, B, W
21
Rgb565Le
= 0x04,
// 2 bpp - little-endian RGB565
22
Rgb16Linear
= 0x05,
// 6 bpp - R, G, B as u16le, linear light
23
};
24
25
// The component byte order travels with generic storage. In particular,
26
// Rgb16 alone never authorizes treating FLED's u16le payload as native words.
27
enum class
ComponentByteOrder
:
fl::u8
{
28
NotApplicable
= 0,
29
LittleEndian
,
30
Native
,
31
};
32
33
struct
PixelStorage
{
34
fl::PixelFormat
mFormat
;
35
ComponentByteOrder
mComponentByteOrder
;
36
};
37
38
// Returns bytes per LED for a v1 pixel-format byte, or zero when the value is
39
// unknown/reserved. Callers must reject zero before reading payload bytes.
40
fl::u8
bytesPerLed
(
fl::u8
pixelFormat)
FL_NO_EXCEPT
;
41
42
// Checked conversion between FLED's wire enum and generic storage. Only
43
// direct RGB storage has a mapping today. The source color declaration is
44
// resolved separately with resolveVideoColor() and must stay paired with this
45
// descriptor through playback or serialization.
46
bool
toPixelStorage
(
PixelFormat
fledFormat,
PixelStorage
* out)
FL_NO_EXCEPT
;
47
bool
toFledPixelFormat
(
const
PixelStorage
& storage,
const
VideoColor
&
color
,
48
PixelFormat
* out)
FL_NO_EXCEPT
;
49
50
}
// namespace fled
51
}
// namespace fl
int.h
fl::color
Definition
rgbw.h:9
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::toFledPixelFormat
bool toFledPixelFormat(const PixelStorage &storage, const VideoColor &color, PixelFormat *out) FL_NO_EXCEPT
Definition
color.cpp.hpp:289
fl::fled::toPixelStorage
bool toPixelStorage(PixelFormat fledFormat, PixelStorage *out) FL_NO_EXCEPT
Definition
pixel_format.cpp.hpp:20
fl::fled::ComponentByteOrder
ComponentByteOrder
Definition
pixel_format.h:27
fl::fled::ComponentByteOrder::LittleEndian
@ LittleEndian
Definition
pixel_format.h:29
fl::fled::ComponentByteOrder::NotApplicable
@ NotApplicable
Definition
pixel_format.h:28
fl::fled::ComponentByteOrder::Native
@ Native
Definition
pixel_format.h:30
fl::fled
Definition
builder.cpp.hpp:17
fl::fled::PixelStorage::mComponentByteOrder
ComponentByteOrder mComponentByteOrder
Definition
pixel_format.h:35
fl::fled::PixelStorage::mFormat
fl::PixelFormat mFormat
Definition
pixel_format.h:34
fl::fled::PixelStorage
Definition
pixel_format.h:33
fl::fled::VideoColor
Definition
color.h:84
fl::u8
unsigned char u8
Definition
stdint.h:131
fl::FL_NO_EXCEPT
InputGamut g FL_NO_EXCEPT
Definition
rgbw.h:121
fl::PixelFormat
PixelFormat
Definition
pixel.h:7
fl
Base definition for an LED controller.
Definition
crgb.hpp:179
noexcept.h
pixel.h
fl
fled
pixel_format.h
Generated on Sun Oct 4 2026 23:09:00 for FastLED by
1.13.2