Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adafruit_imageload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Union,
)

from displayio import Bitmap, Palette
from displayio import Bitmap, ColorConverter, Palette

from .displayio_types import BitmapConstructor, PaletteConstructor
except ImportError:
Expand All @@ -39,7 +39,7 @@ def load(
*,
bitmap: Optional[BitmapConstructor] = None,
palette: Optional[PaletteConstructor] = None,
) -> Tuple[Bitmap, Optional[Palette]]:
) -> Tuple[Bitmap, Optional[Union[Palette, ColorConverter]]]:
"""Load pixel values (indices or colors) into a bitmap and colors into a palette.

bitmap is the desired type. It must take width, height and color_depth in the constructor. It
Expand Down
9 changes: 5 additions & 4 deletions adafruit_imageload/bmp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

try:
from io import BufferedReader
from typing import List, Optional, Set, Tuple
from typing import List, Optional, Set, Tuple, Union

from displayio import Bitmap, Palette
from displayio import Bitmap, ColorConverter, Palette

from ..displayio_types import BitmapConstructor, PaletteConstructor
except ImportError:
Expand All @@ -32,10 +32,11 @@ def load(
*,
bitmap: Optional[BitmapConstructor] = None,
palette: Optional[PaletteConstructor] = None,
) -> Tuple[Optional[Bitmap], Optional[Palette]]:
) -> Tuple[Optional[Bitmap], Optional[Union[Palette, ColorConverter]]]:
"""Loads a bmp image from the open ``file``.

Returns tuple of bitmap object and palette object.
Returns tuple of `displayio.Bitmap` object and
`displayio.Palette` object, or `displayio.ColorConverter` object.

:param io.BufferedReader file: Open file handle or compatible (like `io.BytesIO`)
with the data of a BMP file.
Expand Down