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. */
128typedef enum
129{
132 SDL_ARRAYORDER_UNUSED1, /* Left for compatibility with SDL2 */
133 SDL_ARRAYORDER_UNUSED2, /* Left for compatibility with SDL2 */
136
137/** Packed component layout. */
150
151#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
152
153#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
154 ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
155 ((bits) << 8) | ((bytes) << 0))
156
157#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
158#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
159#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
160#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
161#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
162#define SDL_BYTESPERPIXEL(X) \
163 (SDL_ISPIXELFORMAT_FOURCC(X) ? \
164 ((((X) == SDL_PIXELFORMAT_YUY2) || \
165 ((X) == SDL_PIXELFORMAT_UYVY) || \
166 ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
167
168#define SDL_ISPIXELFORMAT_INDEXED(format) \
169 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
170 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
171 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
172 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
173 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
174
175#define SDL_ISPIXELFORMAT_PACKED(format) \
176 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
177 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
178 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
179 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
180
181#define SDL_ISPIXELFORMAT_ARRAY(format) \
182 (!SDL_ISPIXELFORMAT_FOURCC(format) && \
183 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
184 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
185 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
186 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
187 (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
188
189#define SDL_ISPIXELFORMAT_ALPHA(format) \
190 ((SDL_ISPIXELFORMAT_PACKED(format) && \
191 ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
192 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
193 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
194 (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))))
195
196#define SDL_ISPIXELFORMAT_10BIT(format) \
197 ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32) && \
198 (SDL_PIXELLAYOUT(format) == SDL_PACKEDLAYOUT_2101010))
199
200/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
201#define SDL_ISPIXELFORMAT_FOURCC(format) \
202 ((format) && (SDL_PIXELFLAG(format) != 1))
203
204/* Note: If you modify this list, update SDL_GetPixelFormatName() */
205typedef enum
206{
210 1, 0),
213 1, 0),
216 2, 0),
219 2, 0),
222 4, 0),
225 4, 0),
279 24, 3),
282 24, 3),
319
320 /* Aliases for RGBA byte arrays of color data, for the current platform */
321#if SDL_BYTEORDER == SDL_BIG_ENDIAN
330#else
339#endif
340
341 SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
342 SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
343 SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
344 SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
345 SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
346 SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
347 SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
348 SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
349 SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
350 SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
351 SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
352 SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
353 SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
354 SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
355 SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
356 SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
358
359/**
360 * The bits of this structure can be directly reinterpreted as an integer-packed
361 * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
362 * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
363 */
371#define SDL_Colour SDL_Color
372
380
381/**
382 * \note Everything in the pixel format structure is read-only.
383 */
406
407/**
408 * Get the human readable name of a pixel format.
409 *
410 * \param format the pixel format to query
411 * \returns the human readable name of the specified pixel format or
412 * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
413 *
414 * \since This function is available since SDL 3.0.0.
415 */
416extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
417
418/**
419 * Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
420 *
421 * \param format one of the SDL_PixelFormatEnum values
422 * \param bpp a bits per pixel value; usually 15, 16, or 32
423 * \param Rmask a pointer filled in with the red mask for the format
424 * \param Gmask a pointer filled in with the green mask for the format
425 * \param Bmask a pointer filled in with the blue mask for the format
426 * \param Amask a pointer filled in with the alpha mask for the format
427 * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
428 * possible; call SDL_GetError() for more information.
429 *
430 * \since This function is available since SDL 3.0.0.
431 *
432 * \sa SDL_GetPixelFormatEnumForMasks
433 */
435 int *bpp,
436 Uint32 * Rmask,
437 Uint32 * Gmask,
438 Uint32 * Bmask,
439 Uint32 * Amask);
440
441/**
442 * Convert a bpp value and RGBA masks to an enumerated pixel format.
443 *
444 * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
445 * possible.
446 *
447 * \param bpp a bits per pixel value; usually 15, 16, or 32
448 * \param Rmask the red mask for the format
449 * \param Gmask the green mask for the format
450 * \param Bmask the blue mask for the format
451 * \param Amask the alpha mask for the format
452 * \returns one of the SDL_PixelFormatEnum values
453 *
454 * \since This function is available since SDL 3.0.0.
455 *
456 * \sa SDL_GetMasksForPixelFormatEnum
457 */
458extern DECLSPEC Uint32 SDLCALL SDL_GetPixelFormatEnumForMasks(int bpp,
462 Uint32 Amask);
463
464/**
465 * Create an SDL_PixelFormat structure corresponding to a pixel format.
466 *
467 * Returned structure may come from a shared global cache (i.e. not newly
468 * allocated), and hence should not be modified, especially the palette. Weird
469 * errors such as `Blit combination not supported` may occur.
470 *
471 * \param pixel_format one of the SDL_PixelFormatEnum values
472 * \returns the new SDL_PixelFormat structure or NULL on failure; call
473 * SDL_GetError() for more information.
474 *
475 * \since This function is available since SDL 3.0.0.
476 *
477 * \sa SDL_DestroyPixelFormat
478 */
479extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_CreatePixelFormat(Uint32 pixel_format);
480
481/**
482 * Free an SDL_PixelFormat structure allocated by SDL_CreatePixelFormat().
483 *
484 * \param format the SDL_PixelFormat structure to free
485 *
486 * \since This function is available since SDL 3.0.0.
487 *
488 * \sa SDL_CreatePixelFormat
489 */
490extern DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
491
492/**
493 * Create a palette structure with the specified number of color entries.
494 *
495 * The palette entries are initialized to white.
496 *
497 * \param ncolors represents the number of color entries in the color palette
498 * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
499 * there wasn't enough memory); call SDL_GetError() for more
500 * information.
501 *
502 * \since This function is available since SDL 3.0.0.
503 *
504 * \sa SDL_DestroyPalette
505 */
506extern DECLSPEC SDL_Palette *SDLCALL SDL_CreatePalette(int ncolors);
507
508/**
509 * Set the palette for a pixel format structure.
510 *
511 * \param format the SDL_PixelFormat structure that will use the palette
512 * \param palette the SDL_Palette structure that will be used
513 * \returns 0 on success or a negative error code on failure; call
514 * SDL_GetError() for more information.
515 *
516 * \since This function is available since SDL 3.0.0.
517 *
518 * \sa SDL_CreatePalette
519 * \sa SDL_DestroyPalette
520 */
523
524/**
525 * Set a range of colors in a palette.
526 *
527 * \param palette the SDL_Palette structure to modify
528 * \param colors an array of SDL_Color structures to copy into the palette
529 * \param firstcolor the index of the first palette entry to modify
530 * \param ncolors the number of entries to modify
531 * \returns 0 on success or a negative error code on failure; call
532 * SDL_GetError() for more information.
533 *
534 * \since This function is available since SDL 3.0.0.
535 *
536 * \sa SDL_CreatePalette
537 * \sa SDL_CreateSurface
538 */
539extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
540 const SDL_Color * colors,
541 int firstcolor, int ncolors);
542
543/**
544 * Free a palette created with SDL_CreatePalette().
545 *
546 * \param palette the SDL_Palette structure to be freed
547 *
548 * \since This function is available since SDL 3.0.0.
549 *
550 * \sa SDL_CreatePalette
551 */
552extern DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
553
554/**
555 * Map an RGB triple to an opaque pixel value for a given pixel format.
556 *
557 * This function maps the RGB color value to the specified pixel format and
558 * returns the pixel value best approximating the given RGB color value for
559 * the given pixel format.
560 *
561 * If the format has a palette (8-bit) the index of the closest matching color
562 * in the palette will be returned.
563 *
564 * If the specified pixel format has an alpha component it will be returned as
565 * all 1 bits (fully opaque).
566 *
567 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
568 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
569 * format the return value can be assigned to a Uint16, and similarly a Uint8
570 * for an 8-bpp format).
571 *
572 * \param format an SDL_PixelFormat structure describing the pixel format
573 * \param r the red component of the pixel in the range 0-255
574 * \param g the green component of the pixel in the range 0-255
575 * \param b the blue component of the pixel in the range 0-255
576 * \returns a pixel value
577 *
578 * \since This function is available since SDL 3.0.0.
579 *
580 * \sa SDL_GetRGB
581 * \sa SDL_GetRGBA
582 * \sa SDL_MapRGBA
583 */
584extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
585 Uint8 r, Uint8 g, Uint8 b);
586
587/**
588 * Map an RGBA quadruple to a pixel value for a given pixel format.
589 *
590 * This function maps the RGBA color value to the specified pixel format and
591 * returns the pixel value best approximating the given RGBA color value for
592 * the given pixel format.
593 *
594 * If the specified pixel format has no alpha component the alpha value will
595 * be ignored (as it will be in formats with a palette).
596 *
597 * If the format has a palette (8-bit) the index of the closest matching color
598 * in the palette will be returned.
599 *
600 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
601 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
602 * format the return value can be assigned to a Uint16, and similarly a Uint8
603 * for an 8-bpp format).
604 *
605 * \param format an SDL_PixelFormat structure describing the format of the
606 * pixel
607 * \param r the red component of the pixel in the range 0-255
608 * \param g the green component of the pixel in the range 0-255
609 * \param b the blue component of the pixel in the range 0-255
610 * \param a the alpha component of the pixel in the range 0-255
611 * \returns a pixel value
612 *
613 * \since This function is available since SDL 3.0.0.
614 *
615 * \sa SDL_GetRGB
616 * \sa SDL_GetRGBA
617 * \sa SDL_MapRGB
618 */
619extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
620 Uint8 r, Uint8 g, Uint8 b,
621 Uint8 a);
622
623/**
624 * Get RGB values from a pixel in the specified format.
625 *
626 * This function uses the entire 8-bit [0..255] range when converting color
627 * components from pixel formats with less than 8-bits per RGB component
628 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
629 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
630 *
631 * \param pixel a pixel value
632 * \param format an SDL_PixelFormat structure describing the format of the
633 * pixel
634 * \param r a pointer filled in with the red component
635 * \param g a pointer filled in with the green component
636 * \param b a pointer filled in with the blue component
637 *
638 * \since This function is available since SDL 3.0.0.
639 *
640 * \sa SDL_GetRGBA
641 * \sa SDL_MapRGB
642 * \sa SDL_MapRGBA
643 */
644extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
645 const SDL_PixelFormat * format,
646 Uint8 * r, Uint8 * g, Uint8 * b);
647
648/**
649 * Get RGBA values from a pixel in the specified format.
650 *
651 * This function uses the entire 8-bit [0..255] range when converting color
652 * components from pixel formats with less than 8-bits per RGB component
653 * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
654 * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
655 *
656 * If the surface has no alpha component, the alpha will be returned as 0xff
657 * (100% opaque).
658 *
659 * \param pixel a pixel value
660 * \param format an SDL_PixelFormat structure describing the format of the
661 * pixel
662 * \param r a pointer filled in with the red component
663 * \param g a pointer filled in with the green component
664 * \param b a pointer filled in with the blue component
665 * \param a a pointer filled in with the alpha component
666 *
667 * \since This function is available since SDL 3.0.0.
668 *
669 * \sa SDL_GetRGB
670 * \sa SDL_MapRGB
671 * \sa SDL_MapRGBA
672 */
673extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
674 const SDL_PixelFormat * format,
675 Uint8 * r, Uint8 * g, Uint8 * b,
676 Uint8 * a);
677
678
679/* Ends C function definitions when using C++ */
680#ifdef __cplusplus
681}
682#endif
683#include <SDL3/SDL_close_code.h>
684
685#endif /* SDL_pixels_h_ */
int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)
SDL_bool SDL_GetMasksForPixelFormatEnum(Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
int SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette)
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
const char * SDL_GetPixelFormatName(Uint32 format)
void SDL_DestroyPixelFormat(SDL_PixelFormat *format)
Uint32 SDL_MapRGBA(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
SDL_PackedLayout
Definition SDL_pixels.h:139
@ SDL_PACKEDLAYOUT_NONE
Definition SDL_pixels.h:140
@ SDL_PACKEDLAYOUT_8888
Definition SDL_pixels.h:146
@ SDL_PACKEDLAYOUT_1010102
Definition SDL_pixels.h:148
@ SDL_PACKEDLAYOUT_565
Definition SDL_pixels.h:145
@ SDL_PACKEDLAYOUT_332
Definition SDL_pixels.h:141
@ SDL_PACKEDLAYOUT_5551
Definition SDL_pixels.h:144
@ SDL_PACKEDLAYOUT_1555
Definition SDL_pixels.h:143
@ SDL_PACKEDLAYOUT_4444
Definition SDL_pixels.h:142
@ SDL_PACKEDLAYOUT_2101010
Definition SDL_pixels.h:147
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
Uint32 SDL_MapRGB(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)
void SDL_DestroyPalette(SDL_Palette *palette)
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D)
Definition SDL_pixels.h:151
SDL_ArrayOrder
Definition SDL_pixels.h:129
@ SDL_ARRAYORDER_RGB
Definition SDL_pixels.h:131
@ SDL_ARRAYORDER_UNUSED1
Definition SDL_pixels.h:132
@ SDL_ARRAYORDER_NONE
Definition SDL_pixels.h:130
@ SDL_ARRAYORDER_BGR
Definition SDL_pixels.h:134
@ SDL_ARRAYORDER_UNUSED2
Definition SDL_pixels.h:133
SDL_PixelFormat * SDL_CreatePixelFormat(Uint32 pixel_format)
SDL_PixelFormatEnum
Definition SDL_pixels.h:206
@ SDL_PIXELFORMAT_BGR565
Definition SDL_pixels.h:274
@ SDL_PIXELFORMAT_EXTERNAL_OES
Definition SDL_pixels.h:355
@ SDL_PIXELFORMAT_YVYU
Definition SDL_pixels.h:349
@ SDL_PIXELFORMAT_RGB332
Definition SDL_pixels.h:228
@ SDL_PIXELFORMAT_INDEX2LSB
Definition SDL_pixels.h:214
@ SDL_PIXELFORMAT_INDEX1LSB
Definition SDL_pixels.h:208
@ SDL_PIXELFORMAT_BGR444
Definition SDL_pixels.h:238
@ SDL_PIXELFORMAT_RGBX32
Definition SDL_pixels.h:326
@ SDL_PIXELFORMAT_ABGR4444
Definition SDL_pixels.h:253
@ SDL_PIXELFORMAT_BGRA4444
Definition SDL_pixels.h:256
@ SDL_PIXELFORMAT_BGR24
Definition SDL_pixels.h:280
@ SDL_PIXELFORMAT_INDEX4MSB
Definition SDL_pixels.h:223
@ SDL_PIXELFORMAT_ABGR2101010
Definition SDL_pixels.h:316
@ SDL_PIXELFORMAT_BGRA32
Definition SDL_pixels.h:324
@ SDL_PIXELFORMAT_RGB555
Definition SDL_pixels.h:242
@ SDL_PIXELFORMAT_RGB444
Definition SDL_pixels.h:234
@ SDL_PIXELFORMAT_XBGR2101010
Definition SDL_pixels.h:310
@ SDL_PIXELFORMAT_INDEX2MSB
Definition SDL_pixels.h:217
@ SDL_PIXELFORMAT_RGBA8888
Definition SDL_pixels.h:298
@ SDL_PIXELFORMAT_RGBA5551
Definition SDL_pixels.h:262
@ SDL_PIXELFORMAT_ARGB1555
Definition SDL_pixels.h:259
@ SDL_PIXELFORMAT_XBGR4444
Definition SDL_pixels.h:235
@ SDL_PIXELFORMAT_INDEX8
Definition SDL_pixels.h:226
@ SDL_PIXELFORMAT_XRGB2101010
Definition SDL_pixels.h:307
@ SDL_PIXELFORMAT_XRGB8888
Definition SDL_pixels.h:283
@ SDL_PIXELFORMAT_UYVY
Definition SDL_pixels.h:347
@ SDL_PIXELFORMAT_BGRX32
Definition SDL_pixels.h:328
@ SDL_PIXELFORMAT_YV12
Definition SDL_pixels.h:341
@ SDL_PIXELFORMAT_ABGR32
Definition SDL_pixels.h:325
@ SDL_PIXELFORMAT_BGRX8888
Definition SDL_pixels.h:292
@ SDL_PIXELFORMAT_RGB24
Definition SDL_pixels.h:277
@ SDL_PIXELFORMAT_ABGR8888
Definition SDL_pixels.h:301
@ SDL_PIXELFORMAT_YUY2
Definition SDL_pixels.h:345
@ SDL_PIXELFORMAT_XBGR32
Definition SDL_pixels.h:329
@ SDL_PIXELFORMAT_NV12
Definition SDL_pixels.h:351
@ SDL_PIXELFORMAT_BGRA8888
Definition SDL_pixels.h:304
@ SDL_PIXELFORMAT_ARGB32
Definition SDL_pixels.h:323
@ SDL_PIXELFORMAT_ABGR1555
Definition SDL_pixels.h:265
@ SDL_PIXELFORMAT_NV21
Definition SDL_pixels.h:353
@ SDL_PIXELFORMAT_IYUV
Definition SDL_pixels.h:343
@ SDL_PIXELFORMAT_ARGB8888
Definition SDL_pixels.h:295
@ SDL_PIXELFORMAT_XRGB32
Definition SDL_pixels.h:327
@ SDL_PIXELFORMAT_XBGR1555
Definition SDL_pixels.h:243
@ SDL_PIXELFORMAT_XRGB4444
Definition SDL_pixels.h:231
@ SDL_PIXELFORMAT_ARGB4444
Definition SDL_pixels.h:247
@ SDL_PIXELFORMAT_RGBA32
Definition SDL_pixels.h:322
@ SDL_PIXELFORMAT_INDEX1MSB
Definition SDL_pixels.h:211
@ SDL_PIXELFORMAT_INDEX4LSB
Definition SDL_pixels.h:220
@ SDL_PIXELFORMAT_RGBX8888
Definition SDL_pixels.h:286
@ SDL_PIXELFORMAT_BGRA5551
Definition SDL_pixels.h:268
@ SDL_PIXELFORMAT_XRGB1555
Definition SDL_pixels.h:239
@ SDL_PIXELFORMAT_RGB565
Definition SDL_pixels.h:271
@ SDL_PIXELFORMAT_XBGR8888
Definition SDL_pixels.h:289
@ SDL_PIXELFORMAT_ARGB2101010
Definition SDL_pixels.h:313
@ SDL_PIXELFORMAT_BGR555
Definition SDL_pixels.h:246
@ SDL_PIXELFORMAT_UNKNOWN
Definition SDL_pixels.h:207
@ SDL_PIXELFORMAT_RGBA4444
Definition SDL_pixels.h:250
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
Definition SDL_pixels.h:153
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)
Uint32 SDL_GetPixelFormatEnumForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
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:377
SDL_Color * colors
Definition SDL_pixels.h:376
struct SDL_PixelFormat * next
Definition SDL_pixels.h:404
Uint8 padding[2]
Definition SDL_pixels.h:390
SDL_Palette * palette
Definition SDL_pixels.h:387