sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Bindgen.Rect.FunPtr

Synopsis

Documentation

sDL_RectToFRect :: FunPtr (PtrConst SDL_Rect -> Ptr SDL_FRect -> IO ()) Source #

Convert an SDL_Rect to SDL_FRect

rect
a pointer to an SDL_Rect.
frect
a pointer filled in with the floating point representation of rect.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_RectToFRect, defined at SDL3/SDL_rect.h 129:23

Since: 3.2.0

sDL_PointInRect :: FunPtr (PtrConst SDL_Point -> PtrConst SDL_Rect -> IO CBool) Source #

Determine whether a point resides inside a rectangle.

A point is considered part of a rectangle if both p and r are not NULL, and p 's x and y coordinates are >= to the rectangle's top left corner, and < the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0) as "inside" and (0,1) as not.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

p
the point to test.
r
the rectangle to test.
Returns
true if p is contained by r, false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_PointInRect, defined at SDL3/SDL_rect.h 158:23

Since: 3.2.0

sDL_RectEmpty :: FunPtr (PtrConst SDL_Rect -> IO CBool) Source #

Determine whether a rectangle has no area.

A rectangle is considered "empty" for this function if r is NULL, or if r 's width and/or height are <= 0.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

r
the rectangle to test.
Returns
true if the rectangle is "empty", false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_RectEmpty, defined at SDL3/SDL_rect.h 182:23

Since: 3.2.0

sDL_RectsEqual :: FunPtr (PtrConst SDL_Rect -> PtrConst SDL_Rect -> IO CBool) Source #

Determine whether two rectangles are equal.

Rectangles are considered equal if both are not NULL and each of their x, y, width and height match.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

a
the first rectangle to test.
b
the second rectangle to test.
Returns
true if the rectangles are equal, false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_RectsEqual, defined at SDL3/SDL_rect.h 206:23

Since: 3.2.0

sDL_HasRectIntersection :: FunPtr (PtrConst SDL_Rect -> PtrConst SDL_Rect -> IO CBool) Source #

Determine whether two rectangles intersect.

If either pointer is NULL the function will return false.

A
an SDL_Rect structure representing the first rectangle.
B
an SDL_Rect structure representing the second rectangle.
Returns
true if there is an intersection, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_GetRectIntersection
C declaration
SDL_HasRectIntersection, defined at SDL3/SDL_rect.h 227:34

Since: 3.2.0

sDL_GetRectIntersection :: FunPtr (PtrConst SDL_Rect -> PtrConst SDL_Rect -> Ptr SDL_Rect -> IO CBool) Source #

Calculate the intersection of two rectangles.

If result is NULL then this function will return false.

A
an SDL_Rect structure representing the first rectangle.
B
an SDL_Rect structure representing the second rectangle.
result
an SDL_Rect structure filled in with the intersection of rectangles A and B.
Returns
true if there is an intersection, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_HasRectIntersection
C declaration
SDL_GetRectIntersection, defined at SDL3/SDL_rect.h 246:34

Since: 3.2.0

sDL_GetRectUnion :: FunPtr (PtrConst SDL_Rect -> PtrConst SDL_Rect -> Ptr SDL_Rect -> IO CBool) Source #

Calculate the union of two rectangles.

A
an SDL_Rect structure representing the first rectangle.
B
an SDL_Rect structure representing the second rectangle.
result
an SDL_Rect structure filled in with the union of rectangles A and B.
Returns
true on success or false on failure; call SDL_GetError() for more information.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_GetRectUnion, defined at SDL3/SDL_rect.h 262:34

Since: 3.2.0

sDL_GetRectEnclosingPoints :: FunPtr (PtrConst SDL_Point -> CInt -> PtrConst SDL_Rect -> Ptr SDL_Rect -> IO CBool) Source #

Calculate a minimal rectangle enclosing a set of points.

If clip is not NULL then only points inside of the clipping rectangle are considered.

points
an array of SDL_Point structures representing points to be enclosed.
count
the number of structures in the points array.
clip
an SDL_Rect used for clipping or NULL to enclose all points.
result
an SDL_Rect structure filled in with the minimal enclosing rectangle.
Returns
true if any points were enclosed or false if all the points were outside of the clipping rectangle.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_GetRectEnclosingPoints, defined at SDL3/SDL_rect.h 283:34

Since: 3.2.0

sDL_GetRectAndLineIntersection :: FunPtr (PtrConst SDL_Rect -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO CBool) Source #

Calculate the intersection of a rectangle and line segment.

This function is used to clip a line segment to a rectangle. A line segment contained entirely within the rectangle or that does not intersect will remain unchanged. A line segment that crosses the rectangle at either or both ends will be clipped to the boundary of the rectangle and the new coordinates saved in X1, Y1, X2, and/or Y2 as necessary.

rect
an SDL_Rect structure representing the rectangle to intersect.
X1
a pointer to the starting X-coordinate of the line.
Y1
a pointer to the starting Y-coordinate of the line.
X2
a pointer to the ending X-coordinate of the line.
Y2
a pointer to the ending Y-coordinate of the line.
Returns
true if there is an intersection, false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_GetRectAndLineIntersection, defined at SDL3/SDL_rect.h 305:34

Since: 3.2.0

sDL_PointInRectFloat :: FunPtr (PtrConst SDL_FPoint -> PtrConst SDL_FRect -> IO CBool) Source #

Determine whether a point resides inside a floating point rectangle.

A point is considered part of a rectangle if both p and r are not NULL, and p 's x and y coordinates are >= to the rectangle's top left corner, and <= the rectangle's x+w and y+h. So a 1x1 rectangle considers point (0,0) and (0,1) as "inside" and (0,2) as not.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

p
the point to test.
r
the rectangle to test.
Returns
true if p is contained by r, false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_PointInRectFloat, defined at SDL3/SDL_rect.h 331:23

Since: 3.2.0

sDL_RectEmptyFloat :: FunPtr (PtrConst SDL_FRect -> IO CBool) Source #

Determine whether a floating point rectangle takes no space.

A rectangle is considered "empty" for this function if r is NULL, or if r 's width and/or height are < 0.0f.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

r
the rectangle to test.
Returns
true if the rectangle is "empty", false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_RectEmptyFloat, defined at SDL3/SDL_rect.h 355:23

Since: 3.2.0

sDL_RectsEqualEpsilon :: FunPtr (PtrConst SDL_FRect -> PtrConst SDL_FRect -> CFloat -> IO CBool) Source #

Determine whether two floating point rectangles are equal, within some given epsilon.

Rectangles are considered equal if both are not NULL and each of their x, y, width and height are within epsilon of each other. If you don't know what value to use for epsilon, you should call the SDL_RectsEqualFloat function instead.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

a
the first rectangle to test.
b
the second rectangle to test.
epsilon
the epsilon value for comparison.
Returns
true if the rectangles are equal, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_RectsEqualFloat
C declaration
SDL_RectsEqualEpsilon, defined at SDL3/SDL_rect.h 385:23

Since: 3.2.0

sDL_RectsEqualFloat :: FunPtr (PtrConst SDL_FRect -> PtrConst SDL_FRect -> IO CBool) Source #

Determine whether two floating point rectangles are equal, within a default epsilon.

Rectangles are considered equal if both are not NULL and each of their x, y, width and height are within SDL_FLT_EPSILON of each other. This is often a reasonable way to compare two floating point rectangles and deal with the slight precision variations in floating point calculations that tend to pop up.

Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).

a
the first rectangle to test.
b
the second rectangle to test.
Returns
true if the rectangles are equal, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_RectsEqualEpsilon
C declaration
SDL_RectsEqualFloat, defined at SDL3/SDL_rect.h 420:23

Since: 3.2.0

sDL_HasRectIntersectionFloat :: FunPtr (PtrConst SDL_FRect -> PtrConst SDL_FRect -> IO CBool) Source #

Determine whether two rectangles intersect with float precision.

If either pointer is NULL the function will return false.

A
an SDL_FRect structure representing the first rectangle.
B
an SDL_FRect structure representing the second rectangle.
Returns
true if there is an intersection, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_GetRectIntersectionFloat
C declaration
SDL_HasRectIntersectionFloat, defined at SDL3/SDL_rect.h 440:34

Since: 3.2.0

sDL_GetRectIntersectionFloat :: FunPtr (PtrConst SDL_FRect -> PtrConst SDL_FRect -> Ptr SDL_FRect -> IO CBool) Source #

Calculate the intersection of two rectangles with float precision.

If result is NULL then this function will return false.

A
an SDL_FRect structure representing the first rectangle.
B
an SDL_FRect structure representing the second rectangle.
result
an SDL_FRect structure filled in with the intersection of rectangles A and B.
Returns
true if there is an intersection, false otherwise.
Thread safety
It is safe to call this function from any thread.
See also
sDL_HasRectIntersectionFloat
C declaration
SDL_GetRectIntersectionFloat, defined at SDL3/SDL_rect.h 459:34

Since: 3.2.0

sDL_GetRectUnionFloat :: FunPtr (PtrConst SDL_FRect -> PtrConst SDL_FRect -> Ptr SDL_FRect -> IO CBool) Source #

Calculate the union of two rectangles with float precision.

A
an SDL_FRect structure representing the first rectangle.
B
an SDL_FRect structure representing the second rectangle.
result
an SDL_FRect structure filled in with the union of rectangles A and B.
Returns
true on success or false on failure; call SDL_GetError() for more information.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_GetRectUnionFloat, defined at SDL3/SDL_rect.h 475:34

Since: 3.2.0

sDL_GetRectEnclosingPointsFloat :: FunPtr (PtrConst SDL_FPoint -> CInt -> PtrConst SDL_FRect -> Ptr SDL_FRect -> IO CBool) Source #

Calculate a minimal rectangle enclosing a set of points with float precision.

If clip is not NULL then only points inside of the clipping rectangle are considered.

points
an array of SDL_FPoint structures representing points to be enclosed.
count
the number of structures in the points array.
clip
an SDL_FRect used for clipping or NULL to enclose all points.
result
an SDL_FRect structure filled in with the minimal enclosing rectangle.
Returns
true if any points were enclosed or false if all the points were outside of the clipping rectangle.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_GetRectEnclosingPointsFloat, defined at SDL3/SDL_rect.h 497:34

Since: 3.2.0

sDL_GetRectAndLineIntersectionFloat :: FunPtr (PtrConst SDL_FRect -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> IO CBool) Source #

Calculate the intersection of a rectangle and line segment with float precision.

This function is used to clip a line segment to a rectangle. A line segment contained entirely within the rectangle or that does not intersect will remain unchanged. A line segment that crosses the rectangle at either or both ends will be clipped to the boundary of the rectangle and the new coordinates saved in X1, Y1, X2, and/or Y2 as necessary.

rect
an SDL_FRect structure representing the rectangle to intersect.
X1
a pointer to the starting X-coordinate of the line.
Y1
a pointer to the starting Y-coordinate of the line.
X2
a pointer to the ending X-coordinate of the line.
Y2
a pointer to the ending Y-coordinate of the line.
Returns
true if there is an intersection, false otherwise.
Thread safety
It is safe to call this function from any thread.
C declaration
SDL_GetRectAndLineIntersectionFloat, defined at SDL3/SDL_rect.h 520:34

Since: 3.2.0