sdlPremultiplySurfaceAlpha function

bool sdlPremultiplySurfaceAlpha(
  1. Pointer<SdlSurface> surface,
  2. bool linear
)

Premultiply the alpha in a surface.

This is safe to use with src == dst, but not for other overlapping areas.

\param surface the surface to modify. \param linear true to convert from sRGB to linear space for the alpha multiplication, false to do multiplication in sRGB space. \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_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear)

Implementation

bool sdlPremultiplySurfaceAlpha(Pointer<SdlSurface> surface, bool linear) {
  final sdlPremultiplySurfaceAlphaLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlSurface> surface, Uint8 linear),
      int Function(Pointer<SdlSurface> surface,
          int linear)>('SDL_PremultiplySurfaceAlpha');
  return sdlPremultiplySurfaceAlphaLookupFunction(surface, linear ? 1 : 0) == 1;
}