sdlBlitSurface9Grid function

bool sdlBlitSurface9Grid(
  1. Pointer<SdlSurface> src,
  2. Pointer<SdlRect> srcrect,
  3. int leftWidth,
  4. int rightWidth,
  5. int topHeight,
  6. int bottomHeight,
  7. double scale,
  8. int scaleMode,
  9. Pointer<SdlSurface> dst,
  10. Pointer<SdlRect> dstrect,
)

Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a different format.

The pixels in the source surface are split into a 3x3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels. The corners are then scaled using scale and fit into the corners of the destination rectangle. The sides and center are then stretched into place to cover the remaining destination rectangle.

\param src the SDL_Surface structure to be copied from. \param srcrect the SDL_Rect structure representing the rectangle to be used for the 9-grid, or NULL to use the entire surface. \param left_width the width, in pixels, of the left corners in srcrect. \param right_width the width, in pixels, of the right corners in srcrect. \param top_height the height, in pixels, of the top corners in srcrect. \param bottom_height the height, in pixels, of the bottom corners in srcrect. \param scale the scale used to transform the corner of srcrect into the corner of dstrect, or 0.0f for an unscaled blit. \param scaleMode scale algorithm to be used. \param dst the SDL_Surface structure that is the blit target. \param dstrect the SDL_Rect structure representing the target rectangle in the destination surface, or NULL to fill the entire surface. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety The same destination surface should not be used from two threads at once. It is safe to use the same source surface from multiple threads.

\since This function is available since SDL 3.1.3.

\sa SDL_BlitSurface

extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect)

Implementation

bool sdlBlitSurface9Grid(
    Pointer<SdlSurface> src,
    Pointer<SdlRect> srcrect,
    int leftWidth,
    int rightWidth,
    int topHeight,
    int bottomHeight,
    double scale,
    int scaleMode,
    Pointer<SdlSurface> dst,
    Pointer<SdlRect> dstrect) {
  final sdlBlitSurface9GridLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlSurface> src,
          Pointer<SdlRect> srcrect,
          Int32 leftWidth,
          Int32 rightWidth,
          Int32 topHeight,
          Int32 bottomHeight,
          Float scale,
          Int32 scaleMode,
          Pointer<SdlSurface> dst,
          Pointer<SdlRect> dstrect),
      int Function(
          Pointer<SdlSurface> src,
          Pointer<SdlRect> srcrect,
          int leftWidth,
          int rightWidth,
          int topHeight,
          int bottomHeight,
          double scale,
          int scaleMode,
          Pointer<SdlSurface> dst,
          Pointer<SdlRect> dstrect)>('SDL_BlitSurface9Grid');
  return sdlBlitSurface9GridLookupFunction(src, srcrect, leftWidth, rightWidth,
          topHeight, bottomHeight, scale, scaleMode, dst, dstrect) ==
      1;
}