sdlClearSurface function

bool sdlClearSurface(
  1. Pointer<SdlSurface> surface,
  2. double r,
  3. double g,
  4. double b,
  5. double a,
)

Clear a surface with a specific color, with floating point precision.

This function handles all surface formats, and ignores any clip rectangle.

If the surface is YUV, the color is assumed to be in the sRGB colorspace, otherwise the color is assumed to be in the colorspace of the suface.

\param surface the SDL_Surface to clear. \param r the red component of the pixel, normally in the range 0-1. \param g the green component of the pixel, normally in the range 0-1. \param b the blue component of the pixel, normally in the range 0-1. \param a the alpha component of the pixel, normally in the range 0-1. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a)

Implementation

bool sdlClearSurface(
    Pointer<SdlSurface> surface, double r, double g, double b, double a) {
  final sdlClearSurfaceLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlSurface> surface, Float r, Float g, Float b, Float a),
      int Function(Pointer<SdlSurface> surface, double r, double g, double b,
          double a)>('SDL_ClearSurface');
  return sdlClearSurfaceLookupFunction(surface, r, g, b, a) == 1;
}