-
Notifications
You must be signed in to change notification settings - Fork 18
Changes to shape objects to explicitly set opaque property when changing colors #8
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
Conversation
…ing colors When a shapes color or transparency is being changed the proper transparent or opaque properties need to be changed in case it is going from a transparent to opaque state (or vice-versa). Also, in the roundrect __init__ the chunk needs to be drawn even if the initial fill in None; otherwise there seems to be nothing to change to color of later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor change needed for Travis to pass. Have you tested this or do you have any code for testing this out? Thanks
adafruit_display_shapes/roundrect.py
Outdated
for j in range(r, height - r): # draw the center chunk | ||
self._bitmap[i, j] = 2 | ||
self._helper(r, r, r, color=2, fill=True, | ||
x_offset=width-2*r-1, y_offset=height-2*r-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it failed the checks because a space need to be added to this line.
Hi Melissa,
Thanks for looking at this one. Odd that a space would be missing
since I just cut & pasted
several lines to move the location of the code. Anyway, I fixed it.
The test script that is in the issue to show the problem can also be used
to test that the fix was effective.
There is another script from the submitter for the core issue at
adafruit/circuitpython#2076
Hope this helps,
-Dave
…On Thu, Oct 31, 2019 at 11:10 AM Melissa LeBlanc-Williams < ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Just a minor change needed for Travis to pass. Have you tested this or do
you have any code for testing this out? Thanks
------------------------------
In adafruit_display_shapes/roundrect.py
<#8 (comment)>
:
> @@ -65,16 +55,18 @@ def __init__(self, x, y, width, height, r, *, fill=None, outline=None, stroke=1)
self._palette = displayio.Palette(3)
self._palette.make_transparent(0)
self._bitmap = displayio.Bitmap(width, height, 3)
+ for i in range(0, width): # draw the center chunk
+ for j in range(r, height - r): # draw the center chunk
+ self._bitmap[i, j] = 2
+ self._helper(r, r, r, color=2, fill=True,
+ x_offset=width-2*r-1, y_offset=height-2*r-1)
It looks like it failed the checks because a space need to be added to
this line.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8?email_source=notifications&email_token=AFNJKERYUPQDHURGHBKPR3TQRL7PXA5CNFSM4JHBTW22YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCJ5ECKQ#pullrequestreview-310001962>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNJKETO2DA6DWPX3OS3DA3QRL7PXANCNFSM4JHBTW2Q>
.
|
Ok, awesome. I will test this later today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested before and after changes and I could see the effect. Tested in both CP 4 and 5.
Thanks for adding this! |
Updating https://github.com/adafruit/Adafruit_CircuitPython_SharpMemoryDisplay to 1.1.0 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_SharpMemoryDisplay#8 from makermelissa/master > Merge pull request adafruit/Adafruit_CircuitPython_SharpMemoryDisplay#7 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#8 from DavePutz/master
Thanks for the fix to this issue! I haven't had a chance to test it with the original project where I ran across the problem, but I hope to do that this weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @DavePutz ! One comment about a comment but looks good otherwise. Thanks!
* Adafruit CircuitPython firmware for the supported boards: | ||
https://github.com/adafruit/circuitpython/releases | ||
A slightly modified version of Adafruit_CircuitPython_Display_Shapes that includes | ||
an explicit call to palette.make_opaque() in the fill color setter function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer true. It should document what a roundrect is.
Pylint updates and ran black
When a shapes color or transparency is being changed the proper transparent or opaque properties need to be changed in case it is going from a transparent to opaque state (or vice-versa). Also, in the roundrect init the chunk needs to be drawn even if the initial fill is None; otherwise there seems to be nothing to change the color of later on.