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 * \file SDL_pixels.h
24 *
25 * Header for the enumerated pixel format definitions.
26 *
27 * SDL's pixel formats have the following naming convention:
28 *
29 * * Names with a list of components and a single bit count, such as
30 * RGB24 and ABGR32, define a platform-independent encoding into
31 * bytes in the order specified. For example, in RGB24 data, each
32 * pixel is encoded in 3 bytes (red, green, blue) in that order,
33 * and in ABGR32 data, each pixel is encoded in 4 bytes
34 * (alpha, blue, green, red) in that order. Use these names if the
35 * property of a format that is important to you is the order of
36 * the bytes in memory or on disk.
37 *
38 * * Names with a bit count per component, such as ARGB8888 and
39 * XRGB1555, are "packed" into an appropriately-sized integer in
40 * the platform's native endianness. For example, ARGB8888 is
41 * a sequence of 32-bit integers; in each integer, the most
42 * significant bits are alpha, and the least significant bits are
43 * blue. On a little-endian CPU such as x86, the least significant
44 * bits of each integer are arranged first in memory, but on a
45 * big-endian CPU such as s390x, the most significant bits are
46 * arranged first. Use these names if the property of a format that
47 * is important to you is the meaning of each bit position within a
48 * native-endianness integer.
49 *
50 * * In indexed formats such as INDEX4LSB, each pixel is represented
51 * by encoding an index into the palette into the indicated number
52 * of bits, with multiple pixels packed into each byte if appropriate.
53 * In LSB formats, the first (leftmost) pixel is stored in the
54 * least-significant bits of the byte; in MSB formats, it's stored
55 * in the most-significant bits. INDEX8 does not need LSB/MSB
56 * variants, because each pixel exactly fills one byte.
57 *
58 * The 32-bit byte-array encodings such as RGBA32 are aliases for the
59 * appropriate 8888 encoding for the current platform. For example,
60 * RGBA32 is an alias for ABGR8888 on little-endian CPUs like x86,
61 * or an alias for RGBA8888 on big-endian CPUs.
62 */
63
64#ifndef SDL_pixels_h_
65#define SDL_pixels_h_
66
67#include <SDL3/SDL_stdinc.h>
68#include <SDL3/SDL_endian.h>
69
70#include <SDL3/SDL_begin_code.h>
71/* Set up for C function definitions, even when using C++ */
72#ifdef __cplusplus
73extern "C" {
74#endif
75
76/**
77 * \name Transparency definitions
78 *
79 * These define alpha as the opacity of a surface.
80 */
81/* @{ */
82#define SDL_ALPHA_OPAQUE 255
83#define SDL_ALPHA_TRANSPARENT 0
84/* @} */
85
86/** Pixel type. */
104
105/** Bitmap pixel order, high bit -> low bit. */
112
113/** Packed component order, high bit -> low bit. */
126
127/** Array component order, low byte -> high byte. */
138
139/** Packed component layout. */
152
153#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
154
155#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
156 ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
157 ((bits) << 8) | ((bytes) << 0))
158
159#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
160#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
161#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
162#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
163#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
164#define SDL_BYTESPERPIXEL(X) \
165 (SDL_ISPIXELFORMAT_FOURCC(X) ? \
166 ((((X) == SDL_PIXELFORMAT_YUY2) || \
167 ((X) == SDL_PIXELFORMAT_UYVY) || \
168 ((X) == SDL_PIXELFORMAT_YVYU) || \
169 ((X) == SDL_PIXELFORMAT_P010)) ? 2 : 1) : (((X) >> 0) & 0xFF))
170
171#define SDL_ISPIXELFORMAT_INDEXED(format) \
172 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
173 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
174 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
175 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
176 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
177
178#define SDL_ISPIXELFORMAT_PACKED(format) \
179 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
180 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
181 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
182 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
183
184#define SDL_ISPIXELFORMAT_ARRAY(format) \
185 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
186 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
187 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
188 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
189 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
190 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
191
192#define SDL_ISPIXELFORMAT_ALPHA(format) \
193 ((SDL_ISPIXELFORMAT_PACKED(format) && \
194 ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
195 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
196 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
197 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))))
198
199#define SDL_ISPIXELFORMAT_10BIT(format) \
200 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
201 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32) && \
202 (SDL_PIXELLAYOUT(format) == SDL_PACKEDLAYOUT_2101010)))
203
204#define SDL_ISPIXELFORMAT_FLOAT(format) \
205 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
206 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
207 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
208
209/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
210#define SDL_ISPIXELFORMAT_FOURCC(format) \
211 ((format) && (SDL_PIXELFLAG(format) != 1))
212
213/* Note: If you modify this list, update SDL_GetPixelFormatName() */
214typedef enum
215{
219 1, 0),
222 1, 0),
225 2, 0),
228 2, 0),
231 4, 0),
234 4, 0),
288 24, 3),
291 24, 3),
330 48, 6),
333 48, 6),
336 64, 8),
339 64, 8),
342 64, 8),
345 64, 8),
348 48, 6),
351 48, 6),
354 64, 8),
357 64, 8),
360 64, 8),
363 64, 8),
366 96, 12),
369 96, 12),
372 128, 16),
375 128, 16),
378 128, 16),
381 128, 16),
382
383 /* Aliases for RGBA byte arrays of color data, for the current platform */
384#if SDL_BYTEORDER == SDL_BIG_ENDIAN
393#else
402#endif
403
404 SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
405 SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
406 SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
407 SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
408 SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
409 SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
410 SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
411 SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
412 SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
413 SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
414 SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
415 SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
416 SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
417 SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
418 SDL_PIXELFORMAT_P010 = /**< Planar mode: Y + U/V interleaved (2 planes) */
419 SDL_DEFINE_PIXELFOURCC('P', '0', '1', '0'),
420 SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
421 SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
423
424/**
425 * Pixels are a representation of a color in a particular color space.
426 *
427 * 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.
428 *
429 * RGB colors consist of red, green, and blue channels of color that are added together to represent the colors we see on the screen.
430 * https://en.wikipedia.org/wiki/RGB_color_model
431 *
432 * 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.
433 * https://en.wikipedia.org/wiki/YCbCr
434 *
435 * 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.
436 *
437 * 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.
438 *
439 * The color primaries and white point are a definition of the colors in the color space relative to the standard XYZ color space.
440 * https://en.wikipedia.org/wiki/CIE_1931_color_space
441 *
442 * 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.
443 * https://en.wikipedia.org/wiki/Rec._709#Transfer_characteristics
444 *
445 * The matrix coefficients are used to convert between YCbCr and RGB colors.
446 */
447
448/**
449 * The color type
450 */
457
458/**
459 * The color range, as described by https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en
460 */
461typedef enum
462{
464 SDL_COLOR_RANGE_LIMITED = 1, /**< Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma */
465 SDL_COLOR_RANGE_FULL = 2 /**< Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma */
467
468/**
469 * The color primaries, as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
470 */
471typedef enum
472{
474 SDL_COLOR_PRIMARIES_BT709 = 1, /**< ITU-R BT.709-6 */
476 SDL_COLOR_PRIMARIES_BT470M = 4, /**< ITU-R BT.470-6 System M */
477 SDL_COLOR_PRIMARIES_BT470BG = 5, /**< ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 */
478 SDL_COLOR_PRIMARIES_BT601 = 6, /**< ITU-R BT.601-7 525 */
479 SDL_COLOR_PRIMARIES_SMPTE240 = 7, /**< SMPTE 240M, functionally the same as SDL_COLOR_PRIMARIES_BT601 */
480 SDL_COLOR_PRIMARIES_GENERIC_FILM = 8, /**< Generic film (color filters using Illuminant C) */
481 SDL_COLOR_PRIMARIES_BT2020 = 9, /**< ITU-R BT.2020-2 / ITU-R BT.2100-0 */
482 SDL_COLOR_PRIMARIES_XYZ = 10, /**< SMPTE ST 428-1 */
483 SDL_COLOR_PRIMARIES_SMPTE431 = 11, /**< SMPTE RP 431-2 */
484 SDL_COLOR_PRIMARIES_SMPTE432 = 12, /**< SMPTE EG 432-1 / DCI P3 */
485 SDL_COLOR_PRIMARIES_EBU3213 = 22, /**< EBU Tech. 3213-E */
488
489/**
490 * The transfer characteristics, as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
491 */
492typedef enum
493{
495 SDL_TRANSFER_CHARACTERISTICS_BT709 = 1, /**< Rec. ITU-R BT.709-6 / ITU-R BT1361 */
497 SDL_TRANSFER_CHARACTERISTICS_GAMMA22 = 4, /**< ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM */
498 SDL_TRANSFER_CHARACTERISTICS_GAMMA28 = 5, /**< ITU-R BT.470-6 System B, G */
499 SDL_TRANSFER_CHARACTERISTICS_BT601 = 6, /**< SMPTE ST 170M / ITU-R BT.601-7 525 or 625 */
500 SDL_TRANSFER_CHARACTERISTICS_SMPTE240 = 7, /**< SMPTE ST 240M */
504 SDL_TRANSFER_CHARACTERISTICS_IEC61966 = 11, /**< IEC 61966-2-4 */
505 SDL_TRANSFER_CHARACTERISTICS_BT1361 = 12, /**< ITU-R BT1361 Extended Colour Gamut */
506 SDL_TRANSFER_CHARACTERISTICS_SRGB = 13, /**< IEC 61966-2-1 (sRGB or sYCC) */
507 SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT = 14, /**< ITU-R BT2020 for 10-bit system */
508 SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT = 15, /**< ITU-R BT2020 for 12-bit system */
509 SDL_TRANSFER_CHARACTERISTICS_PQ = 16, /**< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems */
510 SDL_TRANSFER_CHARACTERISTICS_SMPTE428 = 17, /**< SMPTE ST 428-1 */
511 SDL_TRANSFER_CHARACTERISTICS_HLG = 18, /**< ARIB STD-B67, known as "hybrid log-gamma" (HLG) */
514
515/**
516 * The matrix coefficients, as described by https://www.itu.int/rec/T-REC-H.273-201612-S/en
517 */
518typedef enum
519{
521 SDL_MATRIX_COEFFICIENTS_BT709 = 1, /**< ITU-R BT.709-6 */
523 SDL_MATRIX_COEFFICIENTS_FCC = 4, /**< US FCC */
524 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 */
525 SDL_MATRIX_COEFFICIENTS_BT601 = 6, /**< ITU-R BT.601-7 525 */
526 SDL_MATRIX_COEFFICIENTS_SMPTE240 = 7, /**< SMPTE 240M */
528 SDL_MATRIX_COEFFICIENTS_BT2020_NCL = 9, /**< ITU-R BT.2020-2 non-constant luminance */
529 SDL_MATRIX_COEFFICIENTS_BT2020_CL = 10, /**< ITU-R BT.2020-2 constant luminance */
530 SDL_MATRIX_COEFFICIENTS_SMPTE2085 = 11, /**< SMPTE ST 2085 */
533 SDL_MATRIX_COEFFICIENTS_ICTCP = 14, /**< ITU-R BT.2100-0 ICTCP */
536
537/**
538 * The chroma sample location
539 */
540typedef enum
541{
542 SDL_CHROMA_LOCATION_NONE = 0, /**< RGB, no chroma sampling */
543 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. */
544 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. */
545 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"). */
547
548
549/* Colorspace definition */
550#define SDL_DEFINE_COLORSPACE(type, range, primaries, transfer, matrix, chroma) \
551 (((Uint32)(type) << 28) | ((Uint32)(range) << 24) | ((Uint32)(chroma) << 20) | \
552 ((Uint32)(primaries) << 10) | ((Uint32)(transfer) << 5) | ((Uint32)(matrix) << 0))
553
554#define SDL_COLORSPACETYPE(X) (SDL_ColorType)(((X) >> 28) & 0x0F)
555#define SDL_COLORSPACERANGE(X) (SDL_ColorRange)(((X) >> 24) & 0x0F)
556#define SDL_COLORSPACECHROMA(X) (SDL_ChromaLocation)(((X) >> 20) & 0x0F)
557#define SDL_COLORSPACEPRIMARIES(X) (SDL_ColorPrimaries)(((X) >> 10) & 0x1F)
558#define SDL_COLORSPACETRANSFER(X) (SDL_TransferCharacteristics)(((X) >> 5) & 0x1F)
559#define SDL_COLORSPACEMATRIX(X) (SDL_MatrixCoefficients)((X) & 0x1F)
560
561#define SDL_ISCOLORSPACE_MATRIX_BT601(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT601 || SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT470BG)
562#define SDL_ISCOLORSPACE_MATRIX_BT709(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT709)
563#define SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT2020_NCL)
564#define SDL_ISCOLORSPACE_LIMITED_RANGE(X) (SDL_COLORSPACERANGE(X) != SDL_COLOR_RANGE_FULL)
565#define SDL_ISCOLORSPACE_FULL_RANGE(X) (SDL_COLORSPACERANGE(X) == SDL_COLOR_RANGE_FULL)
566
567typedef enum
568{
570
571 /* sRGB is a gamma corrected colorspace, and the default colorspace for SDL rendering and 8-bit RGB surfaces */
572 SDL_COLORSPACE_SRGB = /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 */
579
580 /* 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 */
581 SDL_COLORSPACE_SRGB_LINEAR = /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 */
588
589 /* HDR10 is a non-linear HDR colorspace and the default colorspace for 10-bit surfaces */
590 SDL_COLORSPACE_HDR10 = /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 */
597
598 SDL_COLORSPACE_JPEG = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 */
605
606 SDL_COLORSPACE_BT601_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */
613
614 SDL_COLORSPACE_BT601_FULL = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */
621
622 SDL_COLORSPACE_BT709_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 */
629
630 SDL_COLORSPACE_BT709_FULL = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 */
637
638 SDL_COLORSPACE_BT2020_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 */
645
646 SDL_COLORSPACE_BT2020_FULL = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 */
653
654 /* The default colorspace for RGB surfaces if no colorspace is specified */
656
657 /* The default colorspace for YUV surfaces if no colorspace is specified */
659
661
662/**
663 * The bits of this structure can be directly reinterpreted as an integer-packed
664 * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
665 * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
666 */
674#define SDL_Colour SDL_Color
675
676/**
677 * The bits of this structure can be directly reinterpreted as a float-packed
678 * color which uses the SDL_PIXELFORMAT_RGBA128_FLOAT format
679 */
680typedef struct SDL_FColor
681{
682 float r;
683 float g;
684 float b;
685 float a;
686} SDL_FColor;
687#define SDL_FColour SDL_FColor
688
696
697/**
698 * \note Everything in the pixel format structure is read-only.
699 */
722
723/**
724 * Get the human readable name of a pixel format.
725 *
726 * \param format the pixel format to query
727 * \returns the human readable name of the specified pixel format or
728 * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
729 *
730 * \since This function is available since SDL 3.0.0.
731 */
732extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(SDL_PixelFormatEnum format);
733
734/**
735 * Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
736 *
737 * \param format one of the SDL_PixelFormatEnum values
738 * \param bpp a bits per pixel value; usually 15, 16, or 32
739 * \param Rmask a pointer filled in with the red mask for the format
740 * \param Gmask a pointer filled in with the green mask for the format
741 * \param Bmask a pointer filled in with the blue mask for the format
742 * \param Amask a pointer filled in with the alpha mask for the format
743 * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
744 * possible; call SDL_GetError() for more information.
745 *
746 * \since This function is available since SDL 3.0.0.
747 *
748 * \sa SDL_GetPixelFormatEnumForMasks
749 */
751 int *bpp,
752 Uint32 * Rmask,
753 Uint32 * Gmask,
754 Uint32 * Bmask,
755 Uint32 * Amask);
756
757/**
758 * Convert a bpp value and RGBA masks to an enumerated pixel format.
759 *
760 * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
761 * possible.
762 *
763 * \param bpp a bits per pixel value; usually 15, 16, or 32
764 * \param Rmask the red mask for the format
765 * \param Gmask the green mask for the format
766 * \param Bmask the blue mask for the format
767 * \param Amask the alpha mask for the format
768 * \returns the SDL_PixelFormatEnum value corresponding to the format masks,
769 * or SDL_PIXELFORMAT_UNKNOWN if there isn't a match.
770 *
771 * \since This function is available since SDL 3.0.0.
772 *
773 * \sa SDL_GetMasksForPixelFormatEnum
774 */
779 Uint32 Amask);
780
781/**
782 * Create an SDL_PixelFormat structure corresponding to a pixel format.
783 *
784 * Returned structure may come from a shared global cache (i.e. not newly
785 * allocated), and hence should not be modified, especially the palette. Weird
786 * errors such as `Blit combination not supported` may occur.
787 *
788 * \param pixel_format one of the SDL_PixelFormatEnum values
789 * \returns the new SDL_PixelFormat structure or NULL on failure; call
790 * SDL_GetError() for more information.
791 *
792 * \since This function is available since SDL 3.0.0.
793 *
794 * \sa SDL_DestroyPixelFormat
795 * \sa SDL_SetPixelFormatPalette
796 */
797extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_CreatePixelFormat(SDL_PixelFormatEnum pixel_format);
798
799/**
800 * Free an SDL_PixelFormat structure allocated by SDL_CreatePixelFormat().
801 *
802 * \param format the SDL_PixelFormat structure to free
803 *
804 * \since This function is available since SDL 3.0.0.
805 *
806 * \sa SDL_CreatePixelFormat
807 */
808extern DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
809
810/**
811 * Create a palette structure with the specified number of color entries.
812 *
813 * The palette entries are initialized to white.
814 *
815 * \param ncolors represents the number of color entries in the color palette
816 * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
817 * there wasn't enough memory); call SDL_GetError() for more
818 * information.
819 *
820 * \since This function is available since SDL 3.0.0.
821 *
822 * \sa SDL_DestroyPalette
823 * \sa SDL_SetPaletteColors
824 * \sa SDL_SetPixelFormatPalette
825 */
826extern DECLSPEC SDL_Palette *SDLCALL SDL_CreatePalette(int ncolors);
827
828/**
829 * Set the palette for a pixel format structure.
830 *
831 * \param format the SDL_PixelFormat structure that will use the palette
832 * \param palette the SDL_Palette structure that will be used
833 * \returns 0 on success or a negative error code on failure; call
834 * SDL_GetError() for more information.
835 *
836 * \since This function is available since SDL 3.0.0.
837 */
840
841/**
842 * Set a range of colors in a palette.
843 *
844 * \param palette the SDL_Palette structure to modify
845 * \param colors an array of SDL_Color structures to copy into the palette
846 * \param firstcolor the index of the first palette entry to modify
847 * \param ncolors the number of entries to modify
848 * \returns 0 on success or a negative error code on failure; call
849 * SDL_GetError() for more information.
850 *
851 * \since This function is available since SDL 3.0.0.
852 */
853extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
854 const SDL_Color * colors,
855 int firstcolor, int ncolors);
856
857/**
858 * Free a palette created with SDL_CreatePalette().
859 *
860 * \param palette the SDL_Palette structure to be freed
861 *
862 * \since This function is available since SDL 3.0.0.
863 *
864 * \sa SDL_CreatePalette
865 */
866extern DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
867
868/**
869 * Map an RGB triple to an opaque pixel value for a given pixel format.
870 *
871 * This function maps the RGB color value to the specified pixel format and
872 * returns the pixel value best approximating the given RGB color value for
873 * the given pixel format.
874 *
875 * If the format has a palette (8-bit) the index of the closest matching color
876 * in the palette will be returned.
877 *
878 * If the specified pixel format has an alpha component it will be returned as
879 * all 1 bits (fully opaque).
880 *
881 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
882 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
883 * format the return value can be assigned to a Uint16, and similarly a Uint8
884 * for an 8-bpp format).
885 *
886 * \param format an SDL_PixelFormat structure describing the pixel format
887 * \param r the red component of the pixel in the range 0-255
888 * \param g the green component of the pixel in the range 0-255
889 * \param b the blue component of the pixel in the range 0-255
890 * \returns a pixel value
891 *
892 * \since This function is available since SDL 3.0.0.
893 *
894 * \sa SDL_GetRGB
895 * \sa SDL_GetRGBA
896 * \sa SDL_MapRGBA
897 */
898extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
899 Uint8 r, Uint8 g, Uint8 b);
900
901/**
902 * Map an RGBA quadruple to a pixel value for a given pixel format.
903 *
904 * This function maps the RGBA color value to the specified pixel format and
905 * returns the pixel value best approximating the given RGBA color value for
906 * the given pixel format.
907 *
908 * If the specified pixel format has no alpha component the alpha value will
909 * be ignored (as it will be in formats with a palette).
910 *
911 * If the format has a palette (8-bit) the index of the closest matching color
912 * in the palette will be returned.
913 *
914 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
915 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
916 * format the return value can be assigned to a Uint16, and similarly a Uint8
917 * for an 8-bpp format).
918 *
919 * \param format an SDL_PixelFormat structure describing the format of the
920 * pixel
921 * \param r the red component of the pixel in the range 0-255
922 * \param g the green component of the pixel in the range 0-255
923 * \param b the blue component of the pixel in the range 0-255
924 * \param a the alpha component of the pixel in the range 0-255
925 * \returns a pixel value
926 *
927 * \since This function is available since SDL 3.0.0.
928 *
929 * \sa SDL_GetRGB
930 * \sa SDL_GetRGBA
931 * \sa SDL_MapRGB
932 */
933extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
934 Uint8 r, Uint8 g, Uint8 b,
935 Uint8 a);
936
937/**
938 * Get RGB values from a pixel in the specified format.
939 *
940 * This function uses the entire 8-bit [0..255] range when converting color
941 * components from pixel formats with less than 8-bits per RGB component
942 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
943 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
944 *
945 * \param pixel a pixel value
946 * \param format an SDL_PixelFormat structure describing the format of the
947 * pixel
948 * \param r a pointer filled in with the red component
949 * \param g a pointer filled in with the green component
950 * \param b a pointer filled in with the blue component
951 *
952 * \since This function is available since SDL 3.0.0.
953 *
954 * \sa SDL_GetRGBA
955 * \sa SDL_MapRGB
956 * \sa SDL_MapRGBA
957 */
958extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
959 const SDL_PixelFormat * format,
960 Uint8 * r, Uint8 * g, Uint8 * b);
961
962/**
963 * Get RGBA values from a pixel in the specified format.
964 *
965 * This function uses the entire 8-bit [0..255] range when converting color
966 * components from pixel formats with less than 8-bits per RGB component
967 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
968 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
969 *
970 * If the surface has no alpha component, the alpha will be returned as 0xff
971 * (100% opaque).
972 *
973 * \param pixel a pixel value
974 * \param format an SDL_PixelFormat structure describing the format of the
975 * pixel
976 * \param r a pointer filled in with the red component
977 * \param g a pointer filled in with the green component
978 * \param b a pointer filled in with the blue component
979 * \param a a pointer filled in with the alpha component
980 *
981 * \since This function is available since SDL 3.0.0.
982 *
983 * \sa SDL_GetRGB
984 * \sa SDL_MapRGB
985 * \sa SDL_MapRGBA
986 */
987extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
988 const SDL_PixelFormat * format,
989 Uint8 * r, Uint8 * g, Uint8 * b,
990 Uint8 * a);
991
992
993/* Ends C function definitions when using C++ */
994#ifdef __cplusplus
995}
996#endif
997#include <SDL3/SDL_close_code.h>
998
999#endif /* SDL_pixels_h_ */
int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)
int SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette)
SDL_PixelFormatEnum SDL_GetPixelFormatEnumForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
const char * SDL_GetPixelFormatName(SDL_PixelFormatEnum format)
SDL_MatrixCoefficients
Definition SDL_pixels.h:519
@ SDL_MATRIX_COEFFICIENTS_BT709
Definition SDL_pixels.h:521
@ SDL_MATRIX_COEFFICIENTS_BT2020_CL
Definition SDL_pixels.h:529
@ SDL_MATRIX_COEFFICIENTS_BT601
Definition SDL_pixels.h:525
@ SDL_MATRIX_COEFFICIENTS_BT2020_NCL
Definition SDL_pixels.h:528
@ SDL_MATRIX_COEFFICIENTS_SMPTE240
Definition SDL_pixels.h:526
@ SDL_MATRIX_COEFFICIENTS_YCGCO
Definition SDL_pixels.h:527
@ SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL
Definition SDL_pixels.h:531
@ SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL
Definition SDL_pixels.h:532
@ SDL_MATRIX_COEFFICIENTS_UNSPECIFIED
Definition SDL_pixels.h:522
@ SDL_MATRIX_COEFFICIENTS_CUSTOM
Definition SDL_pixels.h:534
@ SDL_MATRIX_COEFFICIENTS_ICTCP
Definition SDL_pixels.h:533
@ SDL_MATRIX_COEFFICIENTS_IDENTITY
Definition SDL_pixels.h:520
@ SDL_MATRIX_COEFFICIENTS_FCC
Definition SDL_pixels.h:523
@ SDL_MATRIX_COEFFICIENTS_BT470BG
Definition SDL_pixels.h:524
@ SDL_MATRIX_COEFFICIENTS_SMPTE2085
Definition SDL_pixels.h:530
SDL_PixelType
Definition SDL_pixels.h:88
@ SDL_PIXELTYPE_UNKNOWN
Definition SDL_pixels.h:89
@ SDL_PIXELTYPE_ARRAYU16
Definition SDL_pixels.h:97
@ SDL_PIXELTYPE_PACKED32
Definition SDL_pixels.h:95
@ SDL_PIXELTYPE_INDEX2
Definition SDL_pixels.h:102
@ SDL_PIXELTYPE_ARRAYU8
Definition SDL_pixels.h:96
@ SDL_PIXELTYPE_INDEX4
Definition SDL_pixels.h:91
@ SDL_PIXELTYPE_PACKED8
Definition SDL_pixels.h:93
@ SDL_PIXELTYPE_ARRAYF16
Definition SDL_pixels.h:99
@ SDL_PIXELTYPE_ARRAYU32
Definition SDL_pixels.h:98
@ SDL_PIXELTYPE_INDEX1
Definition SDL_pixels.h:90
@ SDL_PIXELTYPE_ARRAYF32
Definition SDL_pixels.h:100
@ SDL_PIXELTYPE_INDEX8
Definition SDL_pixels.h:92
@ SDL_PIXELTYPE_PACKED16
Definition SDL_pixels.h:94
SDL_ColorRange
Definition SDL_pixels.h:462
@ SDL_COLOR_RANGE_LIMITED
Definition SDL_pixels.h:464
@ SDL_COLOR_RANGE_FULL
Definition SDL_pixels.h:465
@ SDL_COLOR_RANGE_UNKNOWN
Definition SDL_pixels.h:463
void SDL_DestroyPixelFormat(SDL_PixelFormat *format)
Uint32 SDL_MapRGBA(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
SDL_ColorPrimaries
Definition SDL_pixels.h:472
@ SDL_COLOR_PRIMARIES_SMPTE431
Definition SDL_pixels.h:483
@ SDL_COLOR_PRIMARIES_CUSTOM
Definition SDL_pixels.h:486
@ SDL_COLOR_PRIMARIES_EBU3213
Definition SDL_pixels.h:485
@ SDL_COLOR_PRIMARIES_GENERIC_FILM
Definition SDL_pixels.h:480
@ SDL_COLOR_PRIMARIES_BT601
Definition SDL_pixels.h:478
@ SDL_COLOR_PRIMARIES_UNSPECIFIED
Definition SDL_pixels.h:475
@ SDL_COLOR_PRIMARIES_SMPTE240
Definition SDL_pixels.h:479
@ SDL_COLOR_PRIMARIES_XYZ
Definition SDL_pixels.h:482
@ SDL_COLOR_PRIMARIES_UNKNOWN
Definition SDL_pixels.h:473
@ SDL_COLOR_PRIMARIES_SMPTE432
Definition SDL_pixels.h:484
@ SDL_COLOR_PRIMARIES_BT2020
Definition SDL_pixels.h:481
@ SDL_COLOR_PRIMARIES_BT470BG
Definition SDL_pixels.h:477
@ SDL_COLOR_PRIMARIES_BT709
Definition SDL_pixels.h:474
@ SDL_COLOR_PRIMARIES_BT470M
Definition SDL_pixels.h:476
SDL_PackedLayout
Definition SDL_pixels.h:141
@ SDL_PACKEDLAYOUT_NONE
Definition SDL_pixels.h:142
@ SDL_PACKEDLAYOUT_8888
Definition SDL_pixels.h:148
@ SDL_PACKEDLAYOUT_1010102
Definition SDL_pixels.h:150
@ SDL_PACKEDLAYOUT_565
Definition SDL_pixels.h:147
@ SDL_PACKEDLAYOUT_332
Definition SDL_pixels.h:143
@ SDL_PACKEDLAYOUT_5551
Definition SDL_pixels.h:146
@ SDL_PACKEDLAYOUT_1555
Definition SDL_pixels.h:145
@ SDL_PACKEDLAYOUT_4444
Definition SDL_pixels.h:144
@ SDL_PACKEDLAYOUT_2101010
Definition SDL_pixels.h:149
SDL_Palette * SDL_CreatePalette(int ncolors)
SDL_BitmapOrder
Definition SDL_pixels.h:107
@ SDL_BITMAPORDER_1234
Definition SDL_pixels.h:110
@ SDL_BITMAPORDER_NONE
Definition SDL_pixels.h:108
@ SDL_BITMAPORDER_4321
Definition SDL_pixels.h:109
SDL_ChromaLocation
Definition SDL_pixels.h:541
@ SDL_CHROMA_LOCATION_NONE
Definition SDL_pixels.h:542
@ SDL_CHROMA_LOCATION_TOPLEFT
Definition SDL_pixels.h:545
@ SDL_CHROMA_LOCATION_CENTER
Definition SDL_pixels.h:544
@ SDL_CHROMA_LOCATION_LEFT
Definition SDL_pixels.h:543
Uint32 SDL_MapRGB(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
#define SDL_DEFINE_COLORSPACE(type, range, primaries, transfer, matrix, chroma)
Definition SDL_pixels.h:550
void SDL_DestroyPalette(SDL_Palette *palette)
SDL_ColorType
Definition SDL_pixels.h:452
@ SDL_COLOR_TYPE_RGB
Definition SDL_pixels.h:454
@ SDL_COLOR_TYPE_YCBCR
Definition SDL_pixels.h:455
@ SDL_COLOR_TYPE_UNKNOWN
Definition SDL_pixels.h:453
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D)
Definition SDL_pixels.h:153
SDL_TransferCharacteristics
Definition SDL_pixels.h:493
@ SDL_TRANSFER_CHARACTERISTICS_BT709
Definition SDL_pixels.h:495
@ SDL_TRANSFER_CHARACTERISTICS_BT1361
Definition SDL_pixels.h:505
@ SDL_TRANSFER_CHARACTERISTICS_CUSTOM
Definition SDL_pixels.h:512
@ SDL_TRANSFER_CHARACTERISTICS_HLG
Definition SDL_pixels.h:511
@ SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10
Definition SDL_pixels.h:503
@ SDL_TRANSFER_CHARACTERISTICS_UNKNOWN
Definition SDL_pixels.h:494
@ SDL_TRANSFER_CHARACTERISTICS_BT601
Definition SDL_pixels.h:499
@ SDL_TRANSFER_CHARACTERISTICS_IEC61966
Definition SDL_pixels.h:504
@ SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED
Definition SDL_pixels.h:496
@ SDL_TRANSFER_CHARACTERISTICS_SMPTE428
Definition SDL_pixels.h:510
@ SDL_TRANSFER_CHARACTERISTICS_LOG100
Definition SDL_pixels.h:502
@ SDL_TRANSFER_CHARACTERISTICS_GAMMA28
Definition SDL_pixels.h:498
@ SDL_TRANSFER_CHARACTERISTICS_SMPTE240
Definition SDL_pixels.h:500
@ SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT
Definition SDL_pixels.h:507
@ SDL_TRANSFER_CHARACTERISTICS_SRGB
Definition SDL_pixels.h:506
@ SDL_TRANSFER_CHARACTERISTICS_PQ
Definition SDL_pixels.h:509
@ SDL_TRANSFER_CHARACTERISTICS_LINEAR
Definition SDL_pixels.h:501
@ SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT
Definition SDL_pixels.h:508
@ SDL_TRANSFER_CHARACTERISTICS_GAMMA22
Definition SDL_pixels.h:497
SDL_ArrayOrder
Definition SDL_pixels.h:129
@ SDL_ARRAYORDER_RGB
Definition SDL_pixels.h:131
@ SDL_ARRAYORDER_NONE
Definition SDL_pixels.h:130
@ SDL_ARRAYORDER_ARGB
Definition SDL_pixels.h:133
@ SDL_ARRAYORDER_BGRA
Definition SDL_pixels.h:135
@ SDL_ARRAYORDER_ABGR
Definition SDL_pixels.h:136
@ SDL_ARRAYORDER_RGBA
Definition SDL_pixels.h:132
@ SDL_ARRAYORDER_BGR
Definition SDL_pixels.h:134
SDL_PixelFormatEnum
Definition SDL_pixels.h:215
@ SDL_PIXELFORMAT_BGR48_FLOAT
Definition SDL_pixels.h:349
@ SDL_PIXELFORMAT_RGBA128_FLOAT
Definition SDL_pixels.h:370
@ SDL_PIXELFORMAT_BGR565
Definition SDL_pixels.h:283
@ SDL_PIXELFORMAT_P010
Definition SDL_pixels.h:418
@ SDL_PIXELFORMAT_EXTERNAL_OES
Definition SDL_pixels.h:420
@ SDL_PIXELFORMAT_ARGB64
Definition SDL_pixels.h:337
@ SDL_PIXELFORMAT_YVYU
Definition SDL_pixels.h:412
@ SDL_PIXELFORMAT_RGB332
Definition SDL_pixels.h:237
@ SDL_PIXELFORMAT_INDEX2LSB
Definition SDL_pixels.h:223
@ SDL_PIXELFORMAT_INDEX1LSB
Definition SDL_pixels.h:217
@ SDL_PIXELFORMAT_BGR444
Definition SDL_pixels.h:247
@ SDL_PIXELFORMAT_RGB96_FLOAT
Definition SDL_pixels.h:364
@ SDL_PIXELFORMAT_RGBX32
Definition SDL_pixels.h:389
@ SDL_PIXELFORMAT_ABGR4444
Definition SDL_pixels.h:262
@ SDL_PIXELFORMAT_BGRA4444
Definition SDL_pixels.h:265
@ SDL_PIXELFORMAT_BGR24
Definition SDL_pixels.h:289
@ SDL_PIXELFORMAT_INDEX4MSB
Definition SDL_pixels.h:232
@ SDL_PIXELFORMAT_ABGR2101010
Definition SDL_pixels.h:325
@ SDL_PIXELFORMAT_BGRA32
Definition SDL_pixels.h:387
@ SDL_PIXELFORMAT_RGB555
Definition SDL_pixels.h:251
@ SDL_PIXELFORMAT_RGB444
Definition SDL_pixels.h:243
@ SDL_PIXELFORMAT_XBGR2101010
Definition SDL_pixels.h:319
@ SDL_PIXELFORMAT_RGBA64_FLOAT
Definition SDL_pixels.h:352
@ SDL_PIXELFORMAT_INDEX2MSB
Definition SDL_pixels.h:226
@ SDL_PIXELFORMAT_BGRA64_FLOAT
Definition SDL_pixels.h:358
@ SDL_PIXELFORMAT_RGBA8888
Definition SDL_pixels.h:307
@ SDL_PIXELFORMAT_RGBA5551
Definition SDL_pixels.h:271
@ SDL_PIXELFORMAT_ARGB1555
Definition SDL_pixels.h:268
@ SDL_PIXELFORMAT_XBGR4444
Definition SDL_pixels.h:244
@ SDL_PIXELFORMAT_RGBA64
Definition SDL_pixels.h:334
@ SDL_PIXELFORMAT_INDEX8
Definition SDL_pixels.h:235
@ SDL_PIXELFORMAT_XRGB2101010
Definition SDL_pixels.h:316
@ SDL_PIXELFORMAT_XRGB8888
Definition SDL_pixels.h:292
@ SDL_PIXELFORMAT_UYVY
Definition SDL_pixels.h:410
@ SDL_PIXELFORMAT_BGRX32
Definition SDL_pixels.h:391
@ SDL_PIXELFORMAT_YV12
Definition SDL_pixels.h:404
@ SDL_PIXELFORMAT_ABGR32
Definition SDL_pixels.h:388
@ SDL_PIXELFORMAT_BGRX8888
Definition SDL_pixels.h:301
@ SDL_PIXELFORMAT_RGB24
Definition SDL_pixels.h:286
@ SDL_PIXELFORMAT_BGRA64
Definition SDL_pixels.h:340
@ SDL_PIXELFORMAT_ABGR8888
Definition SDL_pixels.h:310
@ SDL_PIXELFORMAT_YUY2
Definition SDL_pixels.h:408
@ SDL_PIXELFORMAT_XBGR32
Definition SDL_pixels.h:392
@ SDL_PIXELFORMAT_NV12
Definition SDL_pixels.h:414
@ SDL_PIXELFORMAT_BGRA8888
Definition SDL_pixels.h:313
@ SDL_PIXELFORMAT_ABGR128_FLOAT
Definition SDL_pixels.h:379
@ SDL_PIXELFORMAT_ARGB32
Definition SDL_pixels.h:386
@ SDL_PIXELFORMAT_ABGR1555
Definition SDL_pixels.h:274
@ SDL_PIXELFORMAT_NV21
Definition SDL_pixels.h:416
@ SDL_PIXELFORMAT_IYUV
Definition SDL_pixels.h:406
@ SDL_PIXELFORMAT_ARGB8888
Definition SDL_pixels.h:304
@ SDL_PIXELFORMAT_ABGR64_FLOAT
Definition SDL_pixels.h:361
@ SDL_PIXELFORMAT_ABGR64
Definition SDL_pixels.h:343
@ SDL_PIXELFORMAT_XRGB32
Definition SDL_pixels.h:390
@ SDL_PIXELFORMAT_XBGR1555
Definition SDL_pixels.h:252
@ SDL_PIXELFORMAT_RGB48
Definition SDL_pixels.h:328
@ SDL_PIXELFORMAT_XRGB4444
Definition SDL_pixels.h:240
@ SDL_PIXELFORMAT_BGR96_FLOAT
Definition SDL_pixels.h:367
@ SDL_PIXELFORMAT_ARGB4444
Definition SDL_pixels.h:256
@ SDL_PIXELFORMAT_RGB48_FLOAT
Definition SDL_pixels.h:346
@ SDL_PIXELFORMAT_BGR48
Definition SDL_pixels.h:331
@ SDL_PIXELFORMAT_RGBA32
Definition SDL_pixels.h:385
@ SDL_PIXELFORMAT_BGRA128_FLOAT
Definition SDL_pixels.h:376
@ SDL_PIXELFORMAT_ARGB64_FLOAT
Definition SDL_pixels.h:355
@ SDL_PIXELFORMAT_INDEX1MSB
Definition SDL_pixels.h:220
@ SDL_PIXELFORMAT_INDEX4LSB
Definition SDL_pixels.h:229
@ SDL_PIXELFORMAT_RGBX8888
Definition SDL_pixels.h:295
@ SDL_PIXELFORMAT_BGRA5551
Definition SDL_pixels.h:277
@ SDL_PIXELFORMAT_ARGB128_FLOAT
Definition SDL_pixels.h:373
@ SDL_PIXELFORMAT_XRGB1555
Definition SDL_pixels.h:248
@ SDL_PIXELFORMAT_RGB565
Definition SDL_pixels.h:280
@ SDL_PIXELFORMAT_XBGR8888
Definition SDL_pixels.h:298
@ SDL_PIXELFORMAT_ARGB2101010
Definition SDL_pixels.h:322
@ SDL_PIXELFORMAT_BGR555
Definition SDL_pixels.h:255
@ SDL_PIXELFORMAT_UNKNOWN
Definition SDL_pixels.h:216
@ SDL_PIXELFORMAT_RGBA4444
Definition SDL_pixels.h:259
SDL_Colorspace
Definition SDL_pixels.h:568
@ SDL_COLORSPACE_BT2020_LIMITED
Definition SDL_pixels.h:638
@ SDL_COLORSPACE_BT601_LIMITED
Definition SDL_pixels.h:606
@ SDL_COLORSPACE_BT709_FULL
Definition SDL_pixels.h:630
@ SDL_COLORSPACE_HDR10
Definition SDL_pixels.h:590
@ SDL_COLORSPACE_BT601_FULL
Definition SDL_pixels.h:614
@ SDL_COLORSPACE_UNKNOWN
Definition SDL_pixels.h:569
@ SDL_COLORSPACE_BT2020_FULL
Definition SDL_pixels.h:646
@ SDL_COLORSPACE_JPEG
Definition SDL_pixels.h:598
@ SDL_COLORSPACE_BT709_LIMITED
Definition SDL_pixels.h:622
@ SDL_COLORSPACE_SRGB_LINEAR
Definition SDL_pixels.h:581
@ SDL_COLORSPACE_SRGB
Definition SDL_pixels.h:572
@ SDL_COLORSPACE_RGB_DEFAULT
Definition SDL_pixels.h:655
@ SDL_COLORSPACE_YUV_DEFAULT
Definition SDL_pixels.h:658
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
Definition SDL_pixels.h:155
SDL_PixelFormat * SDL_CreatePixelFormat(SDL_PixelFormatEnum pixel_format)
SDL_bool SDL_GetMasksForPixelFormatEnum(SDL_PixelFormatEnum format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
SDL_PackedOrder
Definition SDL_pixels.h:115
@ SDL_PACKEDORDER_NONE
Definition SDL_pixels.h:116
@ SDL_PACKEDORDER_RGBX
Definition SDL_pixels.h:118
@ SDL_PACKEDORDER_BGRX
Definition SDL_pixels.h:122
@ SDL_PACKEDORDER_XBGR
Definition SDL_pixels.h:121
@ SDL_PACKEDORDER_RGBA
Definition SDL_pixels.h:120
@ SDL_PACKEDORDER_ABGR
Definition SDL_pixels.h:123
@ SDL_PACKEDORDER_BGRA
Definition SDL_pixels.h:124
@ SDL_PACKEDORDER_XRGB
Definition SDL_pixels.h:117
@ SDL_PACKEDORDER_ARGB
Definition SDL_pixels.h:119
void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b)
uint8_t Uint8
Definition SDL_stdinc.h:150
int SDL_bool
Definition SDL_stdinc.h:137
uint32_t Uint32
Definition SDL_stdinc.h:174
Uint32 version
Definition SDL_pixels.h:693
SDL_Color * colors
Definition SDL_pixels.h:692
struct SDL_PixelFormat * next
Definition SDL_pixels.h:720
Uint8 padding[2]
Definition SDL_pixels.h:706
SDL_PixelFormatEnum format
Definition SDL_pixels.h:702
Uint8 bytes_per_pixel
Definition SDL_pixels.h:705
SDL_Palette * palette
Definition SDL_pixels.h:703