sdlDuplicateSurface function

Pointer<SdlSurface> sdlDuplicateSurface(
  1. Pointer<SdlSurface> surface
)

Creates a new surface identical to the existing surface.

If the original surface has alternate images, the new surface will have a reference to them as well.

The returned surface should be freed with SDL_DestroySurface().

\param surface the surface to duplicate. \returns a copy of the surface or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_DestroySurface

extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surface)

Implementation

Pointer<SdlSurface> sdlDuplicateSurface(Pointer<SdlSurface> surface) {
  final sdlDuplicateSurfaceLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlSurface> Function(Pointer<SdlSurface> surface),
      Pointer<SdlSurface> Function(
          Pointer<SdlSurface> surface)>('SDL_DuplicateSurface');
  return sdlDuplicateSurfaceLookupFunction(surface);
}