.\" 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_MapRGB: .\" https://wiki.libsdl.org/SDL_MapRGB .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision SDL-3.1.0 .\" 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_MapRGB .\" SDL can be found at https://libsdl.org/ .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH SDL_MapRGB 3 "SDL 3.1.0" "SDL" "SDL3 FUNCTIONS" .SH NAME SDL_MapRGB \- Map an RGB triple to an opaque pixel value for a given pixel format\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3/SDL.h\(dq .PP .BI "Uint32 SDL_MapRGB(const SDL_PixelFormat * format, .BI " Uint8 r, Uint8 g, Uint8 b); .fi .SH DESCRIPTION This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format\[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 specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque)\[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 Uint16, and similarly a Uint8 for an 8-bpp format)\[char46] .SH FUNCTION PARAMETERS .TP .I format an .BR SDL_PixelFormat structure describing the pixel format .TP .I r the red component of the pixel in the range 0-255 .TP .I g the green component of the pixel in the range 0-255 .TP .I b the blue component of the pixel in the range 0-255 .SH RETURN VALUE Returns a pixel value .SH AVAILABILITY This function is available since SDL 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR SDL_GetRGB (3), .BR SDL_GetRGBA (3), .BR SDL_MapRGBA (3)