-
Notifications
You must be signed in to change notification settings - Fork 18
Added Triangle Shape #4
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
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 adding triangle! Just a suggestion to simplify the logic.
adafruit_display_shapes/triangle.py
Outdated
super().__init__(self._bitmap, pixel_shader=self._palette, x=smallest_x, y=y0) | ||
|
||
# pylint: disable=invalid-name, too-many-locals, too-many-branches | ||
def _helper(self, x0, y0, x1, y1, x2, y2): |
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.
What does this do?
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 draws the filled triangle. I can rename.
Changes made |
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.
I'm ok as is but have one other suggestion if you agree. I'd rename fill
and outline
to fill_color
and outline_color
because they read more as actions (aka functions) now. Furthermore, the names will make it tougher to add other properties like outline_width
later. Food for thought. :-)
I used |
The only other change I was considering making (which can totally be done in a future release without breaking anything) is to add a Line shape and subclass that for the triangle to reduce code. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_HX8357 to 1.1.0 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#4 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A to 0.2.1 from 0.2.0: > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#12 from caternuson/iss11 > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#10 from caternuson/iss9 Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes to 1.1.2 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#6 from makermelissa/master > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#5 from makermelissa/master > Merge pull request adafruit/Adafruit_CircuitPython_Display_Shapes#4 from makermelissa/master > fixed typo in rtd link
Enjoy! It doesn't have stroke at this time, but this is an initial working triangle.