from array2d import array2d
from vmath import color32, vec2i

class Image:
    @property
    def width(self) -> int: ...
    @property
    def height(self) -> int: ...

    def __new__(cls, width: int, height: int) -> "Image": ...

    @staticmethod
    def from_bytes(data: bytes) -> "Image": ...
    @staticmethod
    def from_file(path: str) -> "Image": ...

    def setpixel(self, x: int, y: int, color: color32) -> None: ...
    def getpixel(self, x: int, y: int) -> color32: ...
    def clear(self, color: color32) -> None: ...

    def paste(self, src_img: "Image", src_pos: vec2i, dst_pos: vec2i, width: int, height: int, fg: color32, bg: color32) -> None: ...

    def to_png_bytes(self) -> bytes: ...
    def to_png_file(self, path: str) -> int: ...
    def to_rgb565_file(self, path: str) -> int: ...


def loads(data: bytes) -> array2d[color32]: ...
def dumps(image: array2d[color32]) -> bytes: ...
