Closed
Description
The image
method currently only allows to redraw the whole screen.
def image(self, img, rotation=None):
...
imwidth, imheight = img.size
if imwidth != self.width or imheight != self.height:
raise ValueError(...
...
self._block(0, 0, self.width-1, self.height - 1, pixels)
Especially on lower end boards it seems advantageous to be able to draw smaller images in part of the screen only without having to refresh the whole screen.
I would like to suggest to add two new arguments to the method for specifying the origin
def draw(self, image, x0=0, y0=0):
to drop the if imwidth != self.width or imheight != self.height:
check and to adapt the call to _block
so that the image's size is passed in instead of the screen size.
self.display._block(x0, y0, x0 + imwidth - 1, y0 + imheight - 1, pixels)
Instead of removing the size check, one could also replace it with a check to ensure that the image is not bigger than the screen size.
Happy to submit a pull request if this makes sense.
Metadata
Metadata
Assignees
Labels
No labels