Skip to content

Add support for hidden vectorio shapes #6204

@FoamyGuy

Description

@FoamyGuy

vectorio shapes do not currently support being hidden by the group that contains them.

This sample code illustrates the issue:

import time
import displayio
import terminalio
import vectorio
from adafruit_display_text.bitmap_label import Label
import board

display = board.DISPLAY

main_group = displayio.Group()

palette = displayio.Palette(1)
palette[0] = 0x125690

circle = vectorio.Circle(pixel_shader=palette, radius=25, x=70, y=40)
main_group.append(circle)

rectangle = vectorio.Rectangle(pixel_shader=palette, width=40, height=30, x=105, y=45)
main_group.append(rectangle)

lbl = Label(terminalio.FONT, scale=3, text="Hello Shapes!", anchor_point=(0,0), anchored_position=(100, 100))

main_group.append(lbl)

display.show(main_group)

while True:
    main_group.hidden = not main_group.hidden
    time.sleep(1)

When this code runs the vectorio shapes remain visible, while the label that is in the same groups blinks visible and hidden as the loop runs:

vectorio_hidden.mp4

I intend to work on a solution for this, creating the issue here to get it documented somewhere and see if anyone else has ideas or input about it.

If I am understanding correctly TileGrid and Group have code like this which allows them to handle the case where they get hidden by their containing Group:

bool hidden = self->hidden || self->hidden_by_parent;
if (hidden) {
return false;
}

I believe similar functionality could be implemented for vectorio shapes, maybe somewhere in this function:

bool vectorio_vector_shape_fill_area(vectorio_vector_shape_t *self, const _displayio_colorspace_t *colorspace, const displayio_area_t *area, uint32_t *mask, uint32_t *buffer) {

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions