.\" 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_MapSurfaceRGB:
.\"   https://wiki.libsdl.org/SDL_MapSurfaceRGB
.\" 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_MapSurfaceRGB
.\" SDL can be found at https://libsdl.org/
.de URL
\$2 \(laURL: \$1 \(ra\$3
..
.if \n[.g] .mso www.tmac
.TH SDL_MapSurfaceRGB 3 "SDL 3.2.5" "Simple Directmedia Layer" "SDL3 FUNCTIONS"
.SH NAME
SDL_MapSurfaceRGB \- Map an RGB triple to an opaque pixel value for a surface\[char46]
.SH HEADER FILE
Defined in SDL3/SDL_surface\[char46]h

.SH SYNOPSIS
.nf
.B #include \(dqSDL3/SDL.h\(dq
.PP
.BI "Uint32 SDL_MapSurfaceRGB(SDL_Surface *surface, 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 surface has a palette, the index of the closest matching color in
the palette will be returned\[char46]

If the surface 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 
.BR Uint16
, and
similarly a Uint8 for an 8-bpp format)\[char46]

.SH FUNCTION PARAMETERS
.TP
.I surface
the surface to use for the pixel format and palette\[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]
.SH RETURN VALUE
(
.BR Uint32
) Returns a pixel value\[char46]

.SH AVAILABILITY
This function is available since SDL 3\[char46]2\[char46]0\[char46]

.SH SEE ALSO
.BR \(bu (3),
.BR SDL_MapSurfaceRGBA (3)