yapocis.lib.graphics
¶
Low level wrappers around the OpenCL graphics kernels.
Module Contents¶
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
Compute the information for compositing a set of distinct blocks |
|
Compute the information for compositing a set of reusable blocks, for graphical or repeated elements. |
|
|
|
|
|
|
|
|
|
|
|
Composite blocks of pixels into target image |
|
Composite sprites into target image |
|
|
|
-
yapocis.lib.graphics.
arrayify2d
(scalar_or_vector, length, width, default=None, dtype=np.float32)[source]¶
-
yapocis.lib.graphics.
coerce_colors
(coords, color=None, colors=None, alpha=None, alphas=None, **kwargs) → numpy.ndarray[source]¶
-
yapocis.lib.graphics.
composite_setup
(locations, blocks, alpha=None, alphas=None)[source]¶ Compute the information for compositing a set of distinct blocks
- Parameters
coords – list of tuples composed of a location (x,y)
blocks – list of pixel blocks, one per element of coords
alpha – list of scalar or vector of opacity
- Returns
list of tuples (x,y,block_width,block_height) buffer: float32 array of intensity and opacity per point (2xN) ipixels: index of start of block in buffer
- Return type
coords
-
yapocis.lib.graphics.
sprites_setup
(locations, sprites, alpha=None, alphas=None)[source]¶ Compute the information for compositing a set of reusable blocks, for graphical or repeated elements.
- Parameters
coords – list of tuples composed of a location (isprite, x,y) where isprite is the index into sprites
sprites – list of pixel blocks, one per element of coords
alpha – list of scalar or vector of opacity
- Returns
list of tuples (x,y,block_width,block_height) buffer: float32 array of intensity and opacity per point (2xN) ipixels: index of start of block in buffer
- Return type
coords
-
yapocis.lib.graphics.
composite
(image, locations, blocks, **kwargs)[source]¶ Composite blocks of pixels into target image
- Parameters
image – 2d array of pixels
coords – a tuple composed of a location (x,y)
blocks – list of pixel blocks
alpha – list of scalar or vector of opacity
Returns: None
-
yapocis.lib.graphics.
sprites
(image, locations, sprites, alpha=None, alphas=None)[source]¶ Composite sprites into target image
- Parameters
image – 2d array of pixels
coords – a tuple composed of a location (sprite_index, x,y)
blocks – list of sprites blocks
alpha – optional list of scalar or vector of opacity
Returns: None