luma.core.image_composition
Composes scrollable, positionable images into another Image
New in version 1.1.0.
- class luma.core.image_composition.ComposableImage(image, position=(0, 0), offset=(0, 0))[source]
Bases:
object
This class encapsulates an image and its attributes that can be rendered onto an
ImageComposition
.- property height
- Returns:
The actual height of the image, regardless its position or offset within the image composition.
- Return type:
- image(size)[source]
- Parameters:
size (tuple) – The width, height of the image composition.
- Returns:
An image, cropped to the boundaries specified by
size
.- Return type:
- property offset
Getter for offset.
- Returns:
A tuple containing the top,left position.
- Return type:
- property position
Getter for position
- Returns:
A tuple containing the
x,y
position.- Return type:
- class luma.core.image_composition.ImageComposition(device)[source]
Bases:
object
Manages a composition of
ComposableImage
instances that can be rendered onto a singlePIL.Image.Image
.- add_image(image)[source]
Adds an image to the composition.
- Parameters:
image (PIL.Image.Image) – The image to add.
- refresh()[source]
Clears the composition and renders all the images taking into account their position and offset.
- remove_image(image)[source]
Removes an image from the composition.
- Parameters:
image (PIL.Image.Image) – The image to be removed.