sdlSetSurfaceColorMod function

bool sdlSetSurfaceColorMod(
  1. Pointer<SdlSurface> surface,
  2. int r,
  3. int g,
  4. int b,
)

Set an additional color value multiplied into blit operations.

When this surface is blitted, during the blit operation each source color channel is modulated by the appropriate color value according to the following formula:

srcC = srcC * (color / 255)

\param surface the SDL_Surface structure to update. \param r the red color value multiplied into blit operations. \param g the green color value multiplied into blit operations. \param b the blue color value multiplied into blit operations. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_GetSurfaceColorMod \sa SDL_SetSurfaceAlphaMod

extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)

Implementation

bool sdlSetSurfaceColorMod(Pointer<SdlSurface> surface, int r, int g, int b) {
  final sdlSetSurfaceColorModLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlSurface> surface, Uint8 r, Uint8 g, Uint8 b),
      int Function(Pointer<SdlSurface> surface, int r, int g,
          int b)>('SDL_SetSurfaceColorMod');
  return sdlSetSurfaceColorModLookupFunction(surface, r, g, b) == 1;
}