sdlAddSurfaceAlternateImage function

bool sdlAddSurfaceAlternateImage(
  1. Pointer<SdlSurface> surface,
  2. Pointer<SdlSurface> image
)

Add an alternate version of a surface.

This function adds an alternate version of this surface, usually used for content with high DPI representations like cursors or icons. The size, format, and content do not need to match the original surface, and these alternate versions will not be updated when the original surface changes.

This function adds a reference to the alternate version, so you should call SDL_DestroySurface() on the image after this call.

\param surface the SDL_Surface structure to update. \param image a pointer to an alternate SDL_Surface to associate with this surface. \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_RemoveSurfaceAlternateImages \sa SDL_GetSurfaceImages \sa SDL_SurfaceHasAlternateImages

extern SDL_DECLSPEC bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image)

Implementation

bool sdlAddSurfaceAlternateImage(
    Pointer<SdlSurface> surface, Pointer<SdlSurface> image) {
  final sdlAddSurfaceAlternateImageLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlSurface> surface, Pointer<SdlSurface> image),
      int Function(Pointer<SdlSurface> surface,
          Pointer<SdlSurface> image)>('SDL_AddSurfaceAlternateImage');
  return sdlAddSurfaceAlternateImageLookupFunction(surface, image) == 1;
}