SDL 2.0
|
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_pixels.h"
#include "SDL_rwops.h"
#include "begin_code.h"
#include "close_code.h"
Go to the source code of this file.
Data Structures | |
struct | SDL_Point |
struct | SDL_FPoint |
struct | SDL_Rect |
struct | SDL_FRect |
Header file for SDL_rect definition and management functions.
Definition in file SDL_rect.h.
|
extern |
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 |
|
extern |
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 |
SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty | ( | const SDL_FRect * | r | ) |
Returns true if the rectangle has no area.
Definition at line 242 of file SDL_rect.h.
References SDL_FRect::h, SDL_FALSE, SDL_TRUE, and SDL_FRect::w.
SDL_FORCE_INLINE SDL_bool SDL_FRectEquals | ( | const SDL_FRect * | a, |
const SDL_FRect * | b | ||
) |
Returns true if the two rectangles are equal, using a default epsilon.
Definition at line 267 of file SDL_rect.h.
References SDL_FLT_EPSILON, and SDL_FRectEqualsEpsilon().
SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon | ( | const SDL_FRect * | a, |
const SDL_FRect * | b, | ||
const float | epsilon | ||
) |
Returns true if the two rectangles are equal, within some given epsilon.
Definition at line 252 of file SDL_rect.h.
References SDL_FRect::h, SDL_fabsf(), SDL_FALSE, SDL_TRUE, SDL_FRect::w, SDL_FRect::x, and SDL_FRect::y.
Referenced by SDL_FRectEquals().
Determine whether two rectangles intersect.
If either pointer is NULL the function will return SDL_FALSE.
A | an SDL_Rect structure representing the first rectangle |
B | an SDL_Rect structure representing the second rectangle |
Determine whether two rectangles intersect with float precision.
If either pointer is NULL the function will return SDL_FALSE.
A | an SDL_FRect structure representing the first rectangle |
B | an SDL_FRect structure representing the second rectangle |
Calculate the intersection of two rectangles with float precision.
If result
is NULL then this function will return SDL_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 |
|
extern |
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 |
Calculate the intersection of two rectangles.
If result
is NULL then this function will return SDL_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 |
|
extern |
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 |
SDL_FORCE_INLINE SDL_bool SDL_PointInFRect | ( | const SDL_FPoint * | p, |
const SDL_FRect * | r | ||
) |
Returns true if point resides inside a rectangle.
Definition at line 233 of file SDL_rect.h.
References SDL_FRect::h, SDL_FALSE, SDL_TRUE, SDL_FRect::w, SDL_FPoint::x, SDL_FRect::x, SDL_FPoint::y, and SDL_FRect::y.
SDL_FORCE_INLINE SDL_bool SDL_PointInRect | ( | const SDL_Point * | p, |
const SDL_Rect * | r | ||
) |
Returns true if point resides inside a rectangle.
Definition at line 110 of file SDL_rect.h.
References SDL_Rect::h, SDL_FALSE, SDL_TRUE, SDL_Rect::w, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty | ( | const SDL_Rect * | r | ) |
Returns true if the rectangle has no area.
Definition at line 119 of file SDL_rect.h.
References SDL_Rect::h, SDL_FALSE, SDL_TRUE, and SDL_Rect::w.
SDL_FORCE_INLINE SDL_bool SDL_RectEquals | ( | const SDL_Rect * | a, |
const SDL_Rect * | b | ||
) |
Returns true if the two rectangles are equal.
Definition at line 127 of file SDL_rect.h.
References SDL_Rect::h, SDL_FALSE, SDL_TRUE, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
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 |