luma.core.mixin
- class luma.core.mixin.capabilities[source]
Bases:
object
This class should be ‘mixed-in’ to any
luma.core.device.device
display implementation that should have “device-like” capabilities.- capabilities(width, height, rotate, mode='1')[source]
Assigns attributes such as
width
,height
,size
andbounding_box
correctly oriented from the supplied parameters.- Parameters:
width (int) – The device width.
height (int) – The device height.
rotate (int) – An integer value of 0 (default), 1, 2 or 3 only, where 0 is no rotation, 1 is rotate 90° clockwise, 2 is 180° rotation and 3 represents 270° rotation.
mode (str) – The supported color model, one of
"1"
,"RGB"
or"RGBA"
only.
- display(image)[source]
Should be overridden in sub-classed implementations.
- Parameters:
image (PIL.Image.Image) – An image to display.
- Raises:
- preprocess(image)[source]
Provides a preprocessing facility (which may be overridden) whereby the supplied image is rotated according to the device’s rotate capability. If this method is overridden, it is important to call the
super
method.- Parameters:
image (PIL.Image.Image) – An image to pre-process.
- Returns:
A new processed image.
- Return type: