setClipRect method

bool setClipRect([
  1. Rectangle<double>? rect
])

Set the clip rectangle for rendering on the specified target.

\param renderer the rendering context. \param rect an SDL_Rect structure representing the clip area, relative to the viewport, or NULL to disable clipping. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.1.3.

\sa SDL_GetRenderClipRect \sa SDL_RenderClipEnabled

extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)

Implementation

bool setClipRect([math.Rectangle<double>? rect]) {
  Pointer<SdlRect> rectPointer = nullptr;
  if (rect != null) {
    rectPointer = rect.callocInt();
  }
  var result = sdlSetRenderClipRect(this, rectPointer);
  calloc.free(rectPointer);
  return result;
}