sdlScaleSurface function

Pointer<SdlSurface> sdlScaleSurface(
  1. Pointer<SdlSurface> surface,
  2. int width,
  3. int height,
  4. int scaleMode,
)

Creates a new surface identical to the existing surface, scaled to the desired size.

The returned surface should be freed with SDL_DestroySurface().

\param surface the surface to duplicate and scale. \param width the width of the new surface. \param height the height of the new surface. \param scaleMode the SDL_ScaleMode to be used. \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_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode)

Implementation

Pointer<SdlSurface> sdlScaleSurface(
    Pointer<SdlSurface> surface, int width, int height, int scaleMode) {
  final sdlScaleSurfaceLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlSurface> Function(Pointer<SdlSurface> surface, Int32 width,
          Int32 height, Int32 scaleMode),
      Pointer<SdlSurface> Function(Pointer<SdlSurface> surface, int width,
          int height, int scaleMode)>('SDL_ScaleSurface');
  return sdlScaleSurfaceLookupFunction(surface, width, height, scaleMode);
}