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_error.h>
69#include <SDL3/SDL_endian.h>
70
71#include <SDL3/SDL_begin_code.h>
72/* Set up for C function definitions, even when using C++ */
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77/**
78 * \name Transparency definitions
79 *
80 * These define alpha as the opacity of a surface.
81 */
82/* @{ */
83#define SDL_ALPHA_OPAQUE 255
84#define SDL_ALPHA_TRANSPARENT 0
85/* @} */
86
87/** Pixel type. */
105
106/** Bitmap pixel order, high bit -> low bit. */
113
114/** Packed component order, high bit -> low bit. */
127
128/** Array component order, low byte -> high byte. */
139
140/** Packed component layout. */
153
154#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
155
156#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
157 ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
158 ((bits) << 8) | ((bytes) << 0))
159
160#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
161#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
162#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
163#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
164#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
165#define SDL_BYTESPERPIXEL(X) \
166 (SDL_ISPIXELFORMAT_FOURCC(X) ? \
167 ((((X) == SDL_PIXELFORMAT_YUY2) || \
168 ((X) == SDL_PIXELFORMAT_UYVY) || \
169 ((X) == SDL_PIXELFORMAT_YVYU) || \
170 ((X) == SDL_PIXELFORMAT_P010)) ? 2 : 1) : (((X) >> 0) & 0xFF))
171
172#define SDL_ISPIXELFORMAT_INDEXED(format) \
173 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
174 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
175 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
176 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
177 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
178
179#define SDL_ISPIXELFORMAT_PACKED(format) \
180 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
181 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
182 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
183 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
184
185#define SDL_ISPIXELFORMAT_ARRAY(format) \
186 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
187 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
188 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
189 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
190 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
191 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
192
193#define SDL_ISPIXELFORMAT_ALPHA(format) \
194 ((SDL_ISPIXELFORMAT_PACKED(format) && \
195 ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
196 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
197 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
198 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))))
199
200#define SDL_ISPIXELFORMAT_10BIT(format) \
201 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
202 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32) && \
203 (SDL_PIXELLAYOUT(format) == SDL_PACKEDLAYOUT_2101010)))
204
205#define SDL_ISPIXELFORMAT_FLOAT(format) \
206 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
207 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
208 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
209
210/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
211#define SDL_ISPIXELFORMAT_FOURCC(format) \
212 ((format) && (SDL_PIXELFLAG(format) != 1))
213
214/* Note: If you modify this list, update SDL_GetPixelFormatName() */
216{
220 1, 0),
223 1, 0),
226 2, 0),
229 2, 0),
232 4, 0),
235 4, 0),
289 24, 3),
292 24, 3),
331 48, 6),
334 48, 6),
337 64, 8),
340 64, 8),
343 64, 8),
346 64, 8),
349 48, 6),
352 48, 6),
355 64, 8),
358 64, 8),
361 64, 8),
364 64, 8),
367 96, 12),
370 96, 12),
373 128, 16),
376 128, 16),
379 128, 16),
382 128, 16),
383
384 /* Aliases for RGBA byte arrays of color data, for the current platform */
385#if SDL_BYTEORDER == SDL_BIG_ENDIAN
394#else
403#endif
404
405 SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
406 SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
407 SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
408 SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
409 SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
410 SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
411 SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
412 SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
413 SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
414 SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
415 SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
416 SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
417 SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
418 SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
419 SDL_PIXELFORMAT_P010 = /**< Planar mode: Y + U/V interleaved (2 planes) */
420 SDL_DEFINE_PIXELFOURCC('P', '0', '1', '0'),
421 SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
422 SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
424
425/**
426 * Pixels are a representation of a color in a particular color space.
427 *
428 * 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.
429 *
430 * RGB colors consist of red, green, and blue channels of color that are added together to represent the colors we see on the screen.
431 * https://en.wikipedia.org/wiki/RGB_color_model
432 *
433 * 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.
434 * https://en.wikipedia.org/wiki/YCbCr
435 *
436 * 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.
437 *
438 * 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.
439 *
440 * The color primaries and white point are a definition of the colors in the color space relative to the standard XYZ color space.
441 * https://en.wikipedia.org/wiki/CIE_1931_color_space
442 *
443 * 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.
444 * https://en.wikipedia.org/wiki/Rec._709#Transfer_characteristics
445 *
446 * The matrix coefficients are used to convert between YCbCr and RGB colors.
447 */
448
449/**
450 * The color type
451 *
452 * \since This enum is available since SDL 3.0.0.
453 */
460
461/**
462 * The color range, as described by
463 * https://www.itu.int/rec/R-REC-BT.2100-2-201807-I/en
464 *
465 * \since This enum is available since SDL 3.0.0.
466 */
467typedef enum SDL_ColorRange
468{
470 SDL_COLOR_RANGE_LIMITED = 1, /**< Narrow range, e.g. 16-235 for 8-bit RGB and luma, and 16-240 for 8-bit chroma */
471 SDL_COLOR_RANGE_FULL = 2 /**< Full range, e.g. 0-255 for 8-bit RGB and luma, and 1-255 for 8-bit chroma */
473
474/**
475 * The color primaries, as described by
476 * https://www.itu.int/rec/T-REC-H.273-201612-S/en
477 *
478 * \since This enum is available since SDL 3.0.0.
479 */
481{
483 SDL_COLOR_PRIMARIES_BT709 = 1, /**< ITU-R BT.709-6 */
485 SDL_COLOR_PRIMARIES_BT470M = 4, /**< ITU-R BT.470-6 System M */
486 SDL_COLOR_PRIMARIES_BT470BG = 5, /**< ITU-R BT.470-6 System B, G / ITU-R BT.601-7 625 */
487 SDL_COLOR_PRIMARIES_BT601 = 6, /**< ITU-R BT.601-7 525 */
488 SDL_COLOR_PRIMARIES_SMPTE240 = 7, /**< SMPTE 240M, functionally the same as SDL_COLOR_PRIMARIES_BT601 */
489 SDL_COLOR_PRIMARIES_GENERIC_FILM = 8, /**< Generic film (color filters using Illuminant C) */
490 SDL_COLOR_PRIMARIES_BT2020 = 9, /**< ITU-R BT.2020-2 / ITU-R BT.2100-0 */
491 SDL_COLOR_PRIMARIES_XYZ = 10, /**< SMPTE ST 428-1 */
492 SDL_COLOR_PRIMARIES_SMPTE431 = 11, /**< SMPTE RP 431-2 */
493 SDL_COLOR_PRIMARIES_SMPTE432 = 12, /**< SMPTE EG 432-1 / DCI P3 */
494 SDL_COLOR_PRIMARIES_EBU3213 = 22, /**< EBU Tech. 3213-E */
497
498/**
499 * The transfer characteristics, as described by
500 * https://www.itu.int/rec/T-REC-H.273-201612-S/en
501 *
502 * \since This enum is available since SDL 3.0.0.
503 */
505{
507 SDL_TRANSFER_CHARACTERISTICS_BT709 = 1, /**< Rec. ITU-R BT.709-6 / ITU-R BT1361 */
509 SDL_TRANSFER_CHARACTERISTICS_GAMMA22 = 4, /**< ITU-R BT.470-6 System M / ITU-R BT1700 625 PAL & SECAM */
510 SDL_TRANSFER_CHARACTERISTICS_GAMMA28 = 5, /**< ITU-R BT.470-6 System B, G */
511 SDL_TRANSFER_CHARACTERISTICS_BT601 = 6, /**< SMPTE ST 170M / ITU-R BT.601-7 525 or 625 */
512 SDL_TRANSFER_CHARACTERISTICS_SMPTE240 = 7, /**< SMPTE ST 240M */
516 SDL_TRANSFER_CHARACTERISTICS_IEC61966 = 11, /**< IEC 61966-2-4 */
517 SDL_TRANSFER_CHARACTERISTICS_BT1361 = 12, /**< ITU-R BT1361 Extended Colour Gamut */
518 SDL_TRANSFER_CHARACTERISTICS_SRGB = 13, /**< IEC 61966-2-1 (sRGB or sYCC) */
519 SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT = 14, /**< ITU-R BT2020 for 10-bit system */
520 SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT = 15, /**< ITU-R BT2020 for 12-bit system */
521 SDL_TRANSFER_CHARACTERISTICS_PQ = 16, /**< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems */
522 SDL_TRANSFER_CHARACTERISTICS_SMPTE428 = 17, /**< SMPTE ST 428-1 */
523 SDL_TRANSFER_CHARACTERISTICS_HLG = 18, /**< ARIB STD-B67, known as "hybrid log-gamma" (HLG) */
526
527/**
528 * The matrix coefficients, as described by
529 * https://www.itu.int/rec/T-REC-H.273-201612-S/en
530 *
531 * \since This enum is available since SDL 3.0.0.
532 */
534{
536 SDL_MATRIX_COEFFICIENTS_BT709 = 1, /**< ITU-R BT.709-6 */
538 SDL_MATRIX_COEFFICIENTS_FCC = 4, /**< US FCC */
539 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 */
540 SDL_MATRIX_COEFFICIENTS_BT601 = 6, /**< ITU-R BT.601-7 525 */
541 SDL_MATRIX_COEFFICIENTS_SMPTE240 = 7, /**< SMPTE 240M */
543 SDL_MATRIX_COEFFICIENTS_BT2020_NCL = 9, /**< ITU-R BT.2020-2 non-constant luminance */
544 SDL_MATRIX_COEFFICIENTS_BT2020_CL = 10, /**< ITU-R BT.2020-2 constant luminance */
545 SDL_MATRIX_COEFFICIENTS_SMPTE2085 = 11, /**< SMPTE ST 2085 */
548 SDL_MATRIX_COEFFICIENTS_ICTCP = 14, /**< ITU-R BT.2100-0 ICTCP */
551
552/**
553 * The chroma sample location
554 *
555 * \since This enum is available since SDL 3.0.0.
556 */
558{
559 SDL_CHROMA_LOCATION_NONE = 0, /**< RGB, no chroma sampling */
560 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. */
561 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. */
562 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"). */
564
565
566/* Colorspace definition */
567#define SDL_DEFINE_COLORSPACE(type, range, primaries, transfer, matrix, chroma) \
568 (((Uint32)(type) << 28) | ((Uint32)(range) << 24) | ((Uint32)(chroma) << 20) | \
569 ((Uint32)(primaries) << 10) | ((Uint32)(transfer) << 5) | ((Uint32)(matrix) << 0))
570
571#define SDL_COLORSPACETYPE(X) (SDL_ColorType)(((X) >> 28) & 0x0F)
572#define SDL_COLORSPACERANGE(X) (SDL_ColorRange)(((X) >> 24) & 0x0F)
573#define SDL_COLORSPACECHROMA(X) (SDL_ChromaLocation)(((X) >> 20) & 0x0F)
574#define SDL_COLORSPACEPRIMARIES(X) (SDL_ColorPrimaries)(((X) >> 10) & 0x1F)
575#define SDL_COLORSPACETRANSFER(X) (SDL_TransferCharacteristics)(((X) >> 5) & 0x1F)
576#define SDL_COLORSPACEMATRIX(X) (SDL_MatrixCoefficients)((X) & 0x1F)
577
578#define SDL_ISCOLORSPACE_MATRIX_BT601(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT601 || SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT470BG)
579#define SDL_ISCOLORSPACE_MATRIX_BT709(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT709)
580#define SDL_ISCOLORSPACE_MATRIX_BT2020_NCL(X) (SDL_COLORSPACEMATRIX(X) == SDL_MATRIX_COEFFICIENTS_BT2020_NCL)
581#define SDL_ISCOLORSPACE_LIMITED_RANGE(X) (SDL_COLORSPACERANGE(X) != SDL_COLOR_RANGE_FULL)
582#define SDL_ISCOLORSPACE_FULL_RANGE(X) (SDL_COLORSPACERANGE(X) == SDL_COLOR_RANGE_FULL)
583
584typedef enum SDL_Colorspace
585{
587
588 /* sRGB is a gamma corrected colorspace, and the default colorspace for SDL rendering and 8-bit RGB surfaces */
589 SDL_COLORSPACE_SRGB = /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 */
596
597 /* 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 */
598 SDL_COLORSPACE_SRGB_LINEAR = /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 */
605
606 /* HDR10 is a non-linear HDR colorspace and the default colorspace for 10-bit surfaces */
607 SDL_COLORSPACE_HDR10 = /**< Equivalent to DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 */
614
615 SDL_COLORSPACE_JPEG = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 */
622
623 SDL_COLORSPACE_BT601_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */
630
631 SDL_COLORSPACE_BT601_FULL = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */
638
639 SDL_COLORSPACE_BT709_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 */
646
647 SDL_COLORSPACE_BT709_FULL = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 */
654
655 SDL_COLORSPACE_BT2020_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 */
662
663 SDL_COLORSPACE_BT2020_FULL = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 */
670
671 /* The default colorspace for RGB surfaces if no colorspace is specified */
673
674 /* The default colorspace for YUV surfaces if no colorspace is specified */
676
678
679/**
680 * A structure that represents a color as RGBA components.
681 *
682 * The bits of this structure can be directly reinterpreted as an
683 * integer-packed color which uses the SDL_PIXELFORMAT_RGBA32 format
684 * (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and
685 * SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
686 *
687 * \since This struct is available since SDL 3.0.0.
688 */
696
697/**
698 * The bits of this structure can be directly reinterpreted as a float-packed
699 * color which uses the SDL_PIXELFORMAT_RGBA128_FLOAT format
700 *
701 * \since This struct is available since SDL 3.0.0.
702 */
703typedef struct SDL_FColor
704{
705 float r;
706 float g;
707 float b;
708 float a;
709} SDL_FColor;
710
711/**
712 * A set of indexed colors representing a palette.
713 *
714 * \since This struct is available since SDL 3.0.0.
715 *
716 * \sa SDL_PixelFormat
717 * \sa SDL_SetPaletteColors
718 */
719typedef struct SDL_Palette
720{
721 int ncolors; /**< number of elements in `colors`. */
722 SDL_Color *colors; /**< an array of colors, `ncolors` long. */
723 Uint32 version; /**< internal use only, do not touch. */
724 int refcount; /**< internal use only, do not touch. */
726
727/**
728 * Details about the format of a pixel.
729 *
730 * Generally this is used with SDL_Surface, and covers many possible
731 * configurations, including paletted data and various bit patterns.
732 *
733 * \since This struct is available since SDL 3.0.0.
734 */
757
758/**
759 * Get the human readable name of a pixel format.
760 *
761 * \param format the pixel format to query
762 * \returns the human readable name of the specified pixel format or
763 * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
764 *
765 * \since This function is available since SDL 3.0.0.
766 */
767extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(SDL_PixelFormatEnum 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_PixelFormatEnum 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 SDL_TRUE on success or SDL_FALSE if the conversion wasn't
779 * possible; call SDL_GetError() for more information.
780 *
781 * \since This function is available since SDL 3.0.0.
782 *
783 * \sa SDL_GetPixelFormatEnumForMasks
784 */
786 int *bpp,
787 Uint32 * Rmask,
788 Uint32 * Gmask,
789 Uint32 * Bmask,
790 Uint32 * Amask);
791
792/**
793 * Convert a bpp value and RGBA masks to an enumerated pixel format.
794 *
795 * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
796 * possible.
797 *
798 * \param bpp a bits per pixel value; usually 15, 16, or 32
799 * \param Rmask the red mask for the format
800 * \param Gmask the green mask for the format
801 * \param Bmask the blue mask for the format
802 * \param Amask the alpha mask for the format
803 * \returns the SDL_PixelFormatEnum value corresponding to the format masks,
804 * or SDL_PIXELFORMAT_UNKNOWN if there isn't a match.
805 *
806 * \since This function is available since SDL 3.0.0.
807 *
808 * \sa SDL_GetMasksForPixelFormatEnum
809 */
814 Uint32 Amask);
815
816/**
817 * Create an SDL_PixelFormat structure corresponding to a pixel format.
818 *
819 * Returned structure may come from a shared global cache (i.e. not newly
820 * allocated), and hence should not be modified, especially the palette. Weird
821 * errors such as `Blit combination not supported` may occur.
822 *
823 * \param pixel_format one of the SDL_PixelFormatEnum values
824 * \returns the new SDL_PixelFormat structure or NULL on failure; call
825 * SDL_GetError() for more information.
826 *
827 * \since This function is available since SDL 3.0.0.
828 *
829 * \sa SDL_DestroyPixelFormat
830 * \sa SDL_SetPixelFormatPalette
831 */
832extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_CreatePixelFormat(SDL_PixelFormatEnum pixel_format);
833
834/**
835 * Free an SDL_PixelFormat structure allocated by SDL_CreatePixelFormat().
836 *
837 * \param format the SDL_PixelFormat structure to free
838 *
839 * \since This function is available since SDL 3.0.0.
840 *
841 * \sa SDL_CreatePixelFormat
842 */
843extern DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
844
845/**
846 * Create a palette structure with the specified number of color entries.
847 *
848 * The palette entries are initialized to white.
849 *
850 * \param ncolors represents the number of color entries in the color palette
851 * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
852 * there wasn't enough memory); call SDL_GetError() for more
853 * information.
854 *
855 * \since This function is available since SDL 3.0.0.
856 *
857 * \sa SDL_DestroyPalette
858 * \sa SDL_SetPaletteColors
859 * \sa SDL_SetPixelFormatPalette
860 */
861extern DECLSPEC SDL_Palette *SDLCALL SDL_CreatePalette(int ncolors);
862
863/**
864 * Set the palette for a pixel format structure.
865 *
866 * \param format the SDL_PixelFormat structure that will use the palette
867 * \param palette the SDL_Palette structure that will be used
868 * \returns 0 on success or a negative error code on failure; call
869 * SDL_GetError() for more information.
870 *
871 * \since This function is available since SDL 3.0.0.
872 */
875
876/**
877 * Set a range of colors in a palette.
878 *
879 * \param palette the SDL_Palette structure to modify
880 * \param colors an array of SDL_Color structures to copy into the palette
881 * \param firstcolor the index of the first palette entry to modify
882 * \param ncolors the number of entries to modify
883 * \returns 0 on success or a negative error code on failure; call
884 * SDL_GetError() for more information.
885 *
886 * \since This function is available since SDL 3.0.0.
887 */
888extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
889 const SDL_Color * colors,
890 int firstcolor, int ncolors);
891
892/**
893 * Free a palette created with SDL_CreatePalette().
894 *
895 * \param palette the SDL_Palette structure to be freed
896 *
897 * \since This function is available since SDL 3.0.0.
898 *
899 * \sa SDL_CreatePalette
900 */
901extern DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
902
903/**
904 * Map an RGB triple to an opaque pixel value for a given pixel format.
905 *
906 * This function maps the RGB color value to the specified pixel format and
907 * returns the pixel value best approximating the given RGB color value for
908 * the given pixel format.
909 *
910 * If the format has a palette (8-bit) the index of the closest matching color
911 * in the palette will be returned.
912 *
913 * If the specified pixel format has an alpha component it will be returned as
914 * all 1 bits (fully opaque).
915 *
916 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
917 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
918 * format the return value can be assigned to a Uint16, and similarly a Uint8
919 * for an 8-bpp format).
920 *
921 * \param format an SDL_PixelFormat structure describing the pixel format
922 * \param r the red component of the pixel in the range 0-255
923 * \param g the green component of the pixel in the range 0-255
924 * \param b the blue 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_MapRGBA
932 */
933extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
934 Uint8 r, Uint8 g, Uint8 b);
935
936/**
937 * Map an RGBA quadruple to a pixel value for a given pixel format.
938 *
939 * This function maps the RGBA color value to the specified pixel format and
940 * returns the pixel value best approximating the given RGBA color value for
941 * the given pixel format.
942 *
943 * If the specified pixel format has no alpha component the alpha value will
944 * be ignored (as it will be in formats with a palette).
945 *
946 * If the format has a palette (8-bit) the index of the closest matching color
947 * in the palette will be returned.
948 *
949 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
950 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
951 * format the return value can be assigned to a Uint16, and similarly a Uint8
952 * for an 8-bpp format).
953 *
954 * \param format an SDL_PixelFormat structure describing the format of the
955 * pixel
956 * \param r the red component of the pixel in the range 0-255
957 * \param g the green component of the pixel in the range 0-255
958 * \param b the blue component of the pixel in the range 0-255
959 * \param a the alpha component of the pixel in the range 0-255
960 * \returns a pixel value
961 *
962 * \since This function is available since SDL 3.0.0.
963 *
964 * \sa SDL_GetRGB
965 * \sa SDL_GetRGBA
966 * \sa SDL_MapRGB
967 */
968extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
969 Uint8 r, Uint8 g, Uint8 b,
970 Uint8 a);
971
972/**
973 * Get RGB values from a pixel in the specified format.
974 *
975 * This function uses the entire 8-bit [0..255] range when converting color
976 * components from pixel formats with less than 8-bits per RGB component
977 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
978 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
979 *
980 * \param pixel a pixel value
981 * \param format an SDL_PixelFormat structure describing the format of the
982 * pixel
983 * \param r a pointer filled in with the red component
984 * \param g a pointer filled in with the green component
985 * \param b a pointer filled in with the blue component
986 *
987 * \since This function is available since SDL 3.0.0.
988 *
989 * \sa SDL_GetRGBA
990 * \sa SDL_MapRGB
991 * \sa SDL_MapRGBA
992 */
993extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
994 const SDL_PixelFormat * format,
995 Uint8 * r, Uint8 * g, Uint8 * b);
996
997/**
998 * Get RGBA values from a pixel in the specified format.
999 *
1000 * This function uses the entire 8-bit [0..255] range when converting color
1001 * components from pixel formats with less than 8-bits per RGB component
1002 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
1003 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
1004 *
1005 * If the surface has no alpha component, the alpha will be returned as 0xff
1006 * (100% opaque).
1007 *
1008 * \param pixel a pixel value
1009 * \param format an SDL_PixelFormat structure describing the format of the
1010 * pixel
1011 * \param r a pointer filled in with the red component
1012 * \param g a pointer filled in with the green component
1013 * \param b a pointer filled in with the blue component
1014 * \param a a pointer filled in with the alpha component
1015 *
1016 * \since This function is available since SDL 3.0.0.
1017 *
1018 * \sa SDL_GetRGB
1019 * \sa SDL_MapRGB
1020 * \sa SDL_MapRGBA
1021 */
1022extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
1023 const SDL_PixelFormat * format,
1024 Uint8 * r, Uint8 * g, Uint8 * b,
1025 Uint8 * a);
1026
1027
1028/* Ends C function definitions when using C++ */
1029#ifdef __cplusplus
1030}
1031#endif
1032#include <SDL3/SDL_close_code.h>
1033
1034#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:534
@ SDL_MATRIX_COEFFICIENTS_BT709
Definition SDL_pixels.h:536
@ SDL_MATRIX_COEFFICIENTS_BT2020_CL
Definition SDL_pixels.h:544
@ SDL_MATRIX_COEFFICIENTS_BT601
Definition SDL_pixels.h:540
@ SDL_MATRIX_COEFFICIENTS_BT2020_NCL
Definition SDL_pixels.h:543
@ SDL_MATRIX_COEFFICIENTS_SMPTE240
Definition SDL_pixels.h:541
@ SDL_MATRIX_COEFFICIENTS_YCGCO
Definition SDL_pixels.h:542
@ SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL
Definition SDL_pixels.h:546
@ SDL_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL
Definition SDL_pixels.h:547
@ SDL_MATRIX_COEFFICIENTS_UNSPECIFIED
Definition SDL_pixels.h:537
@ SDL_MATRIX_COEFFICIENTS_CUSTOM
Definition SDL_pixels.h:549
@ SDL_MATRIX_COEFFICIENTS_ICTCP
Definition SDL_pixels.h:548
@ SDL_MATRIX_COEFFICIENTS_IDENTITY
Definition SDL_pixels.h:535
@ SDL_MATRIX_COEFFICIENTS_FCC
Definition SDL_pixels.h:538
@ SDL_MATRIX_COEFFICIENTS_BT470BG
Definition SDL_pixels.h:539
@ SDL_MATRIX_COEFFICIENTS_SMPTE2085
Definition SDL_pixels.h:545
SDL_PixelType
Definition SDL_pixels.h:89
@ SDL_PIXELTYPE_UNKNOWN
Definition SDL_pixels.h:90
@ SDL_PIXELTYPE_ARRAYU16
Definition SDL_pixels.h:98
@ SDL_PIXELTYPE_PACKED32
Definition SDL_pixels.h:96
@ SDL_PIXELTYPE_INDEX2
Definition SDL_pixels.h:103
@ SDL_PIXELTYPE_ARRAYU8
Definition SDL_pixels.h:97
@ SDL_PIXELTYPE_INDEX4
Definition SDL_pixels.h:92
@ SDL_PIXELTYPE_PACKED8
Definition SDL_pixels.h:94
@ SDL_PIXELTYPE_ARRAYF16
Definition SDL_pixels.h:100
@ SDL_PIXELTYPE_ARRAYU32
Definition SDL_pixels.h:99
@ SDL_PIXELTYPE_INDEX1
Definition SDL_pixels.h:91
@ SDL_PIXELTYPE_ARRAYF32
Definition SDL_pixels.h:101
@ SDL_PIXELTYPE_INDEX8
Definition SDL_pixels.h:93
@ SDL_PIXELTYPE_PACKED16
Definition SDL_pixels.h:95
SDL_ColorRange
Definition SDL_pixels.h:468
@ SDL_COLOR_RANGE_LIMITED
Definition SDL_pixels.h:470
@ SDL_COLOR_RANGE_FULL
Definition SDL_pixels.h:471
@ SDL_COLOR_RANGE_UNKNOWN
Definition SDL_pixels.h:469
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:481
@ SDL_COLOR_PRIMARIES_SMPTE431
Definition SDL_pixels.h:492
@ SDL_COLOR_PRIMARIES_CUSTOM
Definition SDL_pixels.h:495
@ SDL_COLOR_PRIMARIES_EBU3213
Definition SDL_pixels.h:494
@ SDL_COLOR_PRIMARIES_GENERIC_FILM
Definition SDL_pixels.h:489
@ SDL_COLOR_PRIMARIES_BT601
Definition SDL_pixels.h:487
@ SDL_COLOR_PRIMARIES_UNSPECIFIED
Definition SDL_pixels.h:484
@ SDL_COLOR_PRIMARIES_SMPTE240
Definition SDL_pixels.h:488
@ SDL_COLOR_PRIMARIES_XYZ
Definition SDL_pixels.h:491
@ SDL_COLOR_PRIMARIES_UNKNOWN
Definition SDL_pixels.h:482
@ SDL_COLOR_PRIMARIES_SMPTE432
Definition SDL_pixels.h:493
@ SDL_COLOR_PRIMARIES_BT2020
Definition SDL_pixels.h:490
@ SDL_COLOR_PRIMARIES_BT470BG
Definition SDL_pixels.h:486
@ SDL_COLOR_PRIMARIES_BT709
Definition SDL_pixels.h:483
@ SDL_COLOR_PRIMARIES_BT470M
Definition SDL_pixels.h:485
SDL_PackedLayout
Definition SDL_pixels.h:142
@ SDL_PACKEDLAYOUT_NONE
Definition SDL_pixels.h:143
@ SDL_PACKEDLAYOUT_8888
Definition SDL_pixels.h:149
@ SDL_PACKEDLAYOUT_1010102
Definition SDL_pixels.h:151
@ SDL_PACKEDLAYOUT_565
Definition SDL_pixels.h:148
@ SDL_PACKEDLAYOUT_332
Definition SDL_pixels.h:144
@ SDL_PACKEDLAYOUT_5551
Definition SDL_pixels.h:147
@ SDL_PACKEDLAYOUT_1555
Definition SDL_pixels.h:146
@ SDL_PACKEDLAYOUT_4444
Definition SDL_pixels.h:145
@ SDL_PACKEDLAYOUT_2101010
Definition SDL_pixels.h:150
SDL_Palette * SDL_CreatePalette(int ncolors)
SDL_BitmapOrder
Definition SDL_pixels.h:108
@ SDL_BITMAPORDER_1234
Definition SDL_pixels.h:111
@ SDL_BITMAPORDER_NONE
Definition SDL_pixels.h:109
@ SDL_BITMAPORDER_4321
Definition SDL_pixels.h:110
SDL_ChromaLocation
Definition SDL_pixels.h:558
@ SDL_CHROMA_LOCATION_NONE
Definition SDL_pixels.h:559
@ SDL_CHROMA_LOCATION_TOPLEFT
Definition SDL_pixels.h:562
@ SDL_CHROMA_LOCATION_CENTER
Definition SDL_pixels.h:561
@ SDL_CHROMA_LOCATION_LEFT
Definition SDL_pixels.h:560
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:567
void SDL_DestroyPalette(SDL_Palette *palette)
SDL_ColorType
Definition SDL_pixels.h:455
@ SDL_COLOR_TYPE_RGB
Definition SDL_pixels.h:457
@ SDL_COLOR_TYPE_YCBCR
Definition SDL_pixels.h:458
@ SDL_COLOR_TYPE_UNKNOWN
Definition SDL_pixels.h:456
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D)
Definition SDL_pixels.h:154
SDL_TransferCharacteristics
Definition SDL_pixels.h:505
@ SDL_TRANSFER_CHARACTERISTICS_BT709
Definition SDL_pixels.h:507
@ SDL_TRANSFER_CHARACTERISTICS_BT1361
Definition SDL_pixels.h:517
@ SDL_TRANSFER_CHARACTERISTICS_CUSTOM
Definition SDL_pixels.h:524
@ SDL_TRANSFER_CHARACTERISTICS_HLG
Definition SDL_pixels.h:523
@ SDL_TRANSFER_CHARACTERISTICS_LOG100_SQRT10
Definition SDL_pixels.h:515
@ SDL_TRANSFER_CHARACTERISTICS_UNKNOWN
Definition SDL_pixels.h:506
@ SDL_TRANSFER_CHARACTERISTICS_BT601
Definition SDL_pixels.h:511
@ SDL_TRANSFER_CHARACTERISTICS_IEC61966
Definition SDL_pixels.h:516
@ SDL_TRANSFER_CHARACTERISTICS_UNSPECIFIED
Definition SDL_pixels.h:508
@ SDL_TRANSFER_CHARACTERISTICS_SMPTE428
Definition SDL_pixels.h:522
@ SDL_TRANSFER_CHARACTERISTICS_LOG100
Definition SDL_pixels.h:514
@ SDL_TRANSFER_CHARACTERISTICS_GAMMA28
Definition SDL_pixels.h:510
@ SDL_TRANSFER_CHARACTERISTICS_SMPTE240
Definition SDL_pixels.h:512
@ SDL_TRANSFER_CHARACTERISTICS_BT2020_10BIT
Definition SDL_pixels.h:519
@ SDL_TRANSFER_CHARACTERISTICS_SRGB
Definition SDL_pixels.h:518
@ SDL_TRANSFER_CHARACTERISTICS_PQ
Definition SDL_pixels.h:521
@ SDL_TRANSFER_CHARACTERISTICS_LINEAR
Definition SDL_pixels.h:513
@ SDL_TRANSFER_CHARACTERISTICS_BT2020_12BIT
Definition SDL_pixels.h:520
@ SDL_TRANSFER_CHARACTERISTICS_GAMMA22
Definition SDL_pixels.h:509
SDL_ArrayOrder
Definition SDL_pixels.h:130
@ SDL_ARRAYORDER_RGB
Definition SDL_pixels.h:132
@ SDL_ARRAYORDER_NONE
Definition SDL_pixels.h:131
@ SDL_ARRAYORDER_ARGB
Definition SDL_pixels.h:134
@ SDL_ARRAYORDER_BGRA
Definition SDL_pixels.h:136
@ SDL_ARRAYORDER_ABGR
Definition SDL_pixels.h:137
@ SDL_ARRAYORDER_RGBA
Definition SDL_pixels.h:133
@ SDL_ARRAYORDER_BGR
Definition SDL_pixels.h:135
SDL_PixelFormatEnum
Definition SDL_pixels.h:216
@ SDL_PIXELFORMAT_BGR48_FLOAT
Definition SDL_pixels.h:350
@ SDL_PIXELFORMAT_RGBA128_FLOAT
Definition SDL_pixels.h:371
@ SDL_PIXELFORMAT_BGR565
Definition SDL_pixels.h:284
@ SDL_PIXELFORMAT_P010
Definition SDL_pixels.h:419
@ SDL_PIXELFORMAT_EXTERNAL_OES
Definition SDL_pixels.h:421
@ SDL_PIXELFORMAT_ARGB64
Definition SDL_pixels.h:338
@ SDL_PIXELFORMAT_YVYU
Definition SDL_pixels.h:413
@ SDL_PIXELFORMAT_RGB332
Definition SDL_pixels.h:238
@ SDL_PIXELFORMAT_INDEX2LSB
Definition SDL_pixels.h:224
@ SDL_PIXELFORMAT_INDEX1LSB
Definition SDL_pixels.h:218
@ SDL_PIXELFORMAT_BGR444
Definition SDL_pixels.h:248
@ SDL_PIXELFORMAT_RGB96_FLOAT
Definition SDL_pixels.h:365
@ SDL_PIXELFORMAT_RGBX32
Definition SDL_pixels.h:390
@ SDL_PIXELFORMAT_ABGR4444
Definition SDL_pixels.h:263
@ SDL_PIXELFORMAT_BGRA4444
Definition SDL_pixels.h:266
@ SDL_PIXELFORMAT_BGR24
Definition SDL_pixels.h:290
@ SDL_PIXELFORMAT_INDEX4MSB
Definition SDL_pixels.h:233
@ SDL_PIXELFORMAT_ABGR2101010
Definition SDL_pixels.h:326
@ SDL_PIXELFORMAT_BGRA32
Definition SDL_pixels.h:388
@ SDL_PIXELFORMAT_RGB555
Definition SDL_pixels.h:252
@ SDL_PIXELFORMAT_RGB444
Definition SDL_pixels.h:244
@ SDL_PIXELFORMAT_XBGR2101010
Definition SDL_pixels.h:320
@ SDL_PIXELFORMAT_RGBA64_FLOAT
Definition SDL_pixels.h:353
@ SDL_PIXELFORMAT_INDEX2MSB
Definition SDL_pixels.h:227
@ SDL_PIXELFORMAT_BGRA64_FLOAT
Definition SDL_pixels.h:359
@ SDL_PIXELFORMAT_RGBA8888
Definition SDL_pixels.h:308
@ SDL_PIXELFORMAT_RGBA5551
Definition SDL_pixels.h:272
@ SDL_PIXELFORMAT_ARGB1555
Definition SDL_pixels.h:269
@ SDL_PIXELFORMAT_XBGR4444
Definition SDL_pixels.h:245
@ SDL_PIXELFORMAT_RGBA64
Definition SDL_pixels.h:335
@ SDL_PIXELFORMAT_INDEX8
Definition SDL_pixels.h:236
@ SDL_PIXELFORMAT_XRGB2101010
Definition SDL_pixels.h:317
@ SDL_PIXELFORMAT_XRGB8888
Definition SDL_pixels.h:293
@ SDL_PIXELFORMAT_UYVY
Definition SDL_pixels.h:411
@ SDL_PIXELFORMAT_BGRX32
Definition SDL_pixels.h:392
@ SDL_PIXELFORMAT_YV12
Definition SDL_pixels.h:405
@ SDL_PIXELFORMAT_ABGR32
Definition SDL_pixels.h:389
@ SDL_PIXELFORMAT_BGRX8888
Definition SDL_pixels.h:302
@ SDL_PIXELFORMAT_RGB24
Definition SDL_pixels.h:287
@ SDL_PIXELFORMAT_BGRA64
Definition SDL_pixels.h:341
@ SDL_PIXELFORMAT_ABGR8888
Definition SDL_pixels.h:311
@ SDL_PIXELFORMAT_YUY2
Definition SDL_pixels.h:409
@ SDL_PIXELFORMAT_XBGR32
Definition SDL_pixels.h:393
@ SDL_PIXELFORMAT_NV12
Definition SDL_pixels.h:415
@ SDL_PIXELFORMAT_BGRA8888
Definition SDL_pixels.h:314
@ SDL_PIXELFORMAT_ABGR128_FLOAT
Definition SDL_pixels.h:380
@ SDL_PIXELFORMAT_ARGB32
Definition SDL_pixels.h:387
@ SDL_PIXELFORMAT_ABGR1555
Definition SDL_pixels.h:275
@ SDL_PIXELFORMAT_NV21
Definition SDL_pixels.h:417
@ SDL_PIXELFORMAT_IYUV
Definition SDL_pixels.h:407
@ SDL_PIXELFORMAT_ARGB8888
Definition SDL_pixels.h:305
@ SDL_PIXELFORMAT_ABGR64_FLOAT
Definition SDL_pixels.h:362
@ SDL_PIXELFORMAT_ABGR64
Definition SDL_pixels.h:344
@ SDL_PIXELFORMAT_XRGB32
Definition SDL_pixels.h:391
@ SDL_PIXELFORMAT_XBGR1555
Definition SDL_pixels.h:253
@ SDL_PIXELFORMAT_RGB48
Definition SDL_pixels.h:329
@ SDL_PIXELFORMAT_XRGB4444
Definition SDL_pixels.h:241
@ SDL_PIXELFORMAT_BGR96_FLOAT
Definition SDL_pixels.h:368
@ SDL_PIXELFORMAT_ARGB4444
Definition SDL_pixels.h:257
@ SDL_PIXELFORMAT_RGB48_FLOAT
Definition SDL_pixels.h:347
@ SDL_PIXELFORMAT_BGR48
Definition SDL_pixels.h:332
@ SDL_PIXELFORMAT_RGBA32
Definition SDL_pixels.h:386
@ SDL_PIXELFORMAT_BGRA128_FLOAT
Definition SDL_pixels.h:377
@ SDL_PIXELFORMAT_ARGB64_FLOAT
Definition SDL_pixels.h:356
@ SDL_PIXELFORMAT_INDEX1MSB
Definition SDL_pixels.h:221
@ SDL_PIXELFORMAT_INDEX4LSB
Definition SDL_pixels.h:230
@ SDL_PIXELFORMAT_RGBX8888
Definition SDL_pixels.h:296
@ SDL_PIXELFORMAT_BGRA5551
Definition SDL_pixels.h:278
@ SDL_PIXELFORMAT_ARGB128_FLOAT
Definition SDL_pixels.h:374
@ SDL_PIXELFORMAT_XRGB1555
Definition SDL_pixels.h:249
@ SDL_PIXELFORMAT_RGB565
Definition SDL_pixels.h:281
@ SDL_PIXELFORMAT_XBGR8888
Definition SDL_pixels.h:299
@ SDL_PIXELFORMAT_ARGB2101010
Definition SDL_pixels.h:323
@ SDL_PIXELFORMAT_BGR555
Definition SDL_pixels.h:256
@ SDL_PIXELFORMAT_UNKNOWN
Definition SDL_pixels.h:217
@ SDL_PIXELFORMAT_RGBA4444
Definition SDL_pixels.h:260
SDL_Colorspace
Definition SDL_pixels.h:585
@ SDL_COLORSPACE_BT2020_LIMITED
Definition SDL_pixels.h:655
@ SDL_COLORSPACE_BT601_LIMITED
Definition SDL_pixels.h:623
@ SDL_COLORSPACE_BT709_FULL
Definition SDL_pixels.h:647
@ SDL_COLORSPACE_HDR10
Definition SDL_pixels.h:607
@ SDL_COLORSPACE_BT601_FULL
Definition SDL_pixels.h:631
@ SDL_COLORSPACE_UNKNOWN
Definition SDL_pixels.h:586
@ SDL_COLORSPACE_BT2020_FULL
Definition SDL_pixels.h:663
@ SDL_COLORSPACE_JPEG
Definition SDL_pixels.h:615
@ SDL_COLORSPACE_BT709_LIMITED
Definition SDL_pixels.h:639
@ SDL_COLORSPACE_SRGB_LINEAR
Definition SDL_pixels.h:598
@ SDL_COLORSPACE_SRGB
Definition SDL_pixels.h:589
@ SDL_COLORSPACE_RGB_DEFAULT
Definition SDL_pixels.h:672
@ SDL_COLORSPACE_YUV_DEFAULT
Definition SDL_pixels.h:675
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
Definition SDL_pixels.h:156
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:116
@ SDL_PACKEDORDER_NONE
Definition SDL_pixels.h:117
@ SDL_PACKEDORDER_RGBX
Definition SDL_pixels.h:119
@ SDL_PACKEDORDER_BGRX
Definition SDL_pixels.h:123
@ SDL_PACKEDORDER_XBGR
Definition SDL_pixels.h:122
@ SDL_PACKEDORDER_RGBA
Definition SDL_pixels.h:121
@ SDL_PACKEDORDER_ABGR
Definition SDL_pixels.h:124
@ SDL_PACKEDORDER_BGRA
Definition SDL_pixels.h:125
@ SDL_PACKEDORDER_XRGB
Definition SDL_pixels.h:118
@ SDL_PACKEDORDER_ARGB
Definition SDL_pixels.h:120
void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b)
uint8_t Uint8
Definition SDL_stdinc.h:188
int SDL_bool
Definition SDL_stdinc.h:170
uint32_t Uint32
Definition SDL_stdinc.h:224
Uint32 version
Definition SDL_pixels.h:723
SDL_Color * colors
Definition SDL_pixels.h:722
struct SDL_PixelFormat * next
Definition SDL_pixels.h:755
Uint8 padding[2]
Definition SDL_pixels.h:741
SDL_PixelFormatEnum format
Definition SDL_pixels.h:737
Uint8 bytes_per_pixel
Definition SDL_pixels.h:740
SDL_Palette * palette
Definition SDL_pixels.h:738