Skip to content

Transparency setting for shape fill color cannot be dynamically changed after initialization #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DavePutz opened this issue Oct 30, 2019 · 1 comment

Comments

@DavePutz
Copy link

DavePutz commented Oct 30, 2019

This is a dup of issue #2076 in core (adafruit/circuitpython#2076) but the issue looks to be in the fill() routines for the various objects (rect, roundrect, and triangle).
An example program showing the issue:

import board
import displayio
import time
from adafruit_display_shapes.rect import Rect
from adafruit_display_shapes.circle import Circle
from adafruit_display_shapes.roundrect import RoundRect
from adafruit_display_shapes.triangle import Triangle

# Make the display context
splash = displayio.Group(max_size=10)
board.DISPLAY.show(splash)

# Make a background color fill
color_bitmap = displayio.Bitmap(320, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x333333
bg_sprite = displayio.TileGrid(color_bitmap, x=0, y=0,
pixel_shader=color_palette)
splash.append(bg_sprite)
##########################################################################

triangle = Triangle(170, 50, 120, 140, 210, 160, fill=0x00FF00, outline=0xFF00FF)
splash.append(triangle)

rect = Rect(80, 20, 41, 41, fill=0xFF0000)
splash.append(rect)

circle = Circle(100, 100, 20, fill=0x00FF00, outline=0xFF00FF)
splash.append(circle)

rect2 = Rect(50, 100, 61, 81, fill=None, outline=0x0, stroke=3)
splash.append(rect2)

roundrect = RoundRect(10, 10, 61, 81, 10, fill=0x00FFFF, outline=0xFF00FF, stroke=6)
splash.append(roundrect)

print("initial")
time.sleep(5)
while True:
print("first colors")
triangle.fill = 0xff0000
time.sleep(1)
rect.fill = 0x0000ff
time.sleep(1)
rect2.fill = 0x00FFff
time.sleep(1)
circle.fill = 0x789ABC
time.sleep(1)
roundrect.fill = 0xFFFFFF
time.sleep(5)
print("transparents")
triangle.fill = None
time.sleep(1)
rect.fill = None
time.sleep(1)
rect2.fill = 0xFF00FF
time.sleep(1)
roundrect.fill = None
time.sleep(1)
circle.fill = None
time.sleep(5)
print("second colors")
triangle.fill = 0x0000FF
time.sleep(1)
rect.fill = 0xFF0000
time.sleep(1)
rect2.fill = None
time.sleep(1)
circle.fill = 0x654321
time.sleep(1)
roundrect.fill = 0xFFFF00
time.sleep(5)

@makermelissa
Copy link
Collaborator

Fixed via #8

makermelissa pushed a commit that referenced this issue Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants