SDL 3.0
SDL_pixels.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * # CategoryPixels
24 *
25 * Pixel management.
26 */
27
28#ifndef SDL_pixels_h_
29#define SDL_pixels_h_
30
31#include <SDL3/SDL_stdinc.h>
32#include <SDL3/SDL_error.h>
33#include <SDL3/SDL_endian.h>
34
35#include <SDL3/SDL_begin_code.h>
36/* Set up for C function definitions, even when using C++ */
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/**
42 * A fully opaque 8-bit alpha value.
43 *
44 * \since This macro is available since SDL 3.1.3.
45 *
46 * \sa SDL_ALPHA_TRANSPARENT
47 */
48#define SDL_ALPHA_OPAQUE 255
49
50/**
51 * A fully opaque floating point alpha value.
52 *
53 * \since This macro is available since SDL 3.1.3.
54 *
55 * \sa SDL_ALPHA_TRANSPARENT_FLOAT
56 */
57#define SDL_ALPHA_OPAQUE_FLOAT 1.0f
58
59/**
60 * A fully transparent 8-bit alpha value.
61 *
62 * \since This macro is available since SDL 3.1.3.
63 *
64 * \sa SDL_ALPHA_OPAQUE
65 */
66#define SDL_ALPHA_TRANSPARENT 0
67
68/**
69 * A fully transparent floating point alpha value.
70 *
71 * \since This macro is available since SDL 3.1.3.
72 *
73 * \sa SDL_ALPHA_OPAQUE_FLOAT
74 */
75#define SDL_ALPHA_TRANSPARENT_FLOAT 0.0f
76
77/**
78 * Pixel type.
79 *
80 * \since This enum is available since SDL 3.1.3.
81 */
82typedef enum SDL_PixelType
83{
96 /* appended at the end for compatibility with sdl2-compat: */
99
100/**
101 * Bitmap pixel order, high bit -> low bit.
102 *
103 * \since This enum is available since SDL 3.1.3.
104 */
105typedef enum SDL_BitmapOrder
106{
111
112/**
113 * Packed component order, high bit -> low bit.
114 *
115 * \since This enum is available since SDL 3.1.3.
116 */
117typedef enum SDL_PackedOrder
118{
129
130/**
131 * Array component order, low byte -> high byte.
132 *
133 * \since This enum is available since SDL 3.1.3.
134 */
135typedef enum SDL_ArrayOrder
136{
145
146/**
147 * Packed component layout.
148 *
149 * \since This enum is available since SDL 3.1.3.
150 */
152{
163
164#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
165
166#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
167 ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
168 ((bits) << 8) | ((bytes) << 0))
169
170#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
171#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
172#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
173#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
174#define SDL_BITSPERPIXEL(X) \
175 (SDL_ISPIXELFORMAT_FOURCC(X) ? 0 : (((X) >> 8) & 0xFF))
176#define SDL_BYTESPERPIXEL(X) \
177 (SDL_ISPIXELFORMAT_FOURCC(X) ? \
178 ((((X) == SDL_PIXELFORMAT_YUY2) || \
179 ((X) == SDL_PIXELFORMAT_UYVY) || \
180 ((X) == SDL_PIXELFORMAT_YVYU) || \
181 ((X) == SDL_PIXELFORMAT_P010)) ? 2 : 1) : (((X) >> 0) & 0xFF))
182
183#define SDL_ISPIXELFORMAT_INDEXED(format) \
184 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
185 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
186 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
187 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
188 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
189
190#define SDL_ISPIXELFORMAT_PACKED(format) \
191 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
192 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
193 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
194 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
195
196#define SDL_ISPIXELFORMAT_ARRAY(format) \
197 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
198 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
199 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
200 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
201 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
202 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
203
204#define SDL_ISPIXELFORMAT_ALPHA(format) \
205 ((SDL_ISPIXELFORMAT_PACKED(format) && \
206 ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
207 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
208 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
209 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))))
210
211#define SDL_ISPIXELFORMAT_10BIT(format) \
212 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
213 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32) && \
214 (SDL_PIXELLAYOUT(format) == SDL_PACKEDLAYOUT_2101010)))
215
216#define SDL_ISPIXELFORMAT_FLOAT(format) \
217 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
218 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
219 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
220
221/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
222#define SDL_ISPIXELFORMAT_FOURCC(format) \
223 ((format) && (SDL_PIXELFLAG(format) != 1))
224
225/* Note: If you modify this enum, update SDL_GetPixelFormatName() */
226
227/**
228 * Pixel format.
229 *
230 * SDL's pixel formats have the following naming convention:
231 *
232 * - Names with a list of components and a single bit count, such as RGB24 and
233 * ABGR32, define a platform-independent encoding into bytes in the order
234 * specified. For example, in RGB24 data, each pixel is encoded in 3 bytes
235 * (red, green, blue) in that order, and in ABGR32 data, each pixel is
236 * encoded in 4 bytes alpha, blue, green, red) in that order. Use these
237 * names if the property of a format that is important to you is the order
238 * of the bytes in memory or on disk.
239 * - Names with a bit count per component, such as ARGB8888 and XRGB1555, are
240 * "packed" into an appropriately-sized integer in the platform's native
241 * endianness. For example, ARGB8888 is a sequence of 32-bit integers; in
242 * each integer, the most significant bits are alpha, and the least
243 * significant bits are blue. On a little-endian CPU such as x86, the least
244 * significant bits of each integer are arranged first in memory, but on a
245 * big-endian CPU such as s390x, the most significant bits are arranged
246 * first. Use these names if the property of a format that is important to
247 * you is the meaning of each bit position within a native-endianness
248 * integer.
249 * - In indexed formats such as INDEX4LSB, each pixel is represented by
250 * encoding an index into the palette into the indicated number of bits,
251 * with multiple pixels packed into each byte if appropriate. In LSB
252 * formats, the first (leftmost) pixel is stored in the least-significant
253 * bits of the byte; in MSB formats, it's stored in the most-significant
254 * bits. INDEX8 does not need LSB/MSB variants, because each pixel exactly
255 * fills one byte.
256 *
257 * The 32-bit byte-array encodings such as RGBA32 are aliases for the
258 * appropriate 8888 encoding for the current platform. For example, RGBA32 is
259 * an alias for ABGR8888 on little-endian CPUs like x86, or an alias for
260 * RGBA8888 on big-endian CPUs.
261 *
262 * \since This enum is available since SDL 3.1.3.
263 */
264typedef enum SDL_PixelFormat
265{
268 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, 1, 0), */
270 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0), */
272 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0, 2, 0), */
274 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0, 2, 0), */
276 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0), */
278 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, 4, 0), */
280 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1), */
282 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_332, 8, 1), */
284 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_4444, 12, 2), */
286 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_4444, 12, 2), */
288 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_1555, 15, 2), */
290 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_1555, 15, 2), */
292 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_4444, 16, 2), */
294 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_4444, 16, 2), */
296 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_4444, 16, 2), */
298 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_4444, 16, 2), */
300 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_1555, 16, 2), */
302 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_5551, 16, 2), */
304 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1555, 16, 2), */
306 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_5551, 16, 2), */
308 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_565, 16, 2), */
310 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_565, 16, 2), */
312 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, 24, 3), */
314 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, 24, 3), */
316 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_8888, 24, 4), */
318 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, SDL_PACKEDLAYOUT_8888, 24, 4), */
320 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_8888, 24, 4), */
322 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, SDL_PACKEDLAYOUT_8888, 24, 4), */
324 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_8888, 32, 4), */
326 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4), */
328 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_8888, 32, 4), */
330 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_8888, 32, 4), */
332 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_2101010, 32, 4), */
334 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_2101010, 32, 4), */
336 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4), */
338 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_2101010, 32, 4), */
340 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU16, SDL_ARRAYORDER_RGB, 0, 48, 6), */
342 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU16, SDL_ARRAYORDER_BGR, 0, 48, 6), */
344 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU16, SDL_ARRAYORDER_RGBA, 0, 64, 8), */
346 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU16, SDL_ARRAYORDER_ARGB, 0, 64, 8), */
348 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU16, SDL_ARRAYORDER_BGRA, 0, 64, 8), */
350 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU16, SDL_ARRAYORDER_ABGR, 0, 64, 8), */
352 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF16, SDL_ARRAYORDER_RGB, 0, 48, 6), */
354 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF16, SDL_ARRAYORDER_BGR, 0, 48, 6), */
356 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF16, SDL_ARRAYORDER_RGBA, 0, 64, 8), */
358 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF16, SDL_ARRAYORDER_ARGB, 0, 64, 8), */
360 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF16, SDL_ARRAYORDER_BGRA, 0, 64, 8), */
362 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF16, SDL_ARRAYORDER_ABGR, 0, 64, 8), */
364 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF32, SDL_ARRAYORDER_RGB, 0, 96, 12), */
366 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF32, SDL_ARRAYORDER_BGR, 0, 96, 12), */
368 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF32, SDL_ARRAYORDER_RGBA, 0, 128, 16), */
370 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF32, SDL_ARRAYORDER_ARGB, 0, 128, 16), */
372 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF32, SDL_ARRAYORDER_BGRA, 0, 128, 16), */
374 /* SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYF32, SDL_ARRAYORDER_ABGR, 0, 128, 16), */
375
376 SDL_PIXELFORMAT_YV12 = 0x32315659u, /**< Planar mode: Y + V + U (3 planes) */
377 /* SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), */
378 SDL_PIXELFORMAT_IYUV = 0x56555949u, /**< Planar mode: Y + U + V (3 planes) */
379 /* SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'), */
380 SDL_PIXELFORMAT_YUY2 = 0x32595559u, /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
381 /* SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'), */
382 SDL_PIXELFORMAT_UYVY = 0x59565955u, /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
383 /* SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), */
384 SDL_PIXELFORMAT_YVYU = 0x55595659u, /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
385 /* SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'), */
386 SDL_PIXELFORMAT_NV12 = 0x3231564eu, /**< Planar mode: Y + U/V interleaved (2 planes) */
387 /* SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), */
388 SDL_PIXELFORMAT_NV21 = 0x3132564eu, /**< Planar mode: Y + V/U interleaved (2 planes) */
389 /* SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), */
390 SDL_PIXELFORMAT_P010 = 0x30313050u, /**< Planar mode: Y + U/V interleaved (2 planes) */
391 /* SDL_DEFINE_PIXELFOURCC('P', '0', '1', '0'), */
392 SDL_PIXELFORMAT_EXTERNAL_OES = 0x2053454fu, /**< Android video texture format */
393 /* SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') */
394
395 /* Aliases for RGBA byte arrays of color data, for the current platform */
396 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
405 #else
414 #endif
416
417/**
418 * Pixels are a representation of a color in a particular color space.
419 *
420 * The first characteristic of a color space is the color type. SDL understands two different color types, RGB and YCbCr, or in SDL also referred to as YUV.
421 *
422 * RGB colors consist of red, green, and blue channels of color that are added together to represent the colors we see on the screen.
423 * https://en.wikipedia.org/wiki/RGB_color_model
424 *
425 * YCbCr colors represent colors as a Y luma brightness component and red and blue chroma color offsets. This color representation takes advantage of the fact that the human eye is more sensitive to brightness than the color in an image. The Cb and Cr components are often compressed and have lower resolution than the luma component.
426 * https://en.wikipedia.org/wiki/YCbCr
427 *
428 * When the color information in YCbCr is compressed, the Y pixels are left at full resolution and each Cr and Cb pixel represents an average of the color information in a block of Y pixels. The chroma location determines where in that block of pixels the color information is coming from.
429 *
430 * The color range defines how much of the pixel to use when converting a pixel into a color on the display. When the full color range is used, the entire numeric range of the pixel bits is significant. When narrow color range is used, for historical reasons, the pixel uses only a portion of the numeric range to represent colors.
431 *
432 * The color primaries and white point are a definition of the colors in the color space relative to the standard XYZ color space.
433 * https://en.wikipedia.org/wiki/CIE_1931_color_space
434 *
435 * The transfer characteristic, or opto-electrical transfer function (OETF), is the way a color is converted from mathematically linear space into a non-linear output signals.
436 * https://en.wikipedia.org/wiki/Rec._709#Transfer_characteristics
437 *
438 * The matrix coefficients are used to convert between YCbCr and RGB colors.
439 */
440
441/**
442 * Colorspace color type.
443 *
444 * \since This enum is available since SDL 3.1.3.
445 */
446typedef enum SDL_ColorType
447{
452
453/**
454 * Colorspace color range, as described by
455 * https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en
456 *
457 * \since This enum is available since SDL 3.1.3.
458 */
459typedef enum SDL_ColorRange
460{
462 SDL_COLOR_RANGE_LIMITED = 1, /**< Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma */
463 SDL_COLOR_RANGE_FULL = 2 /**< Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma */
465
466/**
467 * Colorspace color primaries, as described by
468 * https://www.itu.int/rec/T-REC-H.273-201612-S/en
469 *
470 * \since This enum is available since SDL 3.1.3.
471 */
473{
475 SDL_COLOR_PRIMARIES_BT709 = 1, /**< ITU-R BT.709-6 */
477 SDL_COLOR_PRIMARIES_BT470M = 4, /**< ITU-R BT.470-6 System M */
478 SDL_COLOR_PRIMARIES_BT470BG = 5, /**< ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 */
479 SDL_COLOR_PRIMARIES_BT601 = 6, /**< ITU-R BT.601-7 525, SMPTE 170M */
480 SDL_COLOR_PRIMARIES_SMPTE240 = 7, /**< SMPTE 240M, functionally the same as SDL_COLOR_PRIMARIES_BT601 */
481 SDL_COLOR_PRIMARIES_GENERIC_FILM = 8, /**< Generic film (color filters using Illuminant C) */
482 SDL_COLOR_PRIMARIES_BT2020 = 9, /**< ITU-R BT.2020-2 / ITU-R BT.2100-0 */
483 SDL_COLOR_PRIMARIES_XYZ = 10, /**< SMPTE ST 428-1 */
484 SDL_COLOR_PRIMARIES_SMPTE431 = 11, /**< SMPTE RP 431-2 */
485 SDL_COLOR_PRIMARIES_SMPTE432 = 12, /**< SMPTE EG 432-1 / DCI P3 */
486 SDL_COLOR_PRIMARIES_EBU3213 = 22, /**< EBU Tech. 3213-E */
489
490/**
491 * Colorspace transfer characteristics.
492 *
493 * These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
494 *
495 * \since This enum is available since SDL 3.1.3.
496 */
498{
500 SDL_TRANSFER_CHARACTERISTICS_BT709 = 1, /**< Rec. ITU-R BT.709-6 / ITU-R BT1361 */
502 SDL_TRANSFER_CHARACTERISTICS_GAMMA22 = 4, /**< ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM */
503 SDL_TRANSFER_CHARACTERISTICS_GAMMA28 = 5, /**< ITU-R BT.470-6 System B, G */
504 SDL_TRANSFER_CHARACTERISTICS_BT601 = 6, /**< SMPTE ST 170M / ITU-R BT.601-7 525 or 625 */
505 SDL_TRANSFER_CHARACTERISTICS_SMPTE240 = 7, /**< SMPTE ST 240M */
509 SDL_TRANSFER_CHARACTERISTICS_IEC61966 = 11, /**< IEC 61966-2-4 */
510 SDL_TRANSFER_CHARACTERISTICS_BT1361 = 12, /**< ITU-R BT1361 Extended Colour Gamut */
511 SDL_TRANSFER_CHARACTERISTICS_SRGB = 13, /**< IEC 61966-2-1 (sRGB or sYCC) */
512 SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT = 14, /**< ITU-R BT2020 for 10-bit system */
513 SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT = 15, /**< ITU-R BT2020 for 12-bit system */
514 SDL_TRANSFER_CHARACTERISTICS_PQ = 16, /**< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems */
515 SDL_TRANSFER_CHARACTERISTICS_SMPTE428 = 17, /**< SMPTE ST 428-1 */
516 SDL_TRANSFER_CHARACTERISTICS_HLG = 18, /**< ARIB STD-B67, known as "hybrid log-gamma" (HLG) */
519
520/**
521 * Colorspace matrix coefficients.
522 *
523 * These are as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
524 *
525 * \since This enum is available since SDL 3.1.3.
526 */
528{
530 SDL_MATRIX_COEFFICIENTS_BT709 = 1, /**< ITU-R BT.709-6 */
532 SDL_MATRIX_COEFFICIENTS_FCC = 4, /**< US FCC Title 47 */
533 SDL_MATRIX_COEFFICIENTS_BT470BG = 5, /**< ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625, functionally the same as SDL_MATRIX_COEFFICIENTS_BT601 */
534 SDL_MATRIX_COEFFICIENTS_BT601 = 6, /**< ITU-R BT.601-7 525 */
535 SDL_MATRIX_COEFFICIENTS_SMPTE240 = 7, /**< SMPTE 240M */
537 SDL_MATRIX_COEFFICIENTS_BT2020_NCL = 9, /**< ITU-R BT.2020-2 non-constant luminance */
538 SDL_MATRIX_COEFFICIENTS_BT2020_CL = 10, /**< ITU-R BT.2020-2 constant luminance */
539 SDL_MATRIX_COEFFICIENTS_SMPTE2085 = 11, /**< SMPTE ST 2085 */
542 SDL_MATRIX_COEFFICIENTS_ICTCP = 14, /**< ITU-R BT.2100-0 ICTCP */
545
546/**
547 * Colorspace chroma sample location.
548 *
549 * \since This enum is available since SDL 3.1.3.
550 */
552{
553 SDL_CHROMA_LOCATION_NONE = 0, /**< RGB, no chroma sampling */
554 SDL_CHROMA_LOCATION_LEFT = 1, /**< In MPEG-2, MPEG-4, and AVC, Cb and Cr are taken on midpoint of the left-edge of the 2x2 square. In other words, they have the same horizontal location as the top-left pixel, but is shifted one-half pixel down vertically. */
555 SDL_CHROMA_LOCATION_CENTER = 2, /**< In JPEG/JFIF, H.261, and MPEG-1, Cb and Cr are taken at the center of the 2x2 square. In other words, they are offset one-half pixel to the right and one-half pixel down compared to the top-left pixel. */
556 SDL_CHROMA_LOCATION_TOPLEFT = 3 /**< In HEVC for BT.2020 and BT.2100 content (in particular on Blu-rays), Cb and Cr are sampled at the same location as the group's top-left Y pixel ("co-sited", "co-located"). */
558
559
560/* Colorspace definition */
561#define SDL_DEFINE_COLORSPACE(type, range, primaries, transfer, matrix, chroma) \
562 (((Uint32)(type) << 28) | ((Uint32)(range) << 24) | ((Uint32)(chroma) << 20) | \
563 ((Uint32)(primaries) << 10) | ((Uint32)(transfer) << 5) | ((Uint32)(matrix) << 0))
564
565#define SDL_COLORSPACETYPE(X) (SDL_ColorType)(((X) >> 28) & 0x0F)
566#define SDL_COLORSPACERANGE(X) (SDL_ColorRange)(((X) >> 24) & 0x0F)
567#define SDL_COLORSPACECHROMA(X) (SDL_ChromaLocation)(((X) >> 20) & 0x0F)
568#define SDL_COLORSPACEPRIMARIES(X) (SDL_ColorPrimaries)(((X) >> 10) & 0x1F)
569#define SDL_COLORSPACETRANSFER(X) (SDL_TransferCharacteristics)(((X) >> 5) & 0x1F)
570#define SDL_COLORSPACEMATRIX(X) (SDL_MatrixCoefficients)((X) & 0x1F)
571
572#define SDL_ISCOLORSPACE_MATRIX_BT601(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT601 || SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT470BG)
573#define SDL_ISCOLORSPACE_MATRIX_BT709(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT709)
574#define SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT2020_NCL)
575#define SDL_ISCOLORSPACE_LIMITED_RANGE(X) (SDL_COLORSPACERANGE(X) != SDL_COLOR_RANGE_FULL)
576#define SDL_ISCOLORSPACE_FULL_RANGE(X) (SDL_COLORSPACERANGE(X) == SDL_COLOR_RANGE_FULL)
577
578/**
579 * Colorspace definitions.
580 *
581 * Since similar colorspaces may vary in their details (matrix, transfer
582 * function, etc.), this is not an exhaustive list, but rather a
583 * representative sample of the kinds of colorspaces supported in SDL.
584 *
585 * \since This enum is available since SDL 3.1.3.
586 *
587 * \sa SDL_ColorPrimaries
588 * \sa SDL_ColorRange
589 * \sa SDL_ColorType
590 * \sa SDL_MatrixCoefficients
591 * \sa SDL_TransferCharacteristics
592 */
593typedef enum SDL_Colorspace
594{
596
597 /* sRGB is a gamma corrected colorspace, and the default colorspace for SDL rendering and 8-bit RGB surfaces */
598 SDL_COLORSPACE_SRGB = 0x120005a0u, /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 */
599 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_RGB,
600 SDL_COLOR_RANGE_FULL,
601 SDL_COLOR_PRIMARIES_BT709,
602 SDL_TRANSFER_CHARACTERISTICS_SRGB,
603 SDL_MATRIX_COEFFICIENTS_IDENTITY,
604 SDL_CHROMA_LOCATION_NONE), */
605
606 /* This is a linear colorspace and the default colorspace for floating point surfaces. On Windows this is the scRGB colorspace, and on Apple platforms this is kCGColorSpaceExtendedLinearSRGB for EDR content */
607 SDL_COLORSPACE_SRGB_LINEAR = 0x12000500u, /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 */
608 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_RGB,
609 SDL_COLOR_RANGE_FULL,
610 SDL_COLOR_PRIMARIES_BT709,
611 SDL_TRANSFER_CHARACTERISTICS_LINEAR,
612 SDL_MATRIX_COEFFICIENTS_IDENTITY,
613 SDL_CHROMA_LOCATION_NONE), */
614
615 /* HDR10 is a non-linear HDR colorspace and the default colorspace for 10-bit surfaces */
616 SDL_COLORSPACE_HDR10 = 0x12002600u, /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 */
617 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_RGB,
618 SDL_COLOR_RANGE_FULL,
619 SDL_COLOR_PRIMARIES_BT2020,
620 SDL_TRANSFER_CHARACTERISTICS_PQ,
621 SDL_MATRIX_COEFFICIENTS_IDENTITY,
622 SDL_CHROMA_LOCATION_NONE), */
623
624 SDL_COLORSPACE_JPEG = 0x220004c6u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 */
625 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
626 SDL_COLOR_RANGE_FULL,
627 SDL_COLOR_PRIMARIES_BT709,
628 SDL_TRANSFER_CHARACTERISTICS_BT601,
629 SDL_MATRIX_COEFFICIENTS_BT601,
630 SDL_CHROMA_LOCATION_NONE), */
631
632 SDL_COLORSPACE_BT601_LIMITED = 0x211018c6u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */
633 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
634 SDL_COLOR_RANGE_LIMITED,
635 SDL_COLOR_PRIMARIES_BT601,
636 SDL_TRANSFER_CHARACTERISTICS_BT601,
637 SDL_MATRIX_COEFFICIENTS_BT601,
638 SDL_CHROMA_LOCATION_LEFT), */
639
640 SDL_COLORSPACE_BT601_FULL = 0x221018c6u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */
641 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
642 SDL_COLOR_RANGE_FULL,
643 SDL_COLOR_PRIMARIES_BT601,
644 SDL_TRANSFER_CHARACTERISTICS_BT601,
645 SDL_MATRIX_COEFFICIENTS_BT601,
646 SDL_CHROMA_LOCATION_LEFT), */
647
648 SDL_COLORSPACE_BT709_LIMITED = 0x21100421u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 */
649 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
650 SDL_COLOR_RANGE_LIMITED,
651 SDL_COLOR_PRIMARIES_BT709,
652 SDL_TRANSFER_CHARACTERISTICS_BT709,
653 SDL_MATRIX_COEFFICIENTS_BT709,
654 SDL_CHROMA_LOCATION_LEFT), */
655
656 SDL_COLORSPACE_BT709_FULL = 0x22100421u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 */
657 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
658 SDL_COLOR_RANGE_FULL,
659 SDL_COLOR_PRIMARIES_BT709,
660 SDL_TRANSFER_CHARACTERISTICS_BT709,
661 SDL_MATRIX_COEFFICIENTS_BT709,
662 SDL_CHROMA_LOCATION_LEFT), */
663
664 SDL_COLORSPACE_BT2020_LIMITED = 0x21102609u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 */
665 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
666 SDL_COLOR_RANGE_LIMITED,
667 SDL_COLOR_PRIMARIES_BT2020,
668 SDL_TRANSFER_CHARACTERISTICS_PQ,
669 SDL_MATRIX_COEFFICIENTS_BT2020_NCL,
670 SDL_CHROMA_LOCATION_LEFT), */
671
672 SDL_COLORSPACE_BT2020_FULL = 0x22102609u, /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 */
673 /* SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR,
674 SDL_COLOR_RANGE_FULL,
675 SDL_COLOR_PRIMARIES_BT2020,
676 SDL_TRANSFER_CHARACTERISTICS_PQ,
677 SDL_MATRIX_COEFFICIENTS_BT2020_NCL,
678 SDL_CHROMA_LOCATION_LEFT), */
679
680 SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB, /**< The default colorspace for RGB surfaces if no colorspace is specified */
681 SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG /**< The default colorspace for YUV surfaces if no colorspace is specified */
683
684/**
685 * A structure that represents a color as RGBA components.
686 *
687 * The bits of this structure can be directly reinterpreted as an
688 * integer-packed color which uses the SDL_PIXELFORMAT_RGBA32 format
689 * (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and
690 * SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
691 *
692 * \since This struct is available since SDL 3.1.3.
693 */
694typedef struct SDL_Color
695{
700} SDL_Color;
701
702/**
703 * The bits of this structure can be directly reinterpreted as a float-packed
704 * color which uses the SDL_PIXELFORMAT_RGBA128_FLOAT format
705 *
706 * \since This struct is available since SDL 3.1.3.
707 */
708typedef struct SDL_FColor
709{
710 float r;
711 float g;
712 float b;
713 float a;
714} SDL_FColor;
715
716/**
717 * A set of indexed colors representing a palette.
718 *
719 * \since This struct is available since SDL 3.1.3.
720 *
721 * \sa SDL_SetPaletteColors
722 */
723typedef struct SDL_Palette
724{
725 int ncolors; /**< number of elements in `colors`. */
726 SDL_Color *colors; /**< an array of colors, `ncolors` long. */
727 Uint32 version; /**< internal use only, do not touch. */
728 int refcount; /**< internal use only, do not touch. */
730
731/**
732 * Details about the format of a pixel.
733 *
734 * \since This struct is available since SDL 3.1.3.
735 */
737{
755
756/**
757 * Get the human readable name of a pixel format.
758 *
759 * \param format the pixel format to query.
760 * \returns the human readable name of the specified pixel format or
761 * "SDL_PIXELFORMAT_UNKNOWN" if the format isn't recognized.
762 *
763 * \threadsafety It is safe to call this function from any thread.
764 *
765 * \since This function is available since SDL 3.1.3.
766 */
767extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat format);
768
769/**
770 * Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
771 *
772 * \param format one of the SDL_PixelFormat values.
773 * \param bpp a bits per pixel value; usually 15, 16, or 32.
774 * \param Rmask a pointer filled in with the red mask for the format.
775 * \param Gmask a pointer filled in with the green mask for the format.
776 * \param Bmask a pointer filled in with the blue mask for the format.
777 * \param Amask a pointer filled in with the alpha mask for the format.
778 * \returns true on success or false on failure; call SDL_GetError() for more
779 * information.
780 *
781 * \threadsafety It is safe to call this function from any thread.
782 *
783 * \since This function is available since SDL 3.1.3.
784 *
785 * \sa SDL_GetPixelFormatForMasks
786 */
787extern SDL_DECLSPEC bool SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask);
788
789/**
790 * Convert a bpp value and RGBA masks to an enumerated pixel format.
791 *
792 * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
793 * possible.
794 *
795 * \param bpp a bits per pixel value; usually 15, 16, or 32.
796 * \param Rmask the red mask for the format.
797 * \param Gmask the green mask for the format.
798 * \param Bmask the blue mask for the format.
799 * \param Amask the alpha mask for the format.
800 * \returns the SDL_PixelFormat value corresponding to the format masks, or
801 * SDL_PIXELFORMAT_UNKNOWN if there isn't a match.
802 *
803 * \threadsafety It is safe to call this function from any thread.
804 *
805 * \since This function is available since SDL 3.1.3.
806 *
807 * \sa SDL_GetMasksForPixelFormat
808 */
809extern SDL_DECLSPEC SDL_PixelFormat SDLCALL SDL_GetPixelFormatForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
810
811/**
812 * Create an SDL_PixelFormatDetails structure corresponding to a pixel format.
813 *
814 * Returned structure may come from a shared global cache (i.e. not newly
815 * allocated), and hence should not be modified, especially the palette. Weird
816 * errors such as `Blit combination not supported` may occur.
817 *
818 * \param format one of the SDL_PixelFormat values.
819 * \returns a pointer to a SDL_PixelFormatDetails structure or NULL on
820 * failure; call SDL_GetError() for more information.
821 *
822 * \threadsafety It is safe to call this function from any thread.
823 *
824 * \since This function is available since SDL 3.1.3.
825 */
826extern SDL_DECLSPEC const SDL_PixelFormatDetails * SDLCALL SDL_GetPixelFormatDetails(SDL_PixelFormat format);
827
828/**
829 * Create a palette structure with the specified number of color entries.
830 *
831 * The palette entries are initialized to white.
832 *
833 * \param ncolors represents the number of color entries in the color palette.
834 * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
835 * there wasn't enough memory); call SDL_GetError() for more
836 * information.
837 *
838 * \threadsafety It is safe to call this function from any thread.
839 *
840 * \since This function is available since SDL 3.1.3.
841 *
842 * \sa SDL_DestroyPalette
843 * \sa SDL_SetPaletteColors
844 * \sa SDL_SetSurfacePalette
845 */
846extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreatePalette(int ncolors);
847
848/**
849 * Set a range of colors in a palette.
850 *
851 * \param palette the SDL_Palette structure to modify.
852 * \param colors an array of SDL_Color structures to copy into the palette.
853 * \param firstcolor the index of the first palette entry to modify.
854 * \param ncolors the number of entries to modify.
855 * \returns true on success or false on failure; call SDL_GetError() for more
856 * information.
857 *
858 * \threadsafety It is safe to call this function from any thread, as long as
859 * the palette is not modified or destroyed in another thread.
860 *
861 * \since This function is available since SDL 3.1.3.
862 */
863extern SDL_DECLSPEC bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors);
864
865/**
866 * Free a palette created with SDL_CreatePalette().
867 *
868 * \param palette the SDL_Palette structure to be freed.
869 *
870 * \threadsafety It is safe to call this function from any thread, as long as
871 * the palette is not modified or destroyed in another thread.
872 *
873 * \since This function is available since SDL 3.1.3.
874 *
875 * \sa SDL_CreatePalette
876 */
877extern SDL_DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette *palette);
878
879/**
880 * Map an RGB triple to an opaque pixel value for a given pixel format.
881 *
882 * This function maps the RGB color value to the specified pixel format and
883 * returns the pixel value best approximating the given RGB color value for
884 * the given pixel format.
885 *
886 * If the format has a palette (8-bit) the index of the closest matching color
887 * in the palette will be returned.
888 *
889 * If the specified pixel format has an alpha component it will be returned as
890 * all 1 bits (fully opaque).
891 *
892 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
893 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
894 * format the return value can be assigned to a Uint16, and similarly a Uint8
895 * for an 8-bpp format).
896 *
897 * \param format a pointer to SDL_PixelFormatDetails describing the pixel
898 * format.
899 * \param palette an optional palette for indexed formats, may be NULL.
900 * \param r the red component of the pixel in the range 0-255.
901 * \param g the green component of the pixel in the range 0-255.
902 * \param b the blue component of the pixel in the range 0-255.
903 * \returns a pixel value.
904 *
905 * \threadsafety It is safe to call this function from any thread, as long as
906 * the palette is not modified.
907 *
908 * \since This function is available since SDL 3.1.3.
909 *
910 * \sa SDL_GetPixelFormatDetails
911 * \sa SDL_GetRGB
912 * \sa SDL_MapRGBA
913 * \sa SDL_MapSurfaceRGB
914 */
915extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b);
916
917/**
918 * Map an RGBA quadruple to a pixel value for a given pixel format.
919 *
920 * This function maps the RGBA color value to the specified pixel format and
921 * returns the pixel value best approximating the given RGBA color value for
922 * the given pixel format.
923 *
924 * If the specified pixel format has no alpha component the alpha value will
925 * be ignored (as it will be in formats with a palette).
926 *
927 * If the format has a palette (8-bit) the index of the closest matching color
928 * in the palette will be returned.
929 *
930 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
931 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
932 * format the return value can be assigned to a Uint16, and similarly a Uint8
933 * for an 8-bpp format).
934 *
935 * \param format a pointer to SDL_PixelFormatDetails describing the pixel
936 * format.
937 * \param palette an optional palette for indexed formats, may be NULL.
938 * \param r the red component of the pixel in the range 0-255.
939 * \param g the green component of the pixel in the range 0-255.
940 * \param b the blue component of the pixel in the range 0-255.
941 * \param a the alpha component of the pixel in the range 0-255.
942 * \returns a pixel value.
943 *
944 * \threadsafety It is safe to call this function from any thread, as long as
945 * the palette is not modified.
946 *
947 * \since This function is available since SDL 3.1.3.
948 *
949 * \sa SDL_GetPixelFormatDetails
950 * \sa SDL_GetRGBA
951 * \sa SDL_MapRGB
952 * \sa SDL_MapSurfaceRGBA
953 */
954extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
955
956/**
957 * Get RGB values from a pixel in the specified format.
958 *
959 * This function uses the entire 8-bit [0..255] range when converting color
960 * components from pixel formats with less than 8-bits per RGB component
961 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
962 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
963 *
964 * \param pixel a pixel value.
965 * \param format a pointer to SDL_PixelFormatDetails describing the pixel
966 * format.
967 * \param palette an optional palette for indexed formats, may be NULL.
968 * \param r a pointer filled in with the red component, may be NULL.
969 * \param g a pointer filled in with the green component, may be NULL.
970 * \param b a pointer filled in with the blue component, may be NULL.
971 *
972 * \threadsafety It is safe to call this function from any thread, as long as
973 * the palette is not modified.
974 *
975 * \since This function is available since SDL 3.1.3.
976 *
977 * \sa SDL_GetPixelFormatDetails
978 * \sa SDL_GetRGBA
979 * \sa SDL_MapRGB
980 * \sa SDL_MapRGBA
981 */
982extern SDL_DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b);
983
984/**
985 * Get RGBA values from a pixel in the specified format.
986 *
987 * This function uses the entire 8-bit [0..255] range when converting color
988 * components from pixel formats with less than 8-bits per RGB component
989 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
990 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
991 *
992 * If the surface has no alpha component, the alpha will be returned as 0xff
993 * (100% opaque).
994 *
995 * \param pixel a pixel value.
996 * \param format a pointer to SDL_PixelFormatDetails describing the pixel
997 * format.
998 * \param palette an optional palette for indexed formats, may be NULL.
999 * \param r a pointer filled in with the red component, may be NULL.
1000 * \param g a pointer filled in with the green component, may be NULL.
1001 * \param b a pointer filled in with the blue component, may be NULL.
1002 * \param a a pointer filled in with the alpha component, may be NULL.
1003 *
1004 * \threadsafety It is safe to call this function from any thread, as long as
1005 * the palette is not modified.
1006 *
1007 * \since This function is available since SDL 3.1.3.
1008 *
1009 * \sa SDL_GetPixelFormatDetails
1010 * \sa SDL_GetRGB
1011 * \sa SDL_MapRGB
1012 * \sa SDL_MapRGBA
1013 */
1014extern SDL_DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1015
1016
1017/* Ends C function definitions when using C++ */
1018#ifdef __cplusplus
1019}
1020#endif
1021#include <SDL3/SDL_close_code.h>
1022
1023#endif /* SDL_pixels_h_ */
SDL_MatrixCoefficients
Definition: SDL_pixels.h:528
@ SDL_MATRIX_COEFFICIENTS_BT709
Definition: SDL_pixels.h:530
@ SDL_MATRIX_COEFFICIENTS_BT2020_CL
Definition: SDL_pixels.h:538
@ SDL_MATRIX_COEFFICIENTS_BT601
Definition: SDL_pixels.h:534
@ SDL_MATRIX_COEFFICIENTS_BT2020_NCL
Definition: SDL_pixels.h:537
@ SDL_MATRIX_COEFFICIENTS_SMPTE240
Definition: SDL_pixels.h:535
@ SDL_MATRIX_COEFFICIENTS_YCGCO
Definition: SDL_pixels.h:536
@ SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL
Definition: SDL_pixels.h:540
@ SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL
Definition: SDL_pixels.h:541
@ SDL_MATRIX_COEFFICIENTS_UNSPECIFIED
Definition: SDL_pixels.h:531
@ SDL_MATRIX_COEFFICIENTS_CUSTOM
Definition: SDL_pixels.h:543
@ SDL_MATRIX_COEFFICIENTS_ICTCP
Definition: SDL_pixels.h:542
@ SDL_MATRIX_COEFFICIENTS_IDENTITY
Definition: SDL_pixels.h:529
@ SDL_MATRIX_COEFFICIENTS_FCC
Definition: SDL_pixels.h:532
@ SDL_MATRIX_COEFFICIENTS_BT470BG
Definition: SDL_pixels.h:533
@ SDL_MATRIX_COEFFICIENTS_SMPTE2085
Definition: SDL_pixels.h:539
SDL_PixelType
Definition: SDL_pixels.h:83
@ SDL_PIXELTYPE_UNKNOWN
Definition: SDL_pixels.h:84
@ SDL_PIXELTYPE_ARRAYU16
Definition: SDL_pixels.h:92
@ SDL_PIXELTYPE_PACKED32
Definition: SDL_pixels.h:90
@ SDL_PIXELTYPE_INDEX2
Definition: SDL_pixels.h:97
@ SDL_PIXELTYPE_ARRAYU8
Definition: SDL_pixels.h:91
@ SDL_PIXELTYPE_INDEX4
Definition: SDL_pixels.h:86
@ SDL_PIXELTYPE_PACKED8
Definition: SDL_pixels.h:88
@ SDL_PIXELTYPE_ARRAYF16
Definition: SDL_pixels.h:94
@ SDL_PIXELTYPE_ARRAYU32
Definition: SDL_pixels.h:93
@ SDL_PIXELTYPE_INDEX1
Definition: SDL_pixels.h:85
@ SDL_PIXELTYPE_ARRAYF32
Definition: SDL_pixels.h:95
@ SDL_PIXELTYPE_INDEX8
Definition: SDL_pixels.h:87
@ SDL_PIXELTYPE_PACKED16
Definition: SDL_pixels.h:89
SDL_ColorRange
Definition: SDL_pixels.h:460
@ SDL_COLOR_RANGE_LIMITED
Definition: SDL_pixels.h:462
@ SDL_COLOR_RANGE_FULL
Definition: SDL_pixels.h:463
@ SDL_COLOR_RANGE_UNKNOWN
Definition: SDL_pixels.h:461
SDL_ColorPrimaries
Definition: SDL_pixels.h:473
@ SDL_COLOR_PRIMARIES_SMPTE431
Definition: SDL_pixels.h:484
@ SDL_COLOR_PRIMARIES_CUSTOM
Definition: SDL_pixels.h:487
@ SDL_COLOR_PRIMARIES_EBU3213
Definition: SDL_pixels.h:486
@ SDL_COLOR_PRIMARIES_GENERIC_FILM
Definition: SDL_pixels.h:481
@ SDL_COLOR_PRIMARIES_BT601
Definition: SDL_pixels.h:479
@ SDL_COLOR_PRIMARIES_UNSPECIFIED
Definition: SDL_pixels.h:476
@ SDL_COLOR_PRIMARIES_SMPTE240
Definition: SDL_pixels.h:480
@ SDL_COLOR_PRIMARIES_XYZ
Definition: SDL_pixels.h:483
@ SDL_COLOR_PRIMARIES_UNKNOWN
Definition: SDL_pixels.h:474
@ SDL_COLOR_PRIMARIES_SMPTE432
Definition: SDL_pixels.h:485
@ SDL_COLOR_PRIMARIES_BT2020
Definition: SDL_pixels.h:482
@ SDL_COLOR_PRIMARIES_BT470BG
Definition: SDL_pixels.h:478
@ SDL_COLOR_PRIMARIES_BT709
Definition: SDL_pixels.h:475
@ SDL_COLOR_PRIMARIES_BT470M
Definition: SDL_pixels.h:477
Uint32 SDL_MapRGB(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b)
SDL_PackedLayout
Definition: SDL_pixels.h:152
@ SDL_PACKEDLAYOUT_NONE
Definition: SDL_pixels.h:153
@ SDL_PACKEDLAYOUT_8888
Definition: SDL_pixels.h:159
@ SDL_PACKEDLAYOUT_1010102
Definition: SDL_pixels.h:161
@ SDL_PACKEDLAYOUT_565
Definition: SDL_pixels.h:158
@ SDL_PACKEDLAYOUT_332
Definition: SDL_pixels.h:154
@ SDL_PACKEDLAYOUT_5551
Definition: SDL_pixels.h:157
@ SDL_PACKEDLAYOUT_1555
Definition: SDL_pixels.h:156
@ SDL_PACKEDLAYOUT_4444
Definition: SDL_pixels.h:155
@ SDL_PACKEDLAYOUT_2101010
Definition: SDL_pixels.h:160
SDL_Palette * SDL_CreatePalette(int ncolors)
SDL_BitmapOrder
Definition: SDL_pixels.h:106
@ SDL_BITMAPORDER_1234
Definition: SDL_pixels.h:109
@ SDL_BITMAPORDER_NONE
Definition: SDL_pixels.h:107
@ SDL_BITMAPORDER_4321
Definition: SDL_pixels.h:108
SDL_ChromaLocation
Definition: SDL_pixels.h:552
@ SDL_CHROMA_LOCATION_NONE
Definition: SDL_pixels.h:553
@ SDL_CHROMA_LOCATION_TOPLEFT
Definition: SDL_pixels.h:556
@ SDL_CHROMA_LOCATION_CENTER
Definition: SDL_pixels.h:555
@ SDL_CHROMA_LOCATION_LEFT
Definition: SDL_pixels.h:554
Uint32 SDL_MapRGBA(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
void SDL_DestroyPalette(SDL_Palette *palette)
SDL_ColorType
Definition: SDL_pixels.h:447
@ SDL_COLOR_TYPE_RGB
Definition: SDL_pixels.h:449
@ SDL_COLOR_TYPE_YCBCR
Definition: SDL_pixels.h:450
@ SDL_COLOR_TYPE_UNKNOWN
Definition: SDL_pixels.h:448
SDL_TransferCharacteristics
Definition: SDL_pixels.h:498
@ SDL_TRANSFER_CHARACTERISTICS_BT709
Definition: SDL_pixels.h:500
@ SDL_TRANSFER_CHARACTERISTICS_BT1361
Definition: SDL_pixels.h:510
@ SDL_TRANSFER_CHARACTERISTICS_CUSTOM
Definition: SDL_pixels.h:517
@ SDL_TRANSFER_CHARACTERISTICS_HLG
Definition: SDL_pixels.h:516
@ SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10
Definition: SDL_pixels.h:508
@ SDL_TRANSFER_CHARACTERISTICS_UNKNOWN
Definition: SDL_pixels.h:499
@ SDL_TRANSFER_CHARACTERISTICS_BT601
Definition: SDL_pixels.h:504
@ SDL_TRANSFER_CHARACTERISTICS_IEC61966
Definition: SDL_pixels.h:509
@ SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED
Definition: SDL_pixels.h:501
@ SDL_TRANSFER_CHARACTERISTICS_SMPTE428
Definition: SDL_pixels.h:515
@ SDL_TRANSFER_CHARACTERISTICS_LOG100
Definition: SDL_pixels.h:507
@ SDL_TRANSFER_CHARACTERISTICS_GAMMA28
Definition: SDL_pixels.h:503
@ SDL_TRANSFER_CHARACTERISTICS_SMPTE240
Definition: SDL_pixels.h:505
@ SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT
Definition: SDL_pixels.h:512
@ SDL_TRANSFER_CHARACTERISTICS_SRGB
Definition: SDL_pixels.h:511
@ SDL_TRANSFER_CHARACTERISTICS_PQ
Definition: SDL_pixels.h:514
@ SDL_TRANSFER_CHARACTERISTICS_LINEAR
Definition: SDL_pixels.h:506
@ SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT
Definition: SDL_pixels.h:513
@ SDL_TRANSFER_CHARACTERISTICS_GAMMA22
Definition: SDL_pixels.h:502
SDL_ArrayOrder
Definition: SDL_pixels.h:136
@ SDL_ARRAYORDER_RGB
Definition: SDL_pixels.h:138
@ SDL_ARRAYORDER_NONE
Definition: SDL_pixels.h:137
@ SDL_ARRAYORDER_ARGB
Definition: SDL_pixels.h:140
@ SDL_ARRAYORDER_BGRA
Definition: SDL_pixels.h:142
@ SDL_ARRAYORDER_ABGR
Definition: SDL_pixels.h:143
@ SDL_ARRAYORDER_RGBA
Definition: SDL_pixels.h:139
@ SDL_ARRAYORDER_BGR
Definition: SDL_pixels.h:141
bool SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
const char * SDL_GetPixelFormatName(SDL_PixelFormat format)
SDL_Colorspace
Definition: SDL_pixels.h:594
@ SDL_COLORSPACE_BT2020_LIMITED
Definition: SDL_pixels.h:664
@ SDL_COLORSPACE_BT601_LIMITED
Definition: SDL_pixels.h:632
@ SDL_COLORSPACE_BT709_FULL
Definition: SDL_pixels.h:656
@ SDL_COLORSPACE_HDR10
Definition: SDL_pixels.h:616
@ SDL_COLORSPACE_BT601_FULL
Definition: SDL_pixels.h:640
@ SDL_COLORSPACE_UNKNOWN
Definition: SDL_pixels.h:595
@ SDL_COLORSPACE_BT2020_FULL
Definition: SDL_pixels.h:672
@ SDL_COLORSPACE_JPEG
Definition: SDL_pixels.h:624
@ SDL_COLORSPACE_BT709_LIMITED
Definition: SDL_pixels.h:648
@ SDL_COLORSPACE_SRGB_LINEAR
Definition: SDL_pixels.h:607
@ SDL_COLORSPACE_SRGB
Definition: SDL_pixels.h:598
@ SDL_COLORSPACE_RGB_DEFAULT
Definition: SDL_pixels.h:680
@ SDL_COLORSPACE_YUV_DEFAULT
Definition: SDL_pixels.h:681
SDL_PixelFormat
Definition: SDL_pixels.h:265
@ SDL_PIXELFORMAT_BGR48_FLOAT
Definition: SDL_pixels.h:353
@ SDL_PIXELFORMAT_RGBA128_FLOAT
Definition: SDL_pixels.h:367
@ SDL_PIXELFORMAT_BGR565
Definition: SDL_pixels.h:309
@ SDL_PIXELFORMAT_P010
Definition: SDL_pixels.h:390
@ SDL_PIXELFORMAT_EXTERNAL_OES
Definition: SDL_pixels.h:392
@ SDL_PIXELFORMAT_ARGB64
Definition: SDL_pixels.h:345
@ SDL_PIXELFORMAT_YVYU
Definition: SDL_pixels.h:384
@ SDL_PIXELFORMAT_RGB332
Definition: SDL_pixels.h:281
@ SDL_PIXELFORMAT_INDEX2LSB
Definition: SDL_pixels.h:271
@ SDL_PIXELFORMAT_INDEX1LSB
Definition: SDL_pixels.h:267
@ SDL_PIXELFORMAT_RGB96_FLOAT
Definition: SDL_pixels.h:363
@ SDL_PIXELFORMAT_RGBX32
Definition: SDL_pixels.h:401
@ SDL_PIXELFORMAT_ABGR4444
Definition: SDL_pixels.h:295
@ SDL_PIXELFORMAT_BGRA4444
Definition: SDL_pixels.h:297
@ SDL_PIXELFORMAT_BGR24
Definition: SDL_pixels.h:313
@ SDL_PIXELFORMAT_INDEX4MSB
Definition: SDL_pixels.h:277
@ SDL_PIXELFORMAT_ABGR2101010
Definition: SDL_pixels.h:337
@ SDL_PIXELFORMAT_BGRA32
Definition: SDL_pixels.h:399
@ SDL_PIXELFORMAT_XBGR2101010
Definition: SDL_pixels.h:333
@ SDL_PIXELFORMAT_RGBA64_FLOAT
Definition: SDL_pixels.h:355
@ SDL_PIXELFORMAT_INDEX2MSB
Definition: SDL_pixels.h:273
@ SDL_PIXELFORMAT_BGRA64_FLOAT
Definition: SDL_pixels.h:359
@ SDL_PIXELFORMAT_RGBA8888
Definition: SDL_pixels.h:325
@ SDL_PIXELFORMAT_RGBA5551
Definition: SDL_pixels.h:301
@ SDL_PIXELFORMAT_ARGB1555
Definition: SDL_pixels.h:299
@ SDL_PIXELFORMAT_XBGR4444
Definition: SDL_pixels.h:285
@ SDL_PIXELFORMAT_RGBA64
Definition: SDL_pixels.h:343
@ SDL_PIXELFORMAT_INDEX8
Definition: SDL_pixels.h:279
@ SDL_PIXELFORMAT_XRGB2101010
Definition: SDL_pixels.h:331
@ SDL_PIXELFORMAT_XRGB8888
Definition: SDL_pixels.h:315
@ SDL_PIXELFORMAT_UYVY
Definition: SDL_pixels.h:382
@ SDL_PIXELFORMAT_BGRX32
Definition: SDL_pixels.h:403
@ SDL_PIXELFORMAT_YV12
Definition: SDL_pixels.h:376
@ SDL_PIXELFORMAT_ABGR32
Definition: SDL_pixels.h:400
@ SDL_PIXELFORMAT_BGRX8888
Definition: SDL_pixels.h:321
@ SDL_PIXELFORMAT_RGB24
Definition: SDL_pixels.h:311
@ SDL_PIXELFORMAT_BGRA64
Definition: SDL_pixels.h:347
@ SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:327
@ SDL_PIXELFORMAT_YUY2
Definition: SDL_pixels.h:380
@ SDL_PIXELFORMAT_XBGR32
Definition: SDL_pixels.h:404
@ SDL_PIXELFORMAT_NV12
Definition: SDL_pixels.h:386
@ SDL_PIXELFORMAT_BGRA8888
Definition: SDL_pixels.h:329
@ SDL_PIXELFORMAT_ABGR128_FLOAT
Definition: SDL_pixels.h:373
@ SDL_PIXELFORMAT_ARGB32
Definition: SDL_pixels.h:398
@ SDL_PIXELFORMAT_ABGR1555
Definition: SDL_pixels.h:303
@ SDL_PIXELFORMAT_NV21
Definition: SDL_pixels.h:388
@ SDL_PIXELFORMAT_IYUV
Definition: SDL_pixels.h:378
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:323
@ SDL_PIXELFORMAT_ABGR64_FLOAT
Definition: SDL_pixels.h:361
@ SDL_PIXELFORMAT_ABGR64
Definition: SDL_pixels.h:349
@ SDL_PIXELFORMAT_XRGB32
Definition: SDL_pixels.h:402
@ SDL_PIXELFORMAT_XBGR1555
Definition: SDL_pixels.h:289
@ SDL_PIXELFORMAT_RGB48
Definition: SDL_pixels.h:339
@ SDL_PIXELFORMAT_XRGB4444
Definition: SDL_pixels.h:283
@ SDL_PIXELFORMAT_BGR96_FLOAT
Definition: SDL_pixels.h:365
@ SDL_PIXELFORMAT_ARGB4444
Definition: SDL_pixels.h:291
@ SDL_PIXELFORMAT_RGB48_FLOAT
Definition: SDL_pixels.h:351
@ SDL_PIXELFORMAT_BGR48
Definition: SDL_pixels.h:341
@ SDL_PIXELFORMAT_RGBA32
Definition: SDL_pixels.h:397
@ SDL_PIXELFORMAT_BGRA128_FLOAT
Definition: SDL_pixels.h:371
@ SDL_PIXELFORMAT_ARGB64_FLOAT
Definition: SDL_pixels.h:357
@ SDL_PIXELFORMAT_INDEX1MSB
Definition: SDL_pixels.h:269
@ SDL_PIXELFORMAT_INDEX4LSB
Definition: SDL_pixels.h:275
@ SDL_PIXELFORMAT_RGBX8888
Definition: SDL_pixels.h:317
@ SDL_PIXELFORMAT_BGRA5551
Definition: SDL_pixels.h:305
@ SDL_PIXELFORMAT_ARGB128_FLOAT
Definition: SDL_pixels.h:369
@ SDL_PIXELFORMAT_XRGB1555
Definition: SDL_pixels.h:287
@ SDL_PIXELFORMAT_RGB565
Definition: SDL_pixels.h:307
@ SDL_PIXELFORMAT_XBGR8888
Definition: SDL_pixels.h:319
@ SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:335
@ SDL_PIXELFORMAT_UNKNOWN
Definition: SDL_pixels.h:266
@ SDL_PIXELFORMAT_RGBA4444
Definition: SDL_pixels.h:293
void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b)
const SDL_PixelFormatDetails * SDL_GetPixelFormatDetails(SDL_PixelFormat format)
SDL_PackedOrder
Definition: SDL_pixels.h:118
@ SDL_PACKEDORDER_NONE
Definition: SDL_pixels.h:119
@ SDL_PACKEDORDER_RGBX
Definition: SDL_pixels.h:121
@ SDL_PACKEDORDER_BGRX
Definition: SDL_pixels.h:125
@ SDL_PACKEDORDER_XBGR
Definition: SDL_pixels.h:124
@ SDL_PACKEDORDER_RGBA
Definition: SDL_pixels.h:123
@ SDL_PACKEDORDER_ABGR
Definition: SDL_pixels.h:126
@ SDL_PACKEDORDER_BGRA
Definition: SDL_pixels.h:127
@ SDL_PACKEDORDER_XRGB
Definition: SDL_pixels.h:120
@ SDL_PACKEDORDER_ARGB
Definition: SDL_pixels.h:122
bool SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)
SDL_PixelFormat SDL_GetPixelFormatForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
uint8_t Uint8
Definition: SDL_stdinc.h:334
uint32_t Uint32
Definition: SDL_stdinc.h:370
Uint8 r
Definition: SDL_pixels.h:696
Uint8 b
Definition: SDL_pixels.h:698
Uint8 a
Definition: SDL_pixels.h:699
Uint8 g
Definition: SDL_pixels.h:697
Uint32 version
Definition: SDL_pixels.h:727
SDL_Color * colors
Definition: SDL_pixels.h:726
SDL_PixelFormat format
Definition: SDL_pixels.h:738