From c8595325daf4b3c4cea372dbe24bdfaf9590fe5f Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 24 Apr 2023 22:03:37 -0500 Subject: [PATCH] pil additions --- circuitpython_typing/pil.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/circuitpython_typing/pil.py b/circuitpython_typing/pil.py index 7a70aea..9dc8a5d 100644 --- a/circuitpython_typing/pil.py +++ b/circuitpython_typing/pil.py @@ -11,7 +11,7 @@ * Author(s): Alec Delaney """ -from typing import Tuple +from typing import Tuple, Optional, Callable from typing_extensions import Protocol # Safety import for Python 3.7 @@ -26,6 +26,7 @@ def __getitem__(self, xy: Tuple[int, int]) -> int: class Image(Protocol): """Type annotation for PIL's Image class""" + # pylint: disable=too-many-arguments,invalid-name @property def mode(self) -> str: """The mode of the image""" @@ -36,3 +37,27 @@ def size(self) -> Tuple[int, int]: def load(self) -> PixelAccess: """Load the image for quick pixel access""" + + def convert( + self, + mode: str, + matrix: Optional[Tuple], + dither: Callable, + palette: int, + colors: int, + ): + """Returns a converted copy of this image.""" + + def rotate( + self, + angle: int, + resampling, + expand: int, + center: Tuple[int, int], + translate: Tuple[int, int], + fillcolor: int, + ): + """Returns a rotated copy of this image.""" + + def getpixel(self, xy: Tuple[int, int]): + """Returns the pixel value at a given position."""