Skip to content

Commit e743453

Browse files
committed
Added new example. Requires fixed version of adafruit_framebuf
1 parent 2e11cac commit e743453

File tree

6 files changed

+43
-2
lines changed

6 files changed

+43
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ repos:
1717
- id: check-yaml
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
20+
exclude: \.png$

examples/blinka_16x16.png

3.1 KB
Loading

examples/blinka_16x16.png.license

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
Be sure to check the learn guides for more usage information.
5+
6+
This example is for use on (Linux) computers that are using CPython with
7+
Adafruit Blinka to support CircuitPython libraries. CircuitPython does
8+
not support PIL/pillow (python imaging library)!
9+
10+
Author(s): Melissa LeBlanc-Williams for Adafruit Industries
11+
"""
12+
import board
13+
import neopixel
14+
from adafruit_pixel_framebuf import PixelFramebuffer
15+
from PIL import Image
16+
17+
pixel_pin = board.D18
18+
pixel_width = 16
19+
pixel_height = 16
20+
21+
pixels = neopixel.NeoPixel(
22+
pixel_pin, pixel_width * pixel_height, brightness=0.1, auto_write=False,
23+
)
24+
25+
pixel_framebuf = PixelFramebuffer(pixels, pixel_width, pixel_height, reverse_x=True,)
26+
27+
# Make a black background in RGBA Mode
28+
image = Image.new("RGBA", (pixel_width, pixel_height))
29+
30+
# Open the icon
31+
icon = Image.open("blinka_16x16.png")
32+
33+
# Alpha blend the icon onto the background
34+
image.alpha_composite(icon)
35+
36+
# Convert the image to RGB and display it
37+
pixel_framebuf.image(image.convert("RGB"))
38+
pixel_framebuf.display()

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# SPDX-License-Identifier: MIT
55

66
Adafruit-Blinka
7-
adafruit-circuitpython-framebuf
7+
adafruit-circuitpython-framebuf>=1.4.2
88
adafruit-circuitpython-led-animation

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
author_email="circuitpython@adafruit.com",
3737
install_requires=[
3838
"Adafruit-Blinka",
39-
"adafruit-circuitpython-framebuf",
39+
"adafruit-circuitpython-framebuf>=1.4.2",
4040
"adafruit-circuitpython-led-animation",
4141
],
4242
# Choose your license

0 commit comments

Comments
 (0)