Skip to content

Commit 82d2335

Browse files
committed
Allow setting X & Y offsets for the direct bitmap blit
this is useful for apps that don't have the top/bottom area reserved
1 parent 512efd8 commit 82d2335

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

adafruit_pycamera/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ def continuous_capture(self):
751751
or the camera's capture mode is changed"""
752752
return self.camera.take(1)
753753

754-
def blit(self, bitmap):
754+
def blit(self, bitmap, x_offset=0, y_offset=32):
755755
"""Display a bitmap direct to the LCD, bypassing displayio
756756
757757
This can be more efficient than displaying a bitmap as a displayio
@@ -762,8 +762,12 @@ def blit(self, bitmap):
762762
for status information.
763763
"""
764764

765-
self._display_bus.send(42, struct.pack(">hh", 80, 80 + bitmap.width - 1))
766-
self._display_bus.send(43, struct.pack(">hh", 32, 32 + bitmap.height - 1))
765+
self._display_bus.send(
766+
42, struct.pack(">hh", 80 + x_offset, 80 + x_offset + bitmap.width - 1)
767+
)
768+
self._display_bus.send(
769+
43, struct.pack(">hh", y_offset, y_offset + bitmap.height - 1)
770+
)
767771
self._display_bus.send(44, bitmap)
768772

769773
@property

0 commit comments

Comments
 (0)