Skip to content

bitmaptools.boundary_fill() should do background processing #7485

@dhalbert

Description

@dhalbert
          I landed here after having some freeze problems. Just keeping this here for future reference and in case somebody gets to the same point as myself.

When I tried the following modified code, the communication was lost and the editor (MU) and became unresponsive.
I did the same using TIO and Screen command in ubuntu causing disconnection problems. After a while the code will show the expected result, however the communication is lost with the board. This is a little problem, but if people is impatient as I am, the board will get in safe mode very easily :)

import board
import displayio
import bitmaptools

display = board.DISPLAY

bitmap = displayio.Bitmap(display.width, display.height, 3)

palette = displayio.Palette(3)
palette[0] = 0x000000
palette[1] = 0xffffff
palette[2] = 0x0000ff

tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette)
group = displayio.Group()
group.append(tile_grid)
display.show(group)

# Draw a rectangle
for x in range(150, 170):
    bitmap[x, 30] = 1
    bitmap[x, 50] = 1
for y in range(30, 51):
    bitmap[150, y] = 1
    bitmap[170, y] = 1

# Draw a non-rectangle
for i in range(30, 120):
    bitmap[i, i] = 1
    bitmap[i+30, i] = 1

for x in range(0, 30):
    bitmap[x+30, 30] = 1
    bitmap[x+120, 120] = 1

# fill rectangle white
bitmaptools.boundary_fill(bitmap,display.width//2, display.height//2, 1, 0)

# fill non-rectangle blue
bitmaptools.boundary_fill(bitmap,40, 35, 2, 0)

while True:
    pass

RESULTS

  • Screen
home@home:~$ screen /dev/ttyACM0 115200
[screen is terminating]
home@home:~$ 
  • TIO
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit PyPortal Titano with samd51j20
>>> import q
[tio 19:51:52] Disconnected
[tio 19:52:33] Connected
🐍REPL | 8.0.0-beta.6

Tested on Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit PyPortal Titano with samd51j20

Originally posted by @jposada202020 in #5145 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions