Skip to content

Commit 790e890

Browse files
committed
Use a test pattern for mix filter, not blinka
1 parent 1365a06 commit 790e890

4 files changed

Lines changed: 242 additions & 159 deletions

File tree

tests/circuitpython/bitmapfilter_mix.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
import bitmapfilter
33
import ulab
44
from dump_bitmap import dump_bitmap_rgb_swapped
5-
from blinka_image import decode_blinka
5+
from blinka_image import decode_resource
6+
7+
8+
def test_pattern():
9+
return decode_resource("testpattern", 2)
610

711

812
def make_quadrant_bitmap():
@@ -14,7 +18,7 @@ def make_quadrant_bitmap():
1418

1519

1620
q = make_quadrant_bitmap()
17-
b = decode_blinka(3)
21+
b = test_pattern()
1822
dump_bitmap_rgb_swapped(b)
1923

2024
sepia_weights = [0.393, 0.769, 0.189, 0.349, 0.686, 0.168, 0.272, 0.534, 0.131]
@@ -25,18 +29,24 @@ def make_quadrant_bitmap():
2529

2630
# Red channel only
2731
print("red channel only (note: masked)")
28-
b = decode_blinka(3)
32+
b = test_pattern()
2933
bitmapfilter.mix(b, [1, 0, 0], mask=q)
3034
dump_bitmap_rgb_swapped(b)
3135

3236
# Scale green channel
3337
print("scale green channel (note: masked)")
34-
b = decode_blinka(3)
38+
b = test_pattern()
3539
bitmapfilter.mix(b, [1, 2, 0], mask=q)
3640
dump_bitmap_rgb_swapped(b)
3741

38-
# Swap R & G channels, invert B channel
39-
print("swap R&G, invert B")
40-
b = decode_blinka(3)
41-
bitmapfilter.mix(b, [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, 1])
42+
# Swap R & G channels
43+
print("swap R&G")
44+
b = test_pattern()
45+
bitmapfilter.mix(b, [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0])
46+
dump_bitmap_rgb_swapped(b)
47+
48+
# invert B
49+
print("invert B")
50+
b = test_pattern()
51+
bitmapfilter.mix(b, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 1])
4252
dump_bitmap_rgb_swapped(b)

0 commit comments

Comments
 (0)