pygame2.sdl.video
The pygame2.sdl.video C API contains fundamental objects and functions
for accessing and manipulating the screen display, image surface objects and
overlay graphics.
Import
Include headers:
-
int import_pygame2_sdl_video(void)
- Imports the pygame2.sdl.video module. This returns 0 on success
and -1 on failure.
Macros
-
ASSERT_VIDEO_INIT(retval)
- Checks, whether the video subsystem was properly initialised. If not,
this will set a PyExc_PyGameError and return retval.
-
ASSERT_VIDEO_SURFACE_SET(retval)
- Checks, whether a display surface was created already using
pygame2.sdl.video.set_mode(). If not, this will set a
PyExc_PyGameError and return retval.
Functions
-
int ColorFromObj(PyObject *obj, SDL_PixelFormat *format, Uint32 *val)
- Converts the passed object to a 32-bit integer color value and stores the
result in val. This returns 1 on success and 0 on failure.
PySDLSurface
-
PySDLSurface
-
PySDLSurface_Type
The PySDLSurface is the most important object type for the
pygame2.sdl.video module. It is used to hold information about the
2D pixel buffer information of any visible object for the pygame2.sdl
modules.
The PySDLSurface class inherits from the PySurface class of
the pygame2.base module.
Functions
-
SDL_Surface* PySDLSurface_AsSDLSurface(PyObject *obj)
- Macro for accessing the surface member of the PySDLSurface. This
does not perform any type checks.
-
PySurface* PySDLSurface_AsPySurface(PyObject *obj)
- Macro for accessing the pysurface member of the PySDLSurface. This
does not perform any type or argument checks.
-
int PySDLSurface_Check(PyObject *obj)
- Returns true, if the argument is a PySDLSurface or a subclass of
PySDLSurface.
-
PyObject* PySDLSurface_New(int width, int height)
- Creates a new PySDLSurface with the specified width and height.
On failure, this returns NULL.
-
PyObject* PySDLSurface_NewFromSDLSurface(SDL_Surface *surface)
- Creates a new PySDLSurface from an existing SDL_Surface.
The passed surface must not be freed during the lifetime of the
PySDLSurface object. On failure, this returns NULL.
-
PyObject* PySDLSurface_Copy(PyObject *obj)
- Creates an exact copy of the passed PySDLSurface. This creates
a new PySDLSurface and copies the information of obj to it (except
for the locks). On failure, this returns NULL.
-
int PySDLSurface_AddRefLock(PyObject *surface, PyObject *lockobj)
- Adds a lock to the passed PySDLSurface, which will be hold by
lockobj. This will not increase lockobj‘s refcount, but use weak
references instead. If lockobj is garbage-collected any time later,
the lock on the PySDLSurface will be removed automatically on the
next invocation of PySDLSurface_RemoveRefLock(). This returns 1 on
success and 0 on failure.
-
int PySDLSurface_RemoveRefLock(PyObject *surface, PyObject *lockobj)
- Removes a lock from the passed PySDLSurface. lockobj denotes the
object holding the lock. It also removes any other outstanding
garbage-collected lock references. This returns 1 on success and 0 on failure.
-
PyObject* PySDLSurface_AcquireLockObj(PyObject *surface, PyObject *lockobj)
- Acquires a PyCObject that keeps a lock on the passed
PySDLSurface. lockobj denotes the object holding the lock. If
the return value is garbage-collected, the lock on the PySDLSurface
will be removed immediately.
PyOverlay
-
PyOverlay
-
PyOverlay_Type
PyOverlay is a low-level overlay graphics class for PySDLSurface
objects. It support direct operations on the YUV overlay buffers of the
graphics objects.
Functions
-
SDL_Overlay* PyOverlay_AsOverlay(PyObject *obj)
- Macro for accessing the overlay member of the PyOverlay. This
does not perform any type checks.
-
PyObject* PyOverlay_New(PyObject *obj, int width, int height, Uint32 format)
Creates a new PyOverlay for the passed PySDLSurface obj.
width and height specify the width and height of the PyOverlay,
which may or may not exceed the size of the PySDLSurface.
The format argument specifies the YUV overlay type to use.
YV12_OVERLAY |
Planar mode: Y + V + U |
IYUV_OVERLAY |
Planar mode: Y + U + V |
YUY2_OVERLAY |
Packed mode: Y0 + U0 + Y1 + V0 |
UYVY_OVERLAY |
Packed mode: U0 + Y0 + V0 + Y1 |
YVYU_OVERLAY |
Packed mode: Y0 + V0 + Y1 + U0 |
On failure, this returns NULL.
-
int PyOverlay_AddRefLock(PyObject *overlay, PyObject *lockobj)
- Adds a lock to the passed PyOverlay, which will be hold by
lockobj. This will not increase lockobj‘s refcount, but use weak
references instead. If lockobj is garbage-collected any time later, the
lock on the PyOverlay will be removed automatically on the next
invocation of PyOverlay_RemoveRefLock(). This returns 1 on success and
0 on failure.
-
int PyOverlay_RemoveRefLock(PyObject *overlay, PyObject *lockobj)
- Removes a lock from the passed PyOverlay. lockobj denotes the
object holding the lock. It also removes any other outstanding
garbage-collected lock references. This returns 1 on success and 0 on failure.