zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_rect.h File Reference
#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.

Classes

struct  SDL_Point
 The structure that defines a point. More...
 
struct  SDL_Rect
 A rectangle, with the origin at the upper left. More...
 

Typedefs

typedef struct SDL_Point SDL_Point
 The structure that defines a point. More...
 
typedef struct SDL_Rect SDL_Rect
 A rectangle, with the origin at the upper left. More...
 

Functions

DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints (const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result)
 Calculate a minimal rectangle enclosing a set of points. More...
 
DECLSPEC SDL_bool SDLCALL SDL_HasIntersection (const SDL_Rect *A, const SDL_Rect *B)
 Determine whether two rectangles intersect. More...
 
DECLSPEC SDL_bool SDLCALL SDL_IntersectRect (const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result)
 Calculate the intersection of two rectangles. More...
 
DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine (const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2)
 Calculate the intersection of a rectangle and line segment. More...
 
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty (const SDL_Rect *r)
 Returns true if the rectangle has no area. More...
 
SDL_FORCE_INLINE SDL_bool SDL_RectEquals (const SDL_Rect *a, const SDL_Rect *b)
 Returns true if the two rectangles are equal. More...
 
DECLSPEC void SDLCALL SDL_UnionRect (const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result)
 Calculate the union of two rectangles. More...
 

Detailed Description

Header file for SDL_rect definition and management functions.

Definition in file SDL_rect.h.

Typedef Documentation

typedef struct SDL_Point SDL_Point

The structure that defines a point.

See Also
SDL_EnclosePoints
typedef struct SDL_Rect SDL_Rect

A rectangle, with the origin at the upper left.

See Also
SDL_RectEmpty
SDL_RectEquals
SDL_HasIntersection
SDL_IntersectRect
SDL_UnionRect
SDL_EnclosePoints

Function Documentation

DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints ( const SDL_Point points,
int  count,
const SDL_Rect clip,
SDL_Rect result 
)

Calculate a minimal rectangle enclosing a set of points.

Returns
SDL_TRUE if any points were within the clipping rect

Definition at line 192 of file SDL_rect.c.

References SDL_Rect::h, i, NULL, SDL_FALSE, SDL_InvalidParamError, SDL_RectEmpty(), SDL_TRUE, SDL_Rect::w, SDL_Point::x, SDL_Rect::x, SDL_Point::y, and SDL_Rect::y.

Referenced by SDL_GetWindowDisplayIndex().

DECLSPEC SDL_bool SDLCALL SDL_HasIntersection ( const SDL_Rect A,
const SDL_Rect B 
)

Determine whether two rectangles intersect.

Returns
SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

Definition at line 28 of file SDL_rect.c.

References SDL_Rect::h, SDL_FALSE, SDL_InvalidParamError, SDL_RectEmpty(), SDL_TRUE, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_RenderCopy().

DECLSPEC SDL_bool SDLCALL SDL_IntersectRect ( const SDL_Rect A,
const SDL_Rect B,
SDL_Rect result 
)

Calculate the intersection of two rectangles.

Returns
SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

Definition at line 75 of file SDL_rect.c.

References SDL_Rect::h, SDL_FALSE, SDL_InvalidParamError, SDL_RectEmpty(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_BlendFillRect(), SDL_BlendFillRects(), SDL_FillRect(), SDL_LowerBlitScaled(), SDL_RenderCopy(), SDL_RenderCopyEx(), SDL_RenderReadPixels(), and SDL_SetClipRect().

DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine ( const SDL_Rect rect,
int X1,
int Y1,
int X2,
int Y2 
)

Calculate the intersection of a rectangle and line segment.

Returns
SDL_TRUE if there is an intersection, SDL_FALSE otherwise.

Definition at line 316 of file SDL_rect.c.

References CODE_BOTTOM, CODE_LEFT, CODE_RIGHT, CODE_TOP, ComputeOutCode(), SDL_Rect::h, SDL_FALSE, SDL_InvalidParamError, SDL_RectEmpty(), SDL_TRUE, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_BlendLine(), SDL_BlendLines(), SDL_DrawLine(), and SDL_DrawLines().

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 80 of file SDL_rect.h.

References SDL_Rect::h, SDL_FALSE, SDL_TRUE, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

DECLSPEC void SDLCALL SDL_UnionRect ( const SDL_Rect A,
const SDL_Rect B,
SDL_Rect result 
)

Calculate the union of two rectangles.

Definition at line 129 of file SDL_rect.c.

References SDL_Rect::h, SDL_InvalidParamError, SDL_RectEmpty(), SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.