Skip to content

Commit 46158cf

Browse files
authored
Merge pull request #67 from Neradoc/more-docs
Add png and gif to docs, and note png format restriction
2 parents 1ae6b2c + d2c3d32 commit 46158cf

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

adafruit_imageload/bmp/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def load(
3636
3737
Returns tuple of bitmap object and palette object.
3838
39+
:param io.BufferedReader file: Open file handle or compatible (like `io.BytesIO`)
40+
with the data of a BMP file.
3941
:param object bitmap: Type to store bitmap data. Must have API similar to `displayio.Bitmap`.
4042
Will be skipped if None
4143
:param object palette: Type to store the palette. Must have API similar to

adafruit_imageload/gif.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ def load(
3838
3939
Returns tuple of bitmap object and palette object.
4040
41-
:param BufferedReader file: The *.gif file being loaded
41+
:param io.BufferedReader file: Open file handle or compatible (like `io.BytesIO`)
42+
with the data of a GIF file.
4243
:param object bitmap: Type to store bitmap data. Must have API similar to `displayio.Bitmap`.
43-
Will be skipped if None
4444
:param object palette: Type to store the palette. Must have API similar to
45-
`displayio.Palette`. Will be skipped if None"""
45+
`displayio.Palette`. Will be skipped if None.
46+
"""
4647
header = file.read(6)
4748
if header not in {b"GIF87a", b"GIF89a"}:
4849
raise ValueError("Not a GIF file")

adafruit_imageload/png.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ def load(
3737
) -> Tuple[Bitmap, Optional[Palette]]:
3838
"""
3939
Loads a PNG image from the open ``file``.
40+
Only supports indexed color images.
4041
4142
Returns tuple of bitmap object and palette object.
4243
43-
:param file: The *.png file being loaded
44+
:param io.BufferedReader file: Open file handle or compatible (like `io.BytesIO`)
45+
with the data of a PNG file.
4446
:param object bitmap: Type to store bitmap data. Must have API similar to
4547
`displayio.Bitmap`.
4648
:param object palette: Type to store the palette. Must have API similar to
47-
`displayio.Palette`. Will be skipped if None
49+
`displayio.Palette`. Will be skipped if None.
4850
"""
4951
# pylint: disable=too-many-locals,too-many-branches
5052
header = file.read(8)

docs/api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@
1313
.. automodule:: adafruit_imageload.bmp.indexed
1414
:members:
1515

16+
.. automodule:: adafruit_imageload.gif
17+
:members:
18+
19+
.. automodule:: adafruit_imageload.png
20+
:members:
21+
1622
.. automodule:: adafruit_imageload.tilegrid_inflator
1723
:members:

0 commit comments

Comments
 (0)