pygame2.mask

The pygame2.mask C API contains some objects and functions for bitmask operations.

Import

Include headers:

pygame2/pgmask.h
int import_pygame2_mask(void)
Imports the pygame2.mask module. This returns 0 on success and -1 on failure.

Basic Types

bitmask_t

A simple 2D bitmask structure.

int bitmask_t.w
The width of the bitmask_t.
int bitmask_t.h
The height of the bitmask_t.
unsigned long int bitmask_t.bits
The bits of the bitmask_t.

PyMask

PyMask
PyMask_Type

The PyMask object is suitable for fast pixel-perfect overlapping checks.

Members

bitmask_t PyMask.mask
The underlying 2D bitmask_t structure.

Functions

int PyMask_Check(PyObject *obj)
Returns true, if the argument is a PyMask or a subclass of PyMask.
bitmask_t* PyMask_AsBitmask(PyObject *obj)

Macro for accessing the mask member of the PyMask.

This does not perform any type or argument checks.

PyObject* PyMask_New(int width, int height)
Creates a new PyMask object for the given width and height. On failure, this returns NULL.

Table Of Contents

Previous topic

pygame2.freetype

Next topic

pygame2.sdl.base

This Page