sdlSetClipRect function

bool sdlSetClipRect(
  1. Pointer<SdlSurface> surface,
  2. Pointer<SdlRect> rect
)

Set the clipping rectangle for a surface.

When surface is the destination of a blit, only the area within the clip rectangle is drawn into.

Note that blits are automatically clipped to the edges of the source and destination surfaces.

\param surface the SDL_Surface structure to be clipped \param rect the SDL_Rect structure representing the clipping rectangle, or NULL to disable clipping \returns SDL_TRUE if the rectangle intersects the surface, otherwise SDL_FALSE and blits will be completely clipped.

\since This function is available since SDL 2.0.0.

\sa SDL_BlitSurface \sa SDL_GetClipRect

extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect)

Implementation

bool sdlSetClipRect(Pointer<SdlSurface> surface, Pointer<SdlRect> rect) {
  final sdlSetClipRectLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Pointer<SdlSurface> surface, Pointer<SdlRect> rect),
      int Function(Pointer<SdlSurface> surface,
          Pointer<SdlRect> rect)>('SDL_SetClipRect');
  return sdlSetClipRectLookupFunction(surface, rect) == 1;
}