src_c/rect.c¶
This extension module defines Python type pygame.Rect
pygame object for storing rectangular coordinates & pygame.FRect
.
Header file: src_c/include/pygame.h
-
PyTypeObject *pgRect_Type¶
The Pygame rectangle object type pygame.Rect.
-
PyTypeObject *pgFRect_Type¶
The Pygame rectangle object type pygame.FRect.
-
SDL_Rect pgRect_AsRect(PyObject *obj)¶
A macro to access the SDL_Rect field of a
pygame.Rect
instance.
-
SDL_FRect pgFRect_AsRect(PyObject *obj)¶
A macro to access the SDL_FRect field of a
pygame.FRect
instance.
-
PyObject *pgRect_New(SDL_Rect *r)¶
Return a new
pygame.Rect
instance from the SDL_Rect r. On failure, raise a Python exception and return NULL.
-
PyObject *pgFRect_New(SDL_FRect *r)¶
Return a new
pygame.FRect
instance from the SDL_FRect r. On failure, raise a Python exception and return NULL.
-
PyObject *pgRect_New4(int x, int y, int w, int h)¶
Return a new pygame.Rect instance with position (x, y) and size (w, h). On failure raise a Python exception and return NULL.
-
PyObject *pgFRect_New4(float x, float y, float w, float h)¶
Return a new pygame.FRect instance with position (x, y) and size (w, h). On failure raise a Python exception and return NULL.
-
SDL_Rect *pgRect_FromObject(PyObject *obj, SDL_Rect *temp)¶
Translate a Python rectangle representation as a Pygame
SDL_Rect
. A rectangle can be a length 4 sequence integers (x, y, w, h), or a length 2 sequence of position (x, y) and size (w, h), or a length 1 tuple containing a rectangle representation, or have a method rect that returns a rectangle. Pass a pointer to a locally declaredSDL_Rect
as temp. Do not rely on this being filled in; use the function's return value instead. On success, return a pointer to aSDL_Rect
representation of the rectangle, else return NULL. No Python exceptions are raised.
-
SDL_FRect *pgFRect_FromObject(PyObject *obj, SDL_FRect *temp)¶
Translate a Python rectangle representation as a Pygame
SDL_FRect
. A rectangle can be a length 4 sequence floats (x, y, w, h), or a length 2 sequence of position (x, y) and size (w, h), or a length 1 tuple containing a rectangle representation, or have a method rect that returns a rectangle. Pass a pointer to a locally declaredSDL_FRect
as temp. Do not rely on this being filled in; use the function's return value instead. On success, return a pointer to aSDL_FRect
representation of the rectangle, else return NULL. No Python exceptions are raised.
-
void pgRect_Normalize(SDL_Rect *rect)¶
Normalize the given rect. A rect with a negative size (negative width and/or height) will be adjusted to have a positive size.
-
void pgFRect_Normalize(SDL_FRect *rect)¶
Normalize the given rect. A rect with a negative size (negative width and/or height) will be adjusted to have a positive size.
Edit on GitHub