SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_pixels.h
1#ifndef SDL3PP_PIXELS_H_
2#define SDL3PP_PIXELS_H_
3
4#include <span>
5#include <SDL3/SDL_assert.h>
6#include <SDL3/SDL_pixels.h>
7#include <SDL3/SDL_version.h>
8#include "SDL3pp_spanRef.h"
9#include "SDL3pp_stdinc.h"
10
11namespace SDL {
12
73// Forward decl
74struct Color;
75
76// Forward decl
77struct PaletteRef;
78
79// Forward decl
80struct Palette;
81
91
101
102#ifdef SDL3PP_DOC
103
111#define SDL_ALPHA_OPAQUE 255
112
120#define SDL_ALPHA_OPAQUE_FLOAT 1.0f
121
129#define SDL_ALPHA_TRANSPARENT 0
130
138#define SDL_ALPHA_TRANSPARENT_FLOAT 0.0f
139
140#endif // SDL3PP_DOC
141
152using PixelType = SDL_PixelType;
153
154constexpr PixelType PIXELTYPE_UNKNOWN = SDL_PIXELTYPE_UNKNOWN;
155
156constexpr PixelType PIXELTYPE_INDEX1 = SDL_PIXELTYPE_INDEX1;
157
158constexpr PixelType PIXELTYPE_INDEX4 = SDL_PIXELTYPE_INDEX4;
159
160constexpr PixelType PIXELTYPE_INDEX8 = SDL_PIXELTYPE_INDEX8;
161
162constexpr PixelType PIXELTYPE_PACKED8 = SDL_PIXELTYPE_PACKED8;
163
164constexpr PixelType PIXELTYPE_PACKED16 = SDL_PIXELTYPE_PACKED16;
165
166constexpr PixelType PIXELTYPE_PACKED32 = SDL_PIXELTYPE_PACKED32;
167
168constexpr PixelType PIXELTYPE_ARRAYU8 = SDL_PIXELTYPE_ARRAYU8;
169
170constexpr PixelType PIXELTYPE_ARRAYU16 = SDL_PIXELTYPE_ARRAYU16;
171
172constexpr PixelType PIXELTYPE_ARRAYU32 = SDL_PIXELTYPE_ARRAYU32;
173
174constexpr PixelType PIXELTYPE_ARRAYF16 = SDL_PIXELTYPE_ARRAYF16;
175
176constexpr PixelType PIXELTYPE_ARRAYF32 = SDL_PIXELTYPE_ARRAYF32;
177
178constexpr PixelType PIXELTYPE_INDEX2 = SDL_PIXELTYPE_INDEX2;
179
181
192using BitmapOrder = SDL_BitmapOrder;
193
194constexpr BitmapOrder BITMAPORDER_NONE = SDL_BITMAPORDER_NONE;
195
196constexpr BitmapOrder BITMAPORDER_4321 = SDL_BITMAPORDER_4321;
197
198constexpr BitmapOrder BITMAPORDER_1234 = SDL_BITMAPORDER_1234;
199
201
212using PackedOrder = SDL_PackedOrder;
213
214constexpr PackedOrder PACKEDORDER_NONE = SDL_PACKEDORDER_NONE;
215
216constexpr PackedOrder PACKEDORDER_XRGB = SDL_PACKEDORDER_XRGB;
217
218constexpr PackedOrder PACKEDORDER_RGBX = SDL_PACKEDORDER_RGBX;
219
220constexpr PackedOrder PACKEDORDER_ARGB = SDL_PACKEDORDER_ARGB;
221
222constexpr PackedOrder PACKEDORDER_RGBA = SDL_PACKEDORDER_RGBA;
223
224constexpr PackedOrder PACKEDORDER_XBGR = SDL_PACKEDORDER_XBGR;
225
226constexpr PackedOrder PACKEDORDER_BGRX = SDL_PACKEDORDER_BGRX;
227
228constexpr PackedOrder PACKEDORDER_ABGR = SDL_PACKEDORDER_ABGR;
229
230constexpr PackedOrder PACKEDORDER_BGRA = SDL_PACKEDORDER_BGRA;
231
233
244using ArrayOrder = SDL_ArrayOrder;
245
246constexpr ArrayOrder ARRAYORDER_NONE = SDL_ARRAYORDER_NONE;
247
248constexpr ArrayOrder ARRAYORDER_RGB = SDL_ARRAYORDER_RGB;
249
250constexpr ArrayOrder ARRAYORDER_RGBA = SDL_ARRAYORDER_RGBA;
251
252constexpr ArrayOrder ARRAYORDER_ARGB = SDL_ARRAYORDER_ARGB;
253
254constexpr ArrayOrder ARRAYORDER_BGR = SDL_ARRAYORDER_BGR;
255
256constexpr ArrayOrder ARRAYORDER_BGRA = SDL_ARRAYORDER_BGRA;
257
258constexpr ArrayOrder ARRAYORDER_ABGR = SDL_ARRAYORDER_ABGR;
259
261
272using PackedLayout = SDL_PackedLayout;
273
274constexpr PackedLayout PACKEDLAYOUT_NONE = SDL_PACKEDLAYOUT_NONE;
275
276constexpr PackedLayout PACKEDLAYOUT_332 = SDL_PACKEDLAYOUT_332;
277
278constexpr PackedLayout PACKEDLAYOUT_4444 = SDL_PACKEDLAYOUT_4444;
279
280constexpr PackedLayout PACKEDLAYOUT_1555 = SDL_PACKEDLAYOUT_1555;
281
282constexpr PackedLayout PACKEDLAYOUT_5551 = SDL_PACKEDLAYOUT_5551;
283
284constexpr PackedLayout PACKEDLAYOUT_565 = SDL_PACKEDLAYOUT_565;
285
286constexpr PackedLayout PACKEDLAYOUT_8888 = SDL_PACKEDLAYOUT_8888;
287
289 SDL_PACKEDLAYOUT_2101010;
290
292 SDL_PACKEDLAYOUT_1010102;
293
295
301using PixelFormatDetails = SDL_PixelFormatDetails;
302
303#ifdef SDL3PP_DOC
304
324#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
325
339#define SDL_PIXELFLAG(format) (((format) >> 28) & 0x0F)
340
341#endif // SDL3PP_DOC
342
391{
392 SDL_PixelFormat m_format;
393
394public:
400 constexpr PixelFormat(SDL_PixelFormat format = {})
401 : m_format(format)
402 {
403 }
404
428 constexpr PixelFormat(SDL_PixelType type,
429 int order,
430 SDL_PackedLayout layout,
431 int bits,
432 int bytes)
433 : m_format(SDL_PixelFormat(
434 SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)))
435 {
436 }
437
441 constexpr bool operator==(const PixelFormat& other) const = default;
442
446 constexpr bool operator==(SDL_PixelFormat format) const
447 {
448 return operator==(PixelFormat(format));
449 }
450
456 constexpr operator SDL_PixelFormat() const { return m_format; }
457
463 constexpr explicit operator bool() const { return m_format != 0; }
464
474 constexpr PixelType GetType() const
475 {
476 return PixelType(SDL_PIXELTYPE(m_format));
477 }
478
491 constexpr int GetOrder() const { return SDL_PIXELORDER(m_format); }
492
505 constexpr PackedLayout GetLayout() const
506 {
507 return PackedLayout(SDL_PIXELLAYOUT(m_format));
508 }
509
524 constexpr int GetBitsPerPixel() const { return SDL_BITSPERPIXEL(m_format); }
525
543 constexpr int GetBytesPerPixel() const { return SDL_BYTESPERPIXEL(m_format); }
544
554 constexpr bool IsIndexed() const
555 {
556 return SDL_ISPIXELFORMAT_INDEXED(m_format);
557 }
558
568 constexpr bool IsPacked() const { return SDL_ISPIXELFORMAT_PACKED(m_format); }
569
579 constexpr bool IsArray() const { return SDL_ISPIXELFORMAT_ARRAY(m_format); }
580
590 constexpr bool Is10Bit() const { return SDL_ISPIXELFORMAT_10BIT(m_format); }
591
601 constexpr bool IsFloat() const { return SDL_ISPIXELFORMAT_FLOAT(m_format); }
602
612 constexpr bool IsAlpha() const { return SDL_ISPIXELFORMAT_ALPHA(m_format); }
613
625 constexpr bool IsFourCC() const { return SDL_ISPIXELFORMAT_FOURCC(m_format); }
626
637 const char* GetName() const { return SDL_GetPixelFormatName(m_format); }
638
655 void GetMasks(int* bpp,
656 Uint32* Rmask,
657 Uint32* Gmask,
658 Uint32* Bmask,
659 Uint32* Amask) const
660 {
662 SDL_GetMasksForPixelFormat(m_format, bpp, Rmask, Gmask, Bmask, Amask));
663 }
664
685 static PixelFormat ForMasks(int bpp,
686 Uint32 Rmask,
687 Uint32 Gmask,
688 Uint32 Bmask,
689 Uint32 Amask)
690 {
691 return SDL_GetPixelFormatForMasks(bpp, Rmask, Gmask, Bmask, Amask);
692 }
693
709 {
710 return SDL_GetPixelFormatDetails(m_format);
711 }
712
745 inline Uint32 Map(Color color, PaletteRef palette) const;
746
771 inline Color Get(Uint32 pixel, PaletteRef palette) const;
772};
773
774constexpr SDL_PixelFormat PIXELFORMAT_UNKNOWN =
775 SDL_PIXELFORMAT_UNKNOWN;
776
777constexpr SDL_PixelFormat PIXELFORMAT_INDEX1LSB =
778 SDL_PIXELFORMAT_INDEX1LSB;
779
780constexpr SDL_PixelFormat PIXELFORMAT_INDEX1MSB =
781 SDL_PIXELFORMAT_INDEX1MSB;
782
783constexpr SDL_PixelFormat PIXELFORMAT_INDEX2LSB =
784 SDL_PIXELFORMAT_INDEX2LSB;
785
786constexpr SDL_PixelFormat PIXELFORMAT_INDEX2MSB =
787 SDL_PIXELFORMAT_INDEX2MSB;
788
789constexpr SDL_PixelFormat PIXELFORMAT_INDEX4LSB =
790 SDL_PIXELFORMAT_INDEX4LSB;
791
792constexpr SDL_PixelFormat PIXELFORMAT_INDEX4MSB =
793 SDL_PIXELFORMAT_INDEX4MSB;
794
795constexpr SDL_PixelFormat PIXELFORMAT_INDEX8 =
796 SDL_PIXELFORMAT_INDEX8;
797
798constexpr SDL_PixelFormat PIXELFORMAT_RGB332 =
799 SDL_PIXELFORMAT_RGB332;
800
801constexpr SDL_PixelFormat PIXELFORMAT_XRGB4444 =
802 SDL_PIXELFORMAT_XRGB4444;
803
804constexpr SDL_PixelFormat PIXELFORMAT_XBGR4444 =
805 SDL_PIXELFORMAT_XBGR4444;
806
807constexpr SDL_PixelFormat PIXELFORMAT_XRGB1555 =
808 SDL_PIXELFORMAT_XRGB1555;
809
810constexpr SDL_PixelFormat PIXELFORMAT_XBGR1555 =
811 SDL_PIXELFORMAT_XBGR1555;
812
813constexpr SDL_PixelFormat PIXELFORMAT_ARGB4444 =
814 SDL_PIXELFORMAT_ARGB4444;
815
816constexpr SDL_PixelFormat PIXELFORMAT_RGBA4444 =
817 SDL_PIXELFORMAT_RGBA4444;
818
819constexpr SDL_PixelFormat PIXELFORMAT_ABGR4444 =
820 SDL_PIXELFORMAT_ABGR4444;
821
822constexpr SDL_PixelFormat PIXELFORMAT_BGRA4444 =
823 SDL_PIXELFORMAT_BGRA4444;
824
825constexpr SDL_PixelFormat PIXELFORMAT_ARGB1555 =
826 SDL_PIXELFORMAT_ARGB1555;
827
828constexpr SDL_PixelFormat PIXELFORMAT_RGBA5551 =
829 SDL_PIXELFORMAT_RGBA5551;
830
831constexpr SDL_PixelFormat PIXELFORMAT_ABGR1555 =
832 SDL_PIXELFORMAT_ABGR1555;
833
834constexpr SDL_PixelFormat PIXELFORMAT_BGRA5551 =
835 SDL_PIXELFORMAT_BGRA5551;
836
837constexpr SDL_PixelFormat PIXELFORMAT_RGB565 =
838 SDL_PIXELFORMAT_RGB565;
839
840constexpr SDL_PixelFormat PIXELFORMAT_BGR565 =
841 SDL_PIXELFORMAT_BGR565;
842
843constexpr SDL_PixelFormat PIXELFORMAT_RGB24 = SDL_PIXELFORMAT_RGB24;
844
845constexpr SDL_PixelFormat PIXELFORMAT_BGR24 = SDL_PIXELFORMAT_BGR24;
846
847constexpr SDL_PixelFormat PIXELFORMAT_XRGB8888 =
848 SDL_PIXELFORMAT_XRGB8888;
849
850constexpr SDL_PixelFormat PIXELFORMAT_RGBX8888 =
851 SDL_PIXELFORMAT_RGBX8888;
852
853constexpr SDL_PixelFormat PIXELFORMAT_XBGR8888 =
854 SDL_PIXELFORMAT_XBGR8888;
855
856constexpr SDL_PixelFormat PIXELFORMAT_BGRX8888 =
857 SDL_PIXELFORMAT_BGRX8888;
858
859constexpr SDL_PixelFormat PIXELFORMAT_ARGB8888 =
860 SDL_PIXELFORMAT_ARGB8888;
861
862constexpr SDL_PixelFormat PIXELFORMAT_RGBA8888 =
863 SDL_PIXELFORMAT_RGBA8888;
864
865constexpr SDL_PixelFormat PIXELFORMAT_ABGR8888 =
866 SDL_PIXELFORMAT_ABGR8888;
867
868constexpr SDL_PixelFormat PIXELFORMAT_BGRA8888 =
869 SDL_PIXELFORMAT_BGRA8888;
870
871constexpr SDL_PixelFormat PIXELFORMAT_XRGB2101010 =
872 SDL_PIXELFORMAT_XRGB2101010;
873
874constexpr SDL_PixelFormat PIXELFORMAT_XBGR2101010 =
875 SDL_PIXELFORMAT_XBGR2101010;
876
877constexpr SDL_PixelFormat PIXELFORMAT_ARGB2101010 =
878 SDL_PIXELFORMAT_ARGB2101010;
879
880constexpr SDL_PixelFormat PIXELFORMAT_ABGR2101010 =
881 SDL_PIXELFORMAT_ABGR2101010;
882
883constexpr SDL_PixelFormat PIXELFORMAT_RGB48 = SDL_PIXELFORMAT_RGB48;
884
885constexpr SDL_PixelFormat PIXELFORMAT_BGR48 = SDL_PIXELFORMAT_BGR48;
886
887constexpr SDL_PixelFormat PIXELFORMAT_RGBA64 =
888 SDL_PIXELFORMAT_RGBA64;
889
890constexpr SDL_PixelFormat PIXELFORMAT_ARGB64 =
891 SDL_PIXELFORMAT_ARGB64;
892
893constexpr SDL_PixelFormat PIXELFORMAT_BGRA64 =
894 SDL_PIXELFORMAT_BGRA64;
895
896constexpr SDL_PixelFormat PIXELFORMAT_ABGR64 =
897 SDL_PIXELFORMAT_ABGR64;
898
899constexpr SDL_PixelFormat PIXELFORMAT_RGB48_FLOAT =
900 SDL_PIXELFORMAT_RGB48_FLOAT;
901
902constexpr SDL_PixelFormat PIXELFORMAT_BGR48_FLOAT =
903 SDL_PIXELFORMAT_BGR48_FLOAT;
904
905constexpr SDL_PixelFormat PIXELFORMAT_RGBA64_FLOAT =
906 SDL_PIXELFORMAT_RGBA64_FLOAT;
907
908constexpr SDL_PixelFormat PIXELFORMAT_ARGB64_FLOAT =
909 SDL_PIXELFORMAT_ARGB64_FLOAT;
910
911constexpr SDL_PixelFormat PIXELFORMAT_BGRA64_FLOAT =
912 SDL_PIXELFORMAT_BGRA64_FLOAT;
913
914constexpr SDL_PixelFormat PIXELFORMAT_ABGR64_FLOAT =
915 SDL_PIXELFORMAT_ABGR64_FLOAT;
916
917constexpr SDL_PixelFormat PIXELFORMAT_RGB96_FLOAT =
918 SDL_PIXELFORMAT_RGB96_FLOAT;
919
920constexpr SDL_PixelFormat PIXELFORMAT_BGR96_FLOAT =
921 SDL_PIXELFORMAT_BGR96_FLOAT;
922
923constexpr SDL_PixelFormat PIXELFORMAT_RGBA128_FLOAT =
924 SDL_PIXELFORMAT_RGBA128_FLOAT;
925
926constexpr SDL_PixelFormat PIXELFORMAT_ARGB128_FLOAT =
927 SDL_PIXELFORMAT_ARGB128_FLOAT;
928
929constexpr SDL_PixelFormat PIXELFORMAT_BGRA128_FLOAT =
930 SDL_PIXELFORMAT_BGRA128_FLOAT;
931
932constexpr SDL_PixelFormat PIXELFORMAT_ABGR128_FLOAT =
933 SDL_PIXELFORMAT_ABGR128_FLOAT;
934
935constexpr SDL_PixelFormat PIXELFORMAT_YV12 =
936 SDL_PIXELFORMAT_YV12;
937
938constexpr SDL_PixelFormat PIXELFORMAT_IYUV =
939 SDL_PIXELFORMAT_IYUV;
940
941constexpr SDL_PixelFormat PIXELFORMAT_YUY2 =
942 SDL_PIXELFORMAT_YUY2;
943
944constexpr SDL_PixelFormat PIXELFORMAT_UYVY =
945 SDL_PIXELFORMAT_UYVY;
946
947constexpr SDL_PixelFormat PIXELFORMAT_YVYU =
948 SDL_PIXELFORMAT_YVYU;
949
950constexpr SDL_PixelFormat PIXELFORMAT_NV12 =
951 SDL_PIXELFORMAT_NV12;
952
953constexpr SDL_PixelFormat PIXELFORMAT_NV21 =
954 SDL_PIXELFORMAT_NV21;
955
956constexpr SDL_PixelFormat PIXELFORMAT_P010 =
957 SDL_PIXELFORMAT_P010;
958
959constexpr SDL_PixelFormat PIXELFORMAT_EXTERNAL_OES =
960 SDL_PIXELFORMAT_EXTERNAL_OES;
961
962#if SDL_VERSION_ATLEAST(3, 2, 10)
963
964constexpr SDL_PixelFormat PIXELFORMAT_MJPG =
965 SDL_PIXELFORMAT_MJPG;
966
967#endif // SDL_VERSION_ATLEAST(3, 2, 10)
968
969constexpr SDL_PixelFormat PIXELFORMAT_RGBA32 =
970 SDL_PIXELFORMAT_RGBA32;
971
972constexpr SDL_PixelFormat PIXELFORMAT_ARGB32 =
973 SDL_PIXELFORMAT_ARGB32;
974
975constexpr SDL_PixelFormat PIXELFORMAT_BGRA32 =
976 SDL_PIXELFORMAT_BGRA32;
977
978constexpr SDL_PixelFormat PIXELFORMAT_ABGR32 =
979 SDL_PIXELFORMAT_ABGR32;
980
981constexpr SDL_PixelFormat PIXELFORMAT_RGBX32 =
982 SDL_PIXELFORMAT_RGBX32;
983
984constexpr SDL_PixelFormat PIXELFORMAT_XRGB32 =
985 SDL_PIXELFORMAT_XRGB32;
986
987constexpr SDL_PixelFormat PIXELFORMAT_BGRX32 =
988 SDL_PIXELFORMAT_BGRX32;
989
990constexpr SDL_PixelFormat PIXELFORMAT_XBGR32 =
991 SDL_PIXELFORMAT_XBGR32;
992
994
1005using ColorType = SDL_ColorType;
1006
1008 SDL_COLOR_TYPE_UNKNOWN;
1009
1010constexpr ColorType COLOR_TYPE_RGB = SDL_COLOR_TYPE_RGB;
1011
1013 SDL_COLOR_TYPE_YCBCR;
1014
1016
1028using ColorRange = SDL_ColorRange;
1029
1031 SDL_COLOR_RANGE_UNKNOWN;
1032
1036constexpr ColorRange COLOR_RANGE_LIMITED = SDL_COLOR_RANGE_LIMITED;
1037
1041constexpr ColorRange COLOR_RANGE_FULL = SDL_COLOR_RANGE_FULL;
1042
1044
1056using ColorPrimaries = SDL_ColorPrimaries;
1057
1059 SDL_COLOR_PRIMARIES_UNKNOWN;
1060
1062 SDL_COLOR_PRIMARIES_BT709;
1063
1065 SDL_COLOR_PRIMARIES_UNSPECIFIED;
1066
1068 SDL_COLOR_PRIMARIES_BT470M;
1069
1071 SDL_COLOR_PRIMARIES_BT470BG;
1073
1075 SDL_COLOR_PRIMARIES_BT601;
1076
1081 SDL_COLOR_PRIMARIES_SMPTE240;
1082
1084 SDL_COLOR_PRIMARIES_GENERIC_FILM;
1086
1088 SDL_COLOR_PRIMARIES_BT2020;
1089
1091 SDL_COLOR_PRIMARIES_XYZ;
1092
1094 SDL_COLOR_PRIMARIES_SMPTE431;
1095
1097 SDL_COLOR_PRIMARIES_SMPTE432;
1098
1100 SDL_COLOR_PRIMARIES_EBU3213;
1101
1103 SDL_COLOR_PRIMARIES_CUSTOM;
1104
1106
1119using TransferCharacteristics = SDL_TransferCharacteristics;
1120
1122 SDL_TRANSFER_CHARACTERISTICS_UNKNOWN;
1123
1125 SDL_TRANSFER_CHARACTERISTICS_BT709;
1126
1128 SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED;
1129
1134 SDL_TRANSFER_CHARACTERISTICS_GAMMA22;
1135
1137 SDL_TRANSFER_CHARACTERISTICS_GAMMA28;
1138
1140 SDL_TRANSFER_CHARACTERISTICS_BT601;
1142
1144 SDL_TRANSFER_CHARACTERISTICS_SMPTE240;
1145
1147 SDL_TRANSFER_CHARACTERISTICS_LINEAR;
1148
1150 SDL_TRANSFER_CHARACTERISTICS_LOG100;
1151
1153 SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10;
1154
1156 SDL_TRANSFER_CHARACTERISTICS_IEC61966;
1157
1159 SDL_TRANSFER_CHARACTERISTICS_BT1361;
1160
1162 SDL_TRANSFER_CHARACTERISTICS_SRGB;
1163
1165 SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT;
1167
1169 SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT;
1171
1176 SDL_TRANSFER_CHARACTERISTICS_PQ;
1177
1179 SDL_TRANSFER_CHARACTERISTICS_SMPTE428;
1180
1182 SDL_TRANSFER_CHARACTERISTICS_HLG;
1184
1186 SDL_TRANSFER_CHARACTERISTICS_CUSTOM;
1187
1189
1202using MatrixCoefficients = SDL_MatrixCoefficients;
1203
1205 SDL_MATRIX_COEFFICIENTS_IDENTITY;
1206
1208 SDL_MATRIX_COEFFICIENTS_BT709;
1209
1211 SDL_MATRIX_COEFFICIENTS_UNSPECIFIED;
1212
1214 SDL_MATRIX_COEFFICIENTS_FCC;
1215
1221 SDL_MATRIX_COEFFICIENTS_BT470BG;
1222
1224 SDL_MATRIX_COEFFICIENTS_BT601;
1225
1227 SDL_MATRIX_COEFFICIENTS_SMPTE240;
1228
1230 SDL_MATRIX_COEFFICIENTS_YCGCO;
1231
1233 SDL_MATRIX_COEFFICIENTS_BT2020_NCL;
1235
1237 SDL_MATRIX_COEFFICIENTS_BT2020_CL;
1238
1240 SDL_MATRIX_COEFFICIENTS_SMPTE2085;
1241
1243 SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL;
1244
1246 SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL;
1247
1249 SDL_MATRIX_COEFFICIENTS_ICTCP;
1250
1252 SDL_MATRIX_COEFFICIENTS_CUSTOM;
1253
1255
1266using ChromaLocation = SDL_ChromaLocation;
1267
1269 SDL_CHROMA_LOCATION_NONE;
1270
1276constexpr ChromaLocation CHROMA_LOCATION_LEFT = SDL_CHROMA_LOCATION_LEFT;
1277
1283constexpr ChromaLocation CHROMA_LOCATION_CENTER = SDL_CHROMA_LOCATION_CENTER;
1284
1290constexpr ChromaLocation CHROMA_LOCATION_TOPLEFT = SDL_CHROMA_LOCATION_TOPLEFT;
1291
1293
1318{
1319 SDL_Colorspace m_colorspace;
1320
1321public:
1327 constexpr Colorspace(SDL_Colorspace colorspace = {})
1328 : m_colorspace(colorspace)
1329 {
1330 }
1331
1362 constexpr Colorspace(ColorType type,
1363 ColorRange range,
1364 ColorPrimaries primaries,
1365 TransferCharacteristics transfer,
1366 MatrixCoefficients matrix,
1367 ChromaLocation chroma)
1368 : m_colorspace(SDL_Colorspace(SDL_DEFINE_COLORSPACE(type,
1369 range,
1370 primaries,
1371 transfer,
1372 matrix,
1373 chroma)))
1374 {
1375 }
1376
1380 constexpr bool operator==(const Colorspace& other) const = default;
1381
1385 constexpr bool operator==(SDL_Colorspace colorspace) const
1386 {
1387 return operator==(Colorspace(colorspace));
1388 }
1389
1391
1396 constexpr operator SDL_Colorspace() const { return m_colorspace; }
1397
1403 constexpr explicit operator bool() const { return m_colorspace != 0; }
1404
1414 constexpr ColorType GetType() const
1415 {
1416 return SDL_COLORSPACETYPE(m_colorspace);
1417 }
1418
1428 constexpr ColorRange GetRange() const
1429 {
1430 return SDL_COLORSPACERANGE(m_colorspace);
1431 }
1432
1442 constexpr ChromaLocation GetChroma() const
1443 {
1444 return SDL_COLORSPACECHROMA(m_colorspace);
1445 }
1446
1457 {
1458 return SDL_COLORSPACEPRIMARIES(m_colorspace);
1459 }
1460
1471 {
1472 return SDL_COLORSPACETRANSFER(m_colorspace);
1473 }
1474
1485 {
1486 return SDL_COLORSPACEMATRIX(m_colorspace);
1487 }
1488
1498 constexpr bool IsMatrixBT601() const
1499 {
1500 return SDL_ISCOLORSPACE_MATRIX_BT601(m_colorspace);
1501 }
1502
1512 constexpr bool IsMatrixBT709() const
1513 {
1514 return SDL_ISCOLORSPACE_MATRIX_BT709(m_colorspace);
1515 }
1516
1526 constexpr bool IsMatrixBT2020_NCL() const
1527 {
1528 return SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(m_colorspace);
1529 }
1530
1540 constexpr bool IsLimitedRange() const
1541 {
1542 return SDL_ISCOLORSPACE_LIMITED_RANGE(m_colorspace);
1543 }
1544
1554 constexpr bool IsFullRange() const
1555 {
1556 return SDL_ISCOLORSPACE_FULL_RANGE(m_colorspace);
1557 }
1558};
1559
1560constexpr SDL_Colorspace COLORSPACE_UNKNOWN =
1561 SDL_COLORSPACE_UNKNOWN;
1562
1566constexpr SDL_Colorspace COLORSPACE_SRGB = SDL_COLORSPACE_SRGB;
1567
1568constexpr SDL_Colorspace COLORSPACE_SRGB_LINEAR =
1569 SDL_COLORSPACE_SRGB_LINEAR;
1570
1571constexpr SDL_Colorspace COLORSPACE_HDR10 =
1572 SDL_COLORSPACE_HDR10;
1573
1577constexpr SDL_Colorspace COLORSPACE_JPEG = SDL_COLORSPACE_JPEG;
1578
1582constexpr SDL_Colorspace COLORSPACE_BT601_LIMITED =
1583 SDL_COLORSPACE_BT601_LIMITED;
1584
1588constexpr SDL_Colorspace COLORSPACE_BT601_FULL = SDL_COLORSPACE_BT601_FULL;
1589
1593constexpr SDL_Colorspace COLORSPACE_BT709_LIMITED =
1594 SDL_COLORSPACE_BT709_LIMITED;
1595
1599constexpr SDL_Colorspace COLORSPACE_BT709_FULL = SDL_COLORSPACE_BT709_FULL;
1600
1604constexpr SDL_Colorspace COLORSPACE_BT2020_LIMITED =
1605 SDL_COLORSPACE_BT2020_LIMITED;
1606
1610constexpr SDL_Colorspace COLORSPACE_BT2020_FULL = SDL_COLORSPACE_BT2020_FULL;
1611
1615constexpr SDL_Colorspace COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_RGB_DEFAULT;
1616
1620constexpr SDL_Colorspace COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_YUV_DEFAULT;
1621
1623
1637struct Color : SDL_Color
1638{
1644 constexpr Color(const SDL_Color& color = {})
1645 : SDL_Color(color)
1646 {
1647 }
1648
1657 constexpr Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 255)
1658 : SDL_Color{r, g, b, a}
1659 {
1660 }
1661
1665 constexpr auto operator<=>(const Color& other) const
1666 {
1667 auto c = r <=> other.r;
1668 if (c != std::strong_ordering::equal) return c;
1669 c = g <=> other.g;
1670 if (c != std::strong_ordering::equal) return c;
1671 c = b <=> other.b;
1672 if (c != std::strong_ordering::equal) return c;
1673 return a <=> other.a;
1674 }
1675
1679 constexpr auto operator<=>(const SDL_Color& color) const
1680 {
1681 return operator<=>(Color(color));
1682 }
1689 constexpr Uint8 GetR() const { return r; }
1690
1697 constexpr Color& SetR(Uint8 newR)
1698 {
1699 r = newR;
1700 return *this;
1701 }
1702
1709 constexpr Uint8 GetG() const { return g; }
1710
1717 constexpr Color& SetG(Uint8 newG)
1718 {
1719 g = newG;
1720 return *this;
1721 }
1722
1729 constexpr Uint8 GetB() const { return b; }
1730
1737 constexpr Color& SetB(Uint8 newB)
1738 {
1739 b = newB;
1740 return *this;
1741 }
1742
1749 constexpr Uint8 GetA() const { return a; }
1750
1757 constexpr Color& SetA(Uint8 newA)
1758 {
1759 a = newA;
1760 return *this;
1761 }
1762
1789 Uint32 Map(const PixelFormatDetails& format, PaletteRef palette) const;
1790
1817 static Color Get(Uint32 pixel,
1818 const PixelFormatDetails& format,
1819 PaletteRef palette);
1820};
1821
1832struct FColor : SDL_FColor
1833{
1839 constexpr FColor(const SDL_FColor& color = {})
1840 : SDL_FColor(color)
1841 {
1842 }
1843
1852 constexpr FColor(float r, float g, float b, float a = 1)
1853 : SDL_FColor{r, g, b, a}
1854 {
1855 }
1856
1857
1861 constexpr auto operator<=>(const FColor& other) const
1862 {
1863 auto c = r <=> other.r;
1864 if (c != std::partial_ordering::equivalent) return c;
1865 c = g <=> other.g;
1866 if (c != std::partial_ordering::equivalent) return c;
1867 c = b <=> other.b;
1868 if (c != std::partial_ordering::equivalent) return c;
1869 return a <=> other.a;
1870 }
1871
1875 constexpr auto operator<=>(const SDL_FColor& color) const
1876 {
1877 return operator<=>(FColor(color));
1878 }
1885 constexpr float GetR() const { return r; }
1886
1893 constexpr FColor& SetR(float newR)
1894 {
1895 r = newR;
1896 return *this;
1897 }
1898
1905 constexpr float GetG() const { return g; }
1906
1913 constexpr FColor& SetG(float newG)
1914 {
1915 g = newG;
1916 return *this;
1917 }
1918
1925 constexpr float GetB() const { return b; }
1926
1933 constexpr FColor& SetB(float newB)
1934 {
1935 b = newB;
1936 return *this;
1937 }
1938
1945 constexpr float GetA() const { return a; }
1946
1953 constexpr FColor& SetA(float newA)
1954 {
1955 a = newA;
1956 return *this;
1957 }
1958};
1959
1970struct PaletteRef : Resource<SDL_Palette*>
1971{
1972 using Resource::Resource;
1973
1975 constexpr int GetSize() const { return get()->ncolors; }
1976
1978 constexpr Color operator[](int index) const { return get()->colors[index]; }
1979
1992 void SetColors(SpanRef<const SDL_Color> colors, int firstcolor = 0)
1993 {
1994 CheckError(
1995 SDL_SetPaletteColors(get(), colors.data(), firstcolor, colors.size()));
1996 }
1997
2010 static void reset(SDL_Palette* resource) { SDL_DestroyPalette(resource); }
2011};
2012
2020struct Palette : ResourceUnique<PaletteRef>
2021{
2023
2041 static Palette Create(int ncolors)
2042 {
2043 return Palette(CheckError(SDL_CreatePalette(ncolors)));
2044 }
2045
2055 void Destroy() { reset(); }
2060};
2061
2063{
2064 return PaletteShared(std::move(*this));
2065}
2066
2076struct PaletteUnsafe : ResourceUnsafe<PaletteRef>
2077{
2079
2083 constexpr explicit PaletteUnsafe(Palette&& other)
2084 : PaletteUnsafe(other.release())
2085 {
2086 }
2087};
2088
2125inline Uint32 MapRGB(const PixelFormatDetails& format,
2126 PaletteRef palette,
2127 Uint8 r,
2128 Uint8 g,
2129 Uint8 b)
2130{
2131 return SDL_MapRGB(&format, palette, r, g, b);
2132}
2133
2171inline Uint32 MapRGBA(const PixelFormatDetails& format,
2172 PaletteRef palette,
2173 Uint8 r,
2174 Uint8 g,
2175 Uint8 b,
2176 Uint8 a)
2177{
2178 return SDL_MapRGBA(&format, palette, r, g, b, a);
2179}
2180
2207inline void GetRGB(Uint32 pixel,
2208 const PixelFormatDetails& format,
2209 PaletteRef palette,
2210 Uint8* r,
2211 Uint8* g,
2212 Uint8* b)
2213{
2214 SDL_GetRGB(pixel, &format, palette, r, g, b);
2215}
2216
2247inline void GetRGBA(Uint32 pixel,
2248 const PixelFormatDetails& format,
2249 PaletteRef palette,
2250 Uint8* r,
2251 Uint8* g,
2252 Uint8* b,
2253 Uint8* a)
2254{
2255 SDL_GetRGBA(pixel, &format, palette, r, g, b, a);
2256}
2257
2260#pragma region impl
2261
2262inline Uint32 Color::Map(const PixelFormatDetails& format,
2263 PaletteRef palette = nullptr) const
2264{
2265 return MapRGBA(format, palette.get(), r, g, b, a);
2266}
2267
2268inline Color Color::Get(Uint32 pixel,
2269 const PixelFormatDetails& format,
2270 PaletteRef palette = nullptr)
2271{
2272 Color c;
2273 GetRGBA(pixel, format, palette, &c.r, &c.g, &c.b, &c.a);
2274 return c;
2275}
2276
2277inline Uint32 PixelFormat::Map(Color color, PaletteRef palette = nullptr) const
2278{
2279 return color.Map(*GetDetails(), palette);
2280}
2281
2282inline Color PixelFormat::Get(Uint32 pixel, PaletteRef palette = nullptr) const
2283{
2284 return Color::Get(pixel, *GetDetails(), palette);
2285}
2286
2287#pragma endregion impl
2288
2289} // namespace SDL
2290
2291#endif /* SDL3PP_PIXELS_H_ */
Colorspace definitions.
Definition SDL3pp_pixels.h:1318
constexpr bool IsMatrixBT709() const
Determine if an Colorspace uses BT709 matrix coefficients.
Definition SDL3pp_pixels.h:1512
constexpr ColorType GetType() const
Retrieve the type of a Colorspace.
Definition SDL3pp_pixels.h:1414
constexpr Colorspace(ColorType type, ColorRange range, ColorPrimaries primaries, TransferCharacteristics transfer, MatrixCoefficients matrix, ChromaLocation chroma)
Define custom Colorspace formats.
Definition SDL3pp_pixels.h:1362
constexpr TransferCharacteristics GetTransfer() const
Retrieve the transfer characteristics of an Colorspace.
Definition SDL3pp_pixels.h:1470
constexpr ChromaLocation GetChroma() const
Retrieve the chroma sample location of an Colorspace.
Definition SDL3pp_pixels.h:1442
constexpr ColorPrimaries GetPrimaries() const
Retrieve the primaries of an Colorspace.
Definition SDL3pp_pixels.h:1456
constexpr bool IsMatrixBT2020_NCL() const
Determine if an Colorspace uses BT2020_NCL matrix coefficients.
Definition SDL3pp_pixels.h:1526
constexpr bool IsMatrixBT601() const
Determine if a Colorspace uses BT601 (or BT470BG) matrix coefficients.
Definition SDL3pp_pixels.h:1498
constexpr bool operator==(const Colorspace &other) const =default
Default comparison operator.
constexpr MatrixCoefficients GetMatrix() const
Retrieve the matrix coefficients of an Colorspace.
Definition SDL3pp_pixels.h:1484
constexpr Colorspace(SDL_Colorspace colorspace={})
Wraps Colorspace.
Definition SDL3pp_pixels.h:1327
constexpr bool IsFullRange() const
A function to determine if an Colorspace has a full range.
Definition SDL3pp_pixels.h:1554
constexpr bool operator==(SDL_Colorspace colorspace) const
Compares with the underlying type.
Definition SDL3pp_pixels.h:1385
constexpr bool IsLimitedRange() const
A function to determine if an Colorspace has a limited range.
Definition SDL3pp_pixels.h:1540
constexpr ColorRange GetRange() const
Retrieve the range of a Colorspace.
Definition SDL3pp_pixels.h:1428
Pixel format.
Definition SDL3pp_pixels.h:391
constexpr PixelFormat(SDL_PixelType type, int order, SDL_PackedLayout layout, int bits, int bytes)
Defining custom non-FourCC pixel formats.
Definition SDL3pp_pixels.h:428
const char * GetName() const
Get the human readable name of a pixel format.
Definition SDL3pp_pixels.h:637
const PixelFormatDetails * GetDetails() const
Create an PixelFormatDetails structure corresponding to a pixel format.
Definition SDL3pp_pixels.h:708
constexpr bool operator==(SDL_PixelFormat format) const
Compares with the underlying type.
Definition SDL3pp_pixels.h:446
Uint32 Map(Color color, PaletteRef palette) const
Map an RGBA quadruple to a pixel value for a given pixel format.
Definition SDL3pp_pixels.h:2277
constexpr bool Is10Bit() const
Determine if this is a 10-bit format.
Definition SDL3pp_pixels.h:590
constexpr bool IsIndexed() const
Determine if this is an indexed format.
Definition SDL3pp_pixels.h:554
constexpr bool IsFloat() const
Determine if this is a floating point format.
Definition SDL3pp_pixels.h:601
constexpr bool IsPacked() const
Determine if this is a packed format.
Definition SDL3pp_pixels.h:568
constexpr PackedLayout GetLayout() const
Retrieve the layout.
Definition SDL3pp_pixels.h:505
constexpr bool IsFourCC() const
Determine if this is a "FourCC" format.
Definition SDL3pp_pixels.h:625
constexpr int GetOrder() const
Retrieve the order.
Definition SDL3pp_pixels.h:491
Color Get(Uint32 pixel, PaletteRef palette) const
Get RGBA values from a pixel in the specified format.
Definition SDL3pp_pixels.h:2282
constexpr bool IsArray() const
Determine if this is an array format.
Definition SDL3pp_pixels.h:579
constexpr bool operator==(const PixelFormat &other) const =default
Default comparison operator.
constexpr int GetBytesPerPixel() const
Determine this's bytes per pixel.
Definition SDL3pp_pixels.h:543
constexpr bool IsAlpha() const
Determine if this has an alpha channel.
Definition SDL3pp_pixels.h:612
constexpr PixelType GetType() const
Retrieve the type.
Definition SDL3pp_pixels.h:474
static PixelFormat ForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
Convert a bpp value and RGBA masks to an enumerated pixel format.
Definition SDL3pp_pixels.h:685
constexpr int GetBitsPerPixel() const
Determine this's bits per pixel.
Definition SDL3pp_pixels.h:524
constexpr PixelFormat(SDL_PixelFormat format={})
Wraps PixelFormat.
Definition SDL3pp_pixels.h:400
void GetMasks(int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask) const
Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
Definition SDL3pp_pixels.h:655
RESOURCE release()
Returns reference and reset this.
Definition SDL3pp_resource.h:178
Implement shared ownership for a resource.
Definition SDL3pp_resource.h:283
Implement unique ownership for a resource.
Definition SDL3pp_resource.h:226
constexpr ResourceUnique(std::nullptr_t=nullptr)
Default constructor.
Definition SDL3pp_resource.h:231
void reset()
Resets the value, destroying the resource if not nullptr.
Definition SDL3pp_resource.h:265
A dumb pointer to resource.
Definition SDL3pp_resource.h:197
constexpr ResourceUnsafe()=default
Default constructor.
Implement weak ownership for a resource.
Definition SDL3pp_resource.h:328
A SDL managed resource.
Definition SDL3pp_resource.h:29
constexpr Resource(T resource={})
Constructs from the underlying resource.
Definition SDL3pp_resource.h:37
constexpr SDL_Palette * get() const
Return contained resource;.
Definition SDL3pp_resource.h:76
span-like for empty-derived structs
Definition SDL3pp_spanRef.h:24
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:206
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_FCC
US FCC Title 47.
Definition SDL3pp_pixels.h:1213
constexpr SDL_PixelFormat PIXELFORMAT_RGBA4444
RGBA4444.
Definition SDL3pp_pixels.h:816
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_SMPTE240
SMPTE 240M.
Definition SDL3pp_pixels.h:1226
constexpr ColorPrimaries COLOR_PRIMARIES_UNSPECIFIED
COLOR_PRIMARIES_UNSPECIFIED.
Definition SDL3pp_pixels.h:1064
constexpr ColorPrimaries COLOR_PRIMARIES_BT709
ITU-R BT.709-6.
Definition SDL3pp_pixels.h:1061
constexpr PixelType PIXELTYPE_PACKED8
PACKED8.
Definition SDL3pp_pixels.h:162
constexpr PackedLayout PACKEDLAYOUT_1555
1555
Definition SDL3pp_pixels.h:280
constexpr SDL_PixelFormat PIXELFORMAT_ABGR64
ABGR64.
Definition SDL3pp_pixels.h:896
constexpr SDL_PixelFormat PIXELFORMAT_XBGR4444
XBGR4444.
Definition SDL3pp_pixels.h:804
constexpr SDL_Colorspace COLORSPACE_RGB_DEFAULT
The default colorspace for RGB surfaces if no colorspace is specified.
Definition SDL3pp_pixels.h:1615
constexpr SDL_PixelFormat PIXELFORMAT_RGB332
RGB332.
Definition SDL3pp_pixels.h:798
constexpr SDL_Colorspace COLORSPACE_BT709_FULL
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709.
Definition SDL3pp_pixels.h:1599
constexpr PixelType PIXELTYPE_ARRAYF32
ARRAYF32.
Definition SDL3pp_pixels.h:176
constexpr SDL_PixelFormat PIXELFORMAT_BGRX8888
BGRX8888.
Definition SDL3pp_pixels.h:856
ResourceShared< Palette > PaletteShared
Handle to a shared palette.
Definition SDL3pp_pixels.h:90
constexpr ColorRange COLOR_RANGE_LIMITED
Narrow range, e.g.
Definition SDL3pp_pixels.h:1036
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_SMPTE240
SMPTE ST 240M.
Definition SDL3pp_pixels.h:1143
constexpr PackedLayout PACKEDLAYOUT_1010102
1010102
Definition SDL3pp_pixels.h:291
constexpr SDL_PixelFormat PIXELFORMAT_RGB48_FLOAT
RGB48_FLOAT.
Definition SDL3pp_pixels.h:899
constexpr SDL_PixelFormat PIXELFORMAT_ARGB8888
ARGB8888.
Definition SDL3pp_pixels.h:859
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_BT2020_12BIT
ITU-R BT2020 for 12-bit system.
Definition SDL3pp_pixels.h:1168
constexpr ArrayOrder ARRAYORDER_RGB
RGB.
Definition SDL3pp_pixels.h:248
SDL_PackedLayout PackedLayout
Packed component layout.
Definition SDL3pp_pixels.h:272
SDL_ArrayOrder ArrayOrder
Array component order, low byte -> high byte.
Definition SDL3pp_pixels.h:244
constexpr SDL_PixelFormat PIXELFORMAT_BGRA64
BGRA64.
Definition SDL3pp_pixels.h:893
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_UNSPECIFIED
MATRIX_COEFFICIENTS_UNSPECIFIED.
Definition SDL3pp_pixels.h:1210
constexpr SDL_PixelFormat PIXELFORMAT_XBGR1555
XBGR1555.
Definition SDL3pp_pixels.h:810
constexpr SDL_PixelFormat PIXELFORMAT_RGBA5551
RGBA5551.
Definition SDL3pp_pixels.h:828
PaletteShared share()
Move this palette into a PaletteShared.
Definition SDL3pp_pixels.h:2062
constexpr SDL_PixelFormat PIXELFORMAT_IYUV
Planar mode: Y + U + V (3 planes)
Definition SDL3pp_pixels.h:938
constexpr SDL_PixelFormat PIXELFORMAT_RGBA128_FLOAT
RGBA128_FLOAT.
Definition SDL3pp_pixels.h:923
constexpr PixelType PIXELTYPE_PACKED32
PACKED32.
Definition SDL3pp_pixels.h:166
constexpr PixelType PIXELTYPE_ARRAYF16
ARRAYF16.
Definition SDL3pp_pixels.h:174
SDL_ColorPrimaries ColorPrimaries
Colorspace color primaries, as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en.
Definition SDL3pp_pixels.h:1056
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_SMPTE2085
SMPTE ST 2085.
Definition SDL3pp_pixels.h:1239
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_ICTCP
ITU-R BT.2100-0 ICTCP.
Definition SDL3pp_pixels.h:1248
constexpr SDL_PixelFormat PIXELFORMAT_BGRA64_FLOAT
BGRA64_FLOAT.
Definition SDL3pp_pixels.h:911
constexpr SDL_PixelFormat PIXELFORMAT_P010
Planar mode: Y + U/V interleaved (2 planes)
Definition SDL3pp_pixels.h:956
SDL_ChromaLocation ChromaLocation
Colorspace chroma sample location.
Definition SDL3pp_pixels.h:1266
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_LOG100
TRANSFER_CHARACTERISTICS_LOG100.
Definition SDL3pp_pixels.h:1149
constexpr ColorType COLOR_TYPE_YCBCR
COLOR_TYPE_YCBCR.
Definition SDL3pp_pixels.h:1012
constexpr SDL_PixelFormat PIXELFORMAT_UYVY
Packed mode: U0+Y0+V0+Y1 (1 plane)
Definition SDL3pp_pixels.h:944
constexpr SDL_PixelFormat PIXELFORMAT_YUY2
Packed mode: Y0+U0+Y1+V0 (1 plane)
Definition SDL3pp_pixels.h:941
constexpr SDL_PixelFormat PIXELFORMAT_XRGB1555
XRGB1555.
Definition SDL3pp_pixels.h:807
constexpr SDL_PixelFormat PIXELFORMAT_XRGB32
XRGB32.
Definition SDL3pp_pixels.h:984
constexpr SDL_PixelFormat PIXELFORMAT_ABGR32
ABGR32.
Definition SDL3pp_pixels.h:978
constexpr ColorPrimaries COLOR_PRIMARIES_UNKNOWN
COLOR_PRIMARIES_UNKNOWN.
Definition SDL3pp_pixels.h:1058
constexpr SDL_Colorspace COLORSPACE_HDR10
[object Object]
Definition SDL3pp_pixels.h:1571
constexpr BitmapOrder BITMAPORDER_1234
1234
Definition SDL3pp_pixels.h:198
void GetRGB(Uint32 pixel, const PixelFormatDetails &format, PaletteRef palette, Uint8 *r, Uint8 *g, Uint8 *b)
Get RGB values from a pixel in the specified format.
Definition SDL3pp_pixels.h:2207
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_BT601
SMPTE ST 170M / ITU-R BT.601-7 525 or.
Definition SDL3pp_pixels.h:1139
constexpr SDL_PixelFormat PIXELFORMAT_RGB48
RGB48.
Definition SDL3pp_pixels.h:883
constexpr PackedLayout PACKEDLAYOUT_565
565
Definition SDL3pp_pixels.h:284
constexpr SDL_PixelFormat PIXELFORMAT_ARGB32
ARGB32.
Definition SDL3pp_pixels.h:972
constexpr SDL_PixelFormat PIXELFORMAT_RGBA64
RGBA64.
Definition SDL3pp_pixels.h:887
constexpr SDL_PixelFormat PIXELFORMAT_BGR48_FLOAT
BGR48_FLOAT.
Definition SDL3pp_pixels.h:902
constexpr PackedOrder PACKEDORDER_BGRA
BGRA.
Definition SDL3pp_pixels.h:230
Uint32 MapRGB(const PixelFormatDetails &format, PaletteRef palette, Uint8 r, Uint8 g, Uint8 b)
Map an RGB triple to an opaque pixel value for a given pixel format.
Definition SDL3pp_pixels.h:2125
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL
MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL.
Definition SDL3pp_pixels.h:1245
constexpr SDL_Colorspace COLORSPACE_SRGB
Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709.
Definition SDL3pp_pixels.h:1566
constexpr SDL_PixelFormat PIXELFORMAT_INDEX4LSB
INDEX4LSB.
Definition SDL3pp_pixels.h:789
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_SMPTE428
SMPTE ST 428-1.
Definition SDL3pp_pixels.h:1178
constexpr SDL_PixelFormat PIXELFORMAT_XRGB2101010
XRGB2101010.
Definition SDL3pp_pixels.h:871
constexpr SDL_Colorspace COLORSPACE_BT601_LIMITED
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601.
Definition SDL3pp_pixels.h:1582
constexpr ChromaLocation CHROMA_LOCATION_TOPLEFT
In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the sam...
Definition SDL3pp_pixels.h:1290
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_GAMMA22
ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM.
Definition SDL3pp_pixels.h:1133
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_BT2020_NCL
ITU-R BT.2020-2 non-constant luminance.
Definition SDL3pp_pixels.h:1232
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_BT470BG
ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as MATRIX_COEFFICIENTS_BT601.
Definition SDL3pp_pixels.h:1220
SDL_TransferCharacteristics TransferCharacteristics
Colorspace transfer characteristics.
Definition SDL3pp_pixels.h:1119
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_SRGB
IEC 61966-2-1 (sRGB or sYCC)
Definition SDL3pp_pixels.h:1161
constexpr ColorPrimaries COLOR_PRIMARIES_BT470BG
ITU-R BT.470-6 System B, G / ITU-R BT.601-7.
Definition SDL3pp_pixels.h:1070
constexpr ArrayOrder ARRAYORDER_NONE
NONE.
Definition SDL3pp_pixels.h:246
constexpr PackedOrder PACKEDORDER_ARGB
ARGB.
Definition SDL3pp_pixels.h:220
constexpr SDL_PixelFormat PIXELFORMAT_ABGR64_FLOAT
ABGR64_FLOAT.
Definition SDL3pp_pixels.h:914
constexpr SDL_PixelFormat PIXELFORMAT_INDEX2LSB
INDEX2LSB.
Definition SDL3pp_pixels.h:783
constexpr SDL_PixelFormat PIXELFORMAT_ARGB64
ARGB64.
Definition SDL3pp_pixels.h:890
constexpr ChromaLocation CHROMA_LOCATION_LEFT
In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square.
Definition SDL3pp_pixels.h:1276
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_BT2020_CL
ITU-R BT.2020-2 constant luminance.
Definition SDL3pp_pixels.h:1236
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_HLG
ARIB STD-B67, known as "hybrid log-gamma" (HLG)
Definition SDL3pp_pixels.h:1181
constexpr PackedLayout PACKEDLAYOUT_NONE
NONE.
Definition SDL3pp_pixels.h:274
constexpr SDL_PixelFormat PIXELFORMAT_INDEX2MSB
INDEX2MSB.
Definition SDL3pp_pixels.h:786
constexpr PixelType PIXELTYPE_ARRAYU16
ARRAYU16.
Definition SDL3pp_pixels.h:170
constexpr SDL_PixelFormat PIXELFORMAT_BGRA8888
BGRA8888.
Definition SDL3pp_pixels.h:868
constexpr ColorType COLOR_TYPE_UNKNOWN
COLOR_TYPE_UNKNOWN.
Definition SDL3pp_pixels.h:1007
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_BT709
ITU-R BT.709-6.
Definition SDL3pp_pixels.h:1207
constexpr SDL_PixelFormat PIXELFORMAT_XBGR8888
XBGR8888.
Definition SDL3pp_pixels.h:853
constexpr PackedOrder PACKEDORDER_RGBX
RGBX.
Definition SDL3pp_pixels.h:218
constexpr SDL_PixelFormat PIXELFORMAT_NV12
Planar mode: Y + U/V interleaved (2 planes)
Definition SDL3pp_pixels.h:950
constexpr SDL_PixelFormat PIXELFORMAT_MJPG
Motion JPEG.
Definition SDL3pp_pixels.h:964
constexpr PackedLayout PACKEDLAYOUT_4444
4444
Definition SDL3pp_pixels.h:278
constexpr SDL_PixelFormat PIXELFORMAT_XBGR32
XBGR32.
Definition SDL3pp_pixels.h:990
SDL_ColorRange ColorRange
Colorspace color range, as described by https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en.
Definition SDL3pp_pixels.h:1028
constexpr SDL_Colorspace COLORSPACE_BT601_FULL
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601.
Definition SDL3pp_pixels.h:1588
constexpr PixelType PIXELTYPE_UNKNOWN
UNKNOWN.
Definition SDL3pp_pixels.h:154
constexpr SDL_PixelFormat PIXELFORMAT_ABGR128_FLOAT
ABGR128_FLOAT.
Definition SDL3pp_pixels.h:932
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_BT601
ITU-R BT.601-7 525.
Definition SDL3pp_pixels.h:1223
constexpr SDL_PixelFormat PIXELFORMAT_RGBA64_FLOAT
RGBA64_FLOAT.
Definition SDL3pp_pixels.h:905
constexpr SDL_PixelFormat PIXELFORMAT_UNKNOWN
UNKNOWN.
Definition SDL3pp_pixels.h:774
constexpr ColorPrimaries COLOR_PRIMARIES_EBU3213
EBU Tech. 3213-E.
Definition SDL3pp_pixels.h:1099
constexpr SDL_PixelFormat PIXELFORMAT_RGB96_FLOAT
RGB96_FLOAT.
Definition SDL3pp_pixels.h:917
constexpr PackedOrder PACKEDORDER_ABGR
ABGR.
Definition SDL3pp_pixels.h:228
constexpr SDL_PixelFormat PIXELFORMAT_RGB24
RGB24.
Definition SDL3pp_pixels.h:843
constexpr ColorPrimaries COLOR_PRIMARIES_SMPTE240
SMPTE 240M, functionally the same as COLOR_PRIMARIES_BT601.
Definition SDL3pp_pixels.h:1080
constexpr BitmapOrder BITMAPORDER_NONE
NONE.
Definition SDL3pp_pixels.h:194
constexpr SDL_PixelFormat PIXELFORMAT_RGBA8888
RGBA8888.
Definition SDL3pp_pixels.h:862
SDL_PixelFormatDetails PixelFormatDetails
Details about the format of a pixel.
Definition SDL3pp_pixels.h:301
constexpr BitmapOrder BITMAPORDER_4321
4321
Definition SDL3pp_pixels.h:196
constexpr ColorPrimaries COLOR_PRIMARIES_CUSTOM
COLOR_PRIMARIES_CUSTOM.
Definition SDL3pp_pixels.h:1102
constexpr ColorPrimaries COLOR_PRIMARIES_BT2020
ITU-R BT.2020-2 / ITU-R BT.2100-0.
Definition SDL3pp_pixels.h:1087
constexpr ColorType COLOR_TYPE_RGB
COLOR_TYPE_RGB.
Definition SDL3pp_pixels.h:1010
constexpr PixelType PIXELTYPE_INDEX4
INDEX4.
Definition SDL3pp_pixels.h:158
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_BT1361
ITU-R BT1361 Extended Colour Gamut.
Definition SDL3pp_pixels.h:1158
constexpr SDL_PixelFormat PIXELFORMAT_EXTERNAL_OES
Android video texture format.
Definition SDL3pp_pixels.h:959
constexpr PixelType PIXELTYPE_PACKED16
PACKED16.
Definition SDL3pp_pixels.h:164
constexpr SDL_PixelFormat PIXELFORMAT_ABGR1555
ABGR1555.
Definition SDL3pp_pixels.h:831
constexpr SDL_PixelFormat PIXELFORMAT_INDEX4MSB
INDEX4MSB.
Definition SDL3pp_pixels.h:792
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_YCGCO
MATRIX_COEFFICIENTS_YCGCO.
Definition SDL3pp_pixels.h:1229
constexpr SDL_PixelFormat PIXELFORMAT_NV21
Planar mode: Y + V/U interleaved (2 planes)
Definition SDL3pp_pixels.h:953
constexpr SDL_PixelFormat PIXELFORMAT_ABGR4444
ABGR4444.
Definition SDL3pp_pixels.h:819
constexpr PackedLayout PACKEDLAYOUT_332
332
Definition SDL3pp_pixels.h:276
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_PQ
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition SDL3pp_pixels.h:1175
constexpr SDL_PixelFormat PIXELFORMAT_ARGB4444
ARGB4444.
Definition SDL3pp_pixels.h:813
constexpr PixelType PIXELTYPE_ARRAYU8
ARRAYU8.
Definition SDL3pp_pixels.h:168
constexpr SDL_PixelFormat PIXELFORMAT_INDEX8
INDEX8.
Definition SDL3pp_pixels.h:795
constexpr ArrayOrder ARRAYORDER_ABGR
ABGR.
Definition SDL3pp_pixels.h:258
constexpr SDL_Colorspace COLORSPACE_JPEG
Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601.
Definition SDL3pp_pixels.h:1577
constexpr ColorPrimaries COLOR_PRIMARIES_BT470M
ITU-R BT.470-6 System M.
Definition SDL3pp_pixels.h:1067
constexpr SDL_PixelFormat PIXELFORMAT_YVYU
Packed mode: Y0+V0+Y1+U0 (1 plane)
Definition SDL3pp_pixels.h:947
constexpr ColorPrimaries COLOR_PRIMARIES_SMPTE431
SMPTE RP 431-2.
Definition SDL3pp_pixels.h:1093
constexpr ColorPrimaries COLOR_PRIMARIES_XYZ
SMPTE ST 428-1.
Definition SDL3pp_pixels.h:1090
SDL_ColorType ColorType
Colorspace color type.
Definition SDL3pp_pixels.h:1005
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL
MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL.
Definition SDL3pp_pixels.h:1242
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_CUSTOM
MATRIX_COEFFICIENTS_CUSTOM.
Definition SDL3pp_pixels.h:1251
constexpr SDL_PixelFormat PIXELFORMAT_RGBX32
RGBX32.
Definition SDL3pp_pixels.h:981
constexpr PackedLayout PACKEDLAYOUT_2101010
2101010
Definition SDL3pp_pixels.h:288
constexpr SDL_PixelFormat PIXELFORMAT_RGB565
RGB565.
Definition SDL3pp_pixels.h:837
constexpr SDL_PixelFormat PIXELFORMAT_ARGB64_FLOAT
ARGB64_FLOAT.
Definition SDL3pp_pixels.h:908
constexpr SDL_PixelFormat PIXELFORMAT_BGRA128_FLOAT
BGRA128_FLOAT.
Definition SDL3pp_pixels.h:929
SDL_MatrixCoefficients MatrixCoefficients
Colorspace matrix coefficients.
Definition SDL3pp_pixels.h:1202
constexpr ColorPrimaries COLOR_PRIMARIES_SMPTE432
SMPTE EG 432-1 / DCI P3.
Definition SDL3pp_pixels.h:1096
SDL_PackedOrder PackedOrder
Packed component order, high bit -> low bit.
Definition SDL3pp_pixels.h:212
constexpr PackedLayout PACKEDLAYOUT_5551
5551
Definition SDL3pp_pixels.h:282
constexpr ColorRange COLOR_RANGE_FULL
Full range, e.g.
Definition SDL3pp_pixels.h:1041
constexpr SDL_PixelFormat PIXELFORMAT_BGRX32
BGRX32.
Definition SDL3pp_pixels.h:987
constexpr SDL_PixelFormat PIXELFORMAT_ARGB1555
ARGB1555.
Definition SDL3pp_pixels.h:825
constexpr SDL_PixelFormat PIXELFORMAT_ABGR8888
ABGR8888.
Definition SDL3pp_pixels.h:865
constexpr SDL_Colorspace COLORSPACE_BT2020_LIMITED
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020.
Definition SDL3pp_pixels.h:1604
constexpr PackedOrder PACKEDORDER_RGBA
RGBA.
Definition SDL3pp_pixels.h:222
constexpr SDL_Colorspace COLORSPACE_UNKNOWN
UNKNOWN.
Definition SDL3pp_pixels.h:1560
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_UNSPECIFIED
TRANSFER_CHARACTERISTICS_UNSPECIFIED.
Definition SDL3pp_pixels.h:1127
constexpr SDL_Colorspace COLORSPACE_YUV_DEFAULT
The default colorspace for YUV surfaces if no colorspace is specified.
Definition SDL3pp_pixels.h:1620
constexpr SDL_PixelFormat PIXELFORMAT_XBGR2101010
XBGR2101010.
Definition SDL3pp_pixels.h:874
constexpr SDL_PixelFormat PIXELFORMAT_INDEX1LSB
INDEX1LSB.
Definition SDL3pp_pixels.h:777
constexpr SDL_Colorspace COLORSPACE_BT2020_FULL
Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020.
Definition SDL3pp_pixels.h:1610
constexpr SDL_PixelFormat PIXELFORMAT_ARGB128_FLOAT
ARGB128_FLOAT.
Definition SDL3pp_pixels.h:926
constexpr SDL_PixelFormat PIXELFORMAT_BGRA5551
BGRA5551.
Definition SDL3pp_pixels.h:834
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_CUSTOM
TRANSFER_CHARACTERISTICS_CUSTOM.
Definition SDL3pp_pixels.h:1185
constexpr ArrayOrder ARRAYORDER_BGRA
BGRA.
Definition SDL3pp_pixels.h:256
constexpr ColorPrimaries COLOR_PRIMARIES_GENERIC_FILM
Generic film (color filters using Illuminant C)
Definition SDL3pp_pixels.h:1083
constexpr SDL_PixelFormat PIXELFORMAT_YV12
Planar mode: Y + V + U (3 planes)
Definition SDL3pp_pixels.h:935
constexpr PixelType PIXELTYPE_INDEX2
INDEX2.
Definition SDL3pp_pixels.h:178
Uint32 MapRGBA(const PixelFormatDetails &format, PaletteRef palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Map an RGBA quadruple to a pixel value for a given pixel format.
Definition SDL3pp_pixels.h:2171
constexpr ColorRange COLOR_RANGE_UNKNOWN
COLOR_RANGE_UNKNOWN.
Definition SDL3pp_pixels.h:1030
constexpr SDL_PixelFormat PIXELFORMAT_BGR24
BGR24.
Definition SDL3pp_pixels.h:845
constexpr ColorPrimaries COLOR_PRIMARIES_BT601
ITU-R BT.601-7 525, SMPTE 170M.
Definition SDL3pp_pixels.h:1074
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_LINEAR
TRANSFER_CHARACTERISTICS_LINEAR.
Definition SDL3pp_pixels.h:1146
constexpr PixelType PIXELTYPE_ARRAYU32
ARRAYU32.
Definition SDL3pp_pixels.h:172
constexpr SDL_PixelFormat PIXELFORMAT_BGRA32
BGRA32.
Definition SDL3pp_pixels.h:975
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_UNKNOWN
TRANSFER_CHARACTERISTICS_UNKNOWN.
Definition SDL3pp_pixels.h:1121
constexpr ArrayOrder ARRAYORDER_RGBA
RGBA.
Definition SDL3pp_pixels.h:250
void GetRGBA(Uint32 pixel, const PixelFormatDetails &format, PaletteRef palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get RGBA values from a pixel in the specified format.
Definition SDL3pp_pixels.h:2247
constexpr SDL_PixelFormat PIXELFORMAT_BGR48
BGR48.
Definition SDL3pp_pixels.h:885
constexpr SDL_Colorspace COLORSPACE_SRGB_LINEAR
[object Object]
Definition SDL3pp_pixels.h:1568
constexpr ChromaLocation CHROMA_LOCATION_NONE
RGB, no chroma sampling.
Definition SDL3pp_pixels.h:1268
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_BT2020_10BIT
ITU-R BT2020 for 10-bit system.
Definition SDL3pp_pixels.h:1164
constexpr ChromaLocation CHROMA_LOCATION_CENTER
In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square.
Definition SDL3pp_pixels.h:1283
constexpr SDL_Colorspace COLORSPACE_BT709_LIMITED
Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709.
Definition SDL3pp_pixels.h:1593
constexpr SDL_PixelFormat PIXELFORMAT_BGR565
BGR565.
Definition SDL3pp_pixels.h:840
constexpr SDL_PixelFormat PIXELFORMAT_XRGB4444
XRGB4444.
Definition SDL3pp_pixels.h:801
constexpr SDL_PixelFormat PIXELFORMAT_BGRA4444
BGRA4444.
Definition SDL3pp_pixels.h:822
constexpr PackedOrder PACKEDORDER_NONE
NONE.
Definition SDL3pp_pixels.h:214
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_GAMMA28
ITU-R BT.470-6 System B, G.
Definition SDL3pp_pixels.h:1136
SDL_BitmapOrder BitmapOrder
Bitmap pixel order, high bit -> low bit.
Definition SDL3pp_pixels.h:192
constexpr ArrayOrder ARRAYORDER_BGR
BGR.
Definition SDL3pp_pixels.h:254
constexpr SDL_PixelFormat PIXELFORMAT_BGR96_FLOAT
BGR96_FLOAT.
Definition SDL3pp_pixels.h:920
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_BT709
Rec. ITU-R BT.709-6 / ITU-R BT1361.
Definition SDL3pp_pixels.h:1124
constexpr PixelType PIXELTYPE_INDEX1
INDEX1.
Definition SDL3pp_pixels.h:156
SDL_PixelType PixelType
Pixel type.
Definition SDL3pp_pixels.h:152
constexpr ArrayOrder ARRAYORDER_ARGB
ARGB.
Definition SDL3pp_pixels.h:252
constexpr PackedOrder PACKEDORDER_XRGB
XRGB.
Definition SDL3pp_pixels.h:216
constexpr PackedLayout PACKEDLAYOUT_8888
8888
Definition SDL3pp_pixels.h:286
constexpr SDL_PixelFormat PIXELFORMAT_INDEX1MSB
INDEX1MSB.
Definition SDL3pp_pixels.h:780
constexpr SDL_PixelFormat PIXELFORMAT_RGBX8888
RGBX8888.
Definition SDL3pp_pixels.h:850
constexpr SDL_PixelFormat PIXELFORMAT_ARGB2101010
ARGB2101010.
Definition SDL3pp_pixels.h:877
constexpr SDL_PixelFormat PIXELFORMAT_ABGR2101010
ABGR2101010.
Definition SDL3pp_pixels.h:880
constexpr SDL_PixelFormat PIXELFORMAT_XRGB8888
XRGB8888.
Definition SDL3pp_pixels.h:847
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_LOG100_SQRT10
TRANSFER_CHARACTERISTICS_LOG100_SQRT10.
Definition SDL3pp_pixels.h:1152
constexpr TransferCharacteristics TRANSFER_CHARACTERISTICS_IEC61966
IEC 61966-2-4.
Definition SDL3pp_pixels.h:1155
constexpr PackedOrder PACKEDORDER_BGRX
BGRX.
Definition SDL3pp_pixels.h:226
constexpr SDL_PixelFormat PIXELFORMAT_RGBA32
RGBA32.
Definition SDL3pp_pixels.h:969
constexpr PackedOrder PACKEDORDER_XBGR
XBGR.
Definition SDL3pp_pixels.h:224
constexpr MatrixCoefficients MATRIX_COEFFICIENTS_IDENTITY
MATRIX_COEFFICIENTS_IDENTITY.
Definition SDL3pp_pixels.h:1204
constexpr PixelType PIXELTYPE_INDEX8
INDEX8.
Definition SDL3pp_pixels.h:160
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
A structure that represents a color as RGBA components.
Definition SDL3pp_pixels.h:1638
constexpr Uint8 GetR() const
Get the red component from the color.
Definition SDL3pp_pixels.h:1689
constexpr Uint8 GetB() const
Get the blue component from the color.
Definition SDL3pp_pixels.h:1729
constexpr Color & SetG(Uint8 newG)
Set the green component from the color.
Definition SDL3pp_pixels.h:1717
Uint32 Map(const PixelFormatDetails &format, PaletteRef palette) const
Map an RGBA quadruple to a pixel value for a given pixel format.
Definition SDL3pp_pixels.h:2262
constexpr auto operator<=>(const SDL_Color &color) const
Compares with the underlying type.
Definition SDL3pp_pixels.h:1679
constexpr Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a=255)
Constructs from its fields.
Definition SDL3pp_pixels.h:1657
constexpr Color & SetR(Uint8 newR)
Set the red component from the color.
Definition SDL3pp_pixels.h:1697
constexpr Uint8 GetG() const
Get the green component from the color.
Definition SDL3pp_pixels.h:1709
constexpr auto operator<=>(const Color &other) const
Default comparison operator.
Definition SDL3pp_pixels.h:1665
static Color Get(Uint32 pixel, const PixelFormatDetails &format, PaletteRef palette)
Get RGBA values from a pixel in the specified format.
Definition SDL3pp_pixels.h:2268
constexpr Color(const SDL_Color &color={})
Wraps Color.
Definition SDL3pp_pixels.h:1644
constexpr Color & SetA(Uint8 newA)
Set the alpha component from the color.
Definition SDL3pp_pixels.h:1757
constexpr Color & SetB(Uint8 newB)
Set the blue component from the color.
Definition SDL3pp_pixels.h:1737
constexpr Uint8 GetA() const
Get the alpha component from the color.
Definition SDL3pp_pixels.h:1749
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition SDL3pp_pixels.h:1833
constexpr FColor & SetG(float newG)
Set the green component from the color.
Definition SDL3pp_pixels.h:1913
constexpr float GetA() const
Get the alpha component from the color.
Definition SDL3pp_pixels.h:1945
constexpr FColor(float r, float g, float b, float a=1)
Constructs from its fields.
Definition SDL3pp_pixels.h:1852
constexpr float GetR() const
Get the red component from the color.
Definition SDL3pp_pixels.h:1885
constexpr float GetG() const
Get the green component from the color.
Definition SDL3pp_pixels.h:1905
constexpr auto operator<=>(const FColor &other) const
Default comparison operator.
Definition SDL3pp_pixels.h:1861
constexpr FColor & SetR(float newR)
Set the red component from the color.
Definition SDL3pp_pixels.h:1893
constexpr auto operator<=>(const SDL_FColor &color) const
Compares with the underlying type.
Definition SDL3pp_pixels.h:1875
constexpr FColor & SetA(float newA)
Set the alpha component from the color.
Definition SDL3pp_pixels.h:1953
constexpr FColor & SetB(float newB)
Set the blue component from the color.
Definition SDL3pp_pixels.h:1933
constexpr FColor(const SDL_FColor &color={})
Wraps SDL_FColor.
Definition SDL3pp_pixels.h:1839
constexpr float GetB() const
Get the blue component from the color.
Definition SDL3pp_pixels.h:1925
A set of indexed colors representing a palette.
Definition SDL3pp_pixels.h:1971
constexpr Color operator[](int index) const
Get the index color.
Definition SDL3pp_pixels.h:1978
static void reset(SDL_Palette *resource)
Free a palette created with Palette.Create().
Definition SDL3pp_pixels.h:2010
void SetColors(SpanRef< const SDL_Color > colors, int firstcolor=0)
Set a range of colors in a palette.
Definition SDL3pp_pixels.h:1992
constexpr int GetSize() const
Return the number of colors.
Definition SDL3pp_pixels.h:1975
Unsafe Handle to palette.
Definition SDL3pp_pixels.h:2077
constexpr PaletteUnsafe(Palette &&other)
Constructs PaletteUnsafe from Palette.
Definition SDL3pp_pixels.h:2083
Handle to an owned palette.
Definition SDL3pp_pixels.h:2021
void Destroy()
Free a palette created with Palette.Create().
Definition SDL3pp_pixels.h:2055
static Palette Create(int ncolors)
Create a palette structure with the specified number of color entries.
Definition SDL3pp_pixels.h:2041