Added type hints

This commit is contained in:
Andrew Murray 2025-06-10 19:25:27 +10:00
parent 7ebfb871d0
commit 79b753c87e

View File

@ -141,10 +141,10 @@ class QoiEncoder(ImageFile.PyEncoder):
_previous_pixel: tuple[int, int, int, int] | None = None
_previously_seen_pixels: dict[int, tuple[int, int, int, int]] = {}
def _write_run(self, run):
def _write_run(self, run: int) -> bytes:
return o8(0xC0 | (run - 1)) # QOI_OP_RUN
def _delta(self, left, right):
def _delta(self, left: int, right: int) -> int:
result = (left - right) & 0xFF
if result >= 0x80:
result -= 0x100