MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_MapRGB

Function SDL_MapRGB

deps/SDL2/src/video/SDL_pixels.c:805–815  ·  view source on GitHub ↗

Find the opaque pixel value corresponding to an RGB triple */

Source from the content-addressed store, hash-verified

803
804/* Find the opaque pixel value corresponding to an RGB triple */
805Uint32
806SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b)
807{
808 if (format->palette == NULL) {
809 return (r >> format->Rloss) << format->Rshift
810 | (g >> format->Gloss) << format->Gshift
811 | (b >> format->Bloss) << format->Bshift | format->Amask;
812 } else {
813 return SDL_FindColor(format->palette, r, g, b, SDL_ALPHA_OPAQUE);
814 }
815}
816
817/* Find the pixel value corresponding to an RGBA quadruple */
818Uint32

Callers 5

initializeTextureFunction · 0.85
loadFontFunction · 0.85
initializeTexturesFunction · 0.85
setpixFunction · 0.85
DrawScreenFunction · 0.85

Calls 1

SDL_FindColorFunction · 0.85

Tested by 2

setpixFunction · 0.68
DrawScreenFunction · 0.68