.\" This manpage content is licensed under Creative Commons .\" Attribution 4.0 International (CC BY 4.0) .\" https://creativecommons.org/licenses/by/4.0/ .\" This manpage was generated from SDL's wiki page for SDL_MapRGBA: .\" https://wiki.libsdl.org/SDL_MapRGBA .\" Generated with SDL/build-scripts/wikiheaders.pl .\" Please report issues in this manpage's content at: .\" https://github.com/libsdl-org/sdlwiki/issues/new .\" Please report issues in the generation of this manpage from the wiki at: .\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20SDL_MapRGBA .\" SDL can be found at https://libsdl.org/ .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH SDL_MapRGBA 3 "SDL 3.2.5" "Simple Directmedia Layer" "SDL3 FUNCTIONS" .SH NAME SDL_MapRGBA \- Map an RGBA quadruple to a pixel value for a given pixel format\[char46] .SH HEADER FILE Defined in SDL3/SDL_pixels\[char46]h .SH SYNOPSIS .nf .B #include \(dqSDL3/SDL.h\(dq .PP .BI "Uint32 SDL_MapRGBA(const SDL_PixelFormatDetails *format, const SDL_Palette *palette, Uint8 r, Uint8 g, Uint8 b, Uint8 a); .fi .SH DESCRIPTION This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format\[char46] If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette)\[char46] If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned\[char46] If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e\[char46]g\[char46], with a 16-bpp format the return value can be assigned to a .BR Uint16 , and similarly a Uint8 for an 8-bpp format)\[char46] .SH FUNCTION PARAMETERS .TP .I format a pointer to .BR SDL_PixelFormatDetails describing the pixel format\[char46] .TP .I palette an optional palette for indexed formats, may be NULL\[char46] .TP .I r the red component of the pixel in the range 0-255\[char46] .TP .I g the green component of the pixel in the range 0-255\[char46] .TP .I b the blue component of the pixel in the range 0-255\[char46] .TP .I a the alpha component of the pixel in the range 0-255\[char46] .SH RETURN VALUE ( .BR Uint32 ) Returns a pixel value\[char46] .SH THREAD SAFETY It is safe to call this function from any thread, as long as the palette is not modified\[char46] .SH AVAILABILITY This function is available since SDL 3\[char46]2\[char46]0\[char46] .SH SEE ALSO .BR \(bu (3), .BR SDL_GetPixelFormatDetails (3), .BR \(bu (3), .BR SDL_GetRGBA (3), .BR \(bu (3), .BR SDL_MapRGB (3), .BR \(bu (3), .BR SDL_MapSurfaceRGBA (3)