pygame2.sdl.rwops

The pygame2.sdl.rwops C API contains objects for accessing SDL_RWops from Python objects.

Note

All Python objects to be used by the pygame2.sdl.rwops API must support binary read and write access. This is especially important for Python 3.x users.

Import

Include headers:

pygame2/pgsdl.h
int import_pygame2_sdl_rwops(void)
Imports the pygame2.sdl.rwops module. This returns 0 on success and -1 on failure.

Functions

SDL_RWops* PyRWops_NewRO(PyObject *obj, int *canautoclose)

Creates a read-only SDL_RWops object from the passed Python object. obj must be some file-like or buffer-like object supporting the binary read, seek, tell and close methods to be fully usable as SDL_RWops. canautoclose indicates, whether the object can be automatically closed by the matching RW function. If not, a manual call to PyRWops_Close() will be required. On failure, this returns NULL.

Note

This function is not suitable for threaded usage.

SDL_RWops* PyRWops_NewRW(PyObject *obj, int *canautoclose)

Creates a read-write SDL_RWops object from the passed Python object. obj must be some file-like or buffer-like object supporting the binary read, seek, tell and close methods to be fully usable as SDL_RWops. canautoclose indicates, whether the object can be automatically closed by the matching RW function. If not, a manual call to PyRWops_Close() will be required. On failure, this returns NULL.

Note

This function is not suitable for threaded usage.

SDL_RWops* PyRWops_NewRO_Threaded(PyObject *obj, int *canautoclose)

Creates a read-only SDL_RWops object from the passed Python object. obj must be some file-like or buffer-like object supporting the binary read, seek, tell and close methods to be fully usable as SDL_RWops. canautoclose indicates, whether the object can be automatically closed by the matching RW function. If not, a manual call to PyRWops_Close() will be required. On failure, this returns NULL.

Note

If Python was built without thread support, this will default to PyRWops_NewRO().

SDL_RWops* PyRWops_NewRW_Threaded(PyObject *obj, int *canautoclose)

Creates a read-write SDL_RWops object from the passed Python object. obj must be some file-like or buffer-like object supporting the binary read, seek, tell and close methods to be fully usable as SDL_RWops. canautoclose indicates, whether the object can be automatically closed by the matching RW function. If not, a manual call to PyRWops_Close() will be required. On failure, this returns NULL.

Note

If Python was built without thread support, this will default to PyRWops_NewRO().

void PyRWops_Close(SDL_RWops *rw, int autoclose)
Closes a SDL_RWops object. if autoclose is not 0, the bound data source will be closed, too (if it is a Python object). Otherwise it will be kept open.

Table Of Contents

Previous topic

pygame2.sdl.video

Next topic

pygame2.sdlext.base

This Page