yapocis.lib.graphics4

Low level wrappers around the OpenCL graphics kernels.

Module Contents

Functions

coerce_coords(coords, width, dtype=np.float32)

arrayify(scalar_or_vector, size)

coerce_colors(coords, colors)

setup_composite(locations, blocks)

Compute the information for compositing a set of distinct blocks

setup_sprites(locations, sprites)

Compute the information for compositing a set of reusable blocks, for graphical or repeated elements.

lines(image, coords, colors, width=1.0)

rects(image, coords, colors)

circles(image, coords, colors)

triangles(image, coords, colors)

ellipses(image, coords, colors)

composite(image, locations, blocks)

Composite blocks of pixels into target image

sprites(image, locations, sprites)

Composite sprites into target image

setup_texts(locations, texts, font=None, fonts=None, size=None, sizes=None, color=None, colors=None, alpha=None, alphas=None, rotation=None, rotations=None)

draw_strings(image, locations, texts, **kwargs)

yapocis.lib.graphics4.coerce_coords(coords, width, dtype=np.float32)[source]
yapocis.lib.graphics4.arrayify(scalar_or_vector, size)[source]
yapocis.lib.graphics4.coerce_colors(coords, colors)[source]
yapocis.lib.graphics4.setup_composite(locations, blocks)[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

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.graphics4.setup_sprites(locations, sprites)[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.graphics4.lines(image, coords, colors, width=1.0)[source]
yapocis.lib.graphics4.rects(image, coords, colors)[source]
yapocis.lib.graphics4.circles(image, coords, colors)[source]
yapocis.lib.graphics4.triangles(image, coords, colors)[source]
yapocis.lib.graphics4.ellipses(image, coords, colors)[source]
yapocis.lib.graphics4.composite(image, locations, blocks)[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.graphics4.sprites(image, locations, sprites)[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

Returns: None

yapocis.lib.graphics4.setup_texts(locations, texts, font=None, fonts=None, size=None, sizes=None, color=None, colors=None, alpha=None, alphas=None, rotation=None, rotations=None)[source]
yapocis.lib.graphics4.draw_strings(image, locations, texts, **kwargs)[source]