-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix fill_triangle bug issue #33 #34
Conversation
This fix for issue adafruit#33 replaces the for loop at lines 283 to 291 with a while loop so that the y variable is properly incremented between the loops to fill the top and bottom parts of the triangle. This avoids screen row at y0 being drawn twice, and corrects the shape of the triangle. The changes to lines 278 to 282 (as numbered after the fix) initiate the two loops in a way that addresses issue adafruit#22 where a triangle with a flat bottom edge was not drawn correctly. This fix has been implemented in the derived repository [framebuf2](https://github.com/peter-l5/framebuf2) which applies the algorithm here and has been tested with the following code. (Note that `f=True` parameter draws a filled triangle in this implementation.) ``` for z in range(3,123+1,20): for x in range(10,120+1,20): for y in range(0,128): display.fill(0) display.triangle(x,y,30,z,90,63,c=1,f=True) display.show() ```
Looks like this is failing the CI. You can use |
Thanks. I wasn’t sure what to do next so will try out pre commit. To be aware be a few days before I can tackle it, but will do as soon as I can.
On 5 May 2023, at 20:12, Alec Delaney ***@***.***> wrote:
Looks like this is failing the CI. You can use pre-commit to reformat the code to get it to pass. You can find information on installing and using pre-commit here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZGBNNHA4URLR5KPCS75QLTXEVGIFANCNFSM6AAAAAAXXCQTDI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@tekktrik: I couldn't get |
Yup, that fixed the issue! I'll add the review team so the first person who has the bandwidth can take a look :) |
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.
Thank you!
Updating https://github.com/adafruit/Adafruit_CircuitPython_AS7341 to 1.2.14 from 1.2.13: > Merge pull request adafruit/Adafruit_CircuitPython_AS7341#36 from tekktrik/main > Run pre-commit > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore Updating https://github.com/adafruit/Adafruit_CircuitPython_DHT to 4.0.0 from 3.7.8: > Merge pull request adafruit/Adafruit_CircuitPython_DHT#88 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore Updating https://github.com/adafruit/Adafruit_CircuitPython_FONA to 2.2.0 from 2.1.15: > Merge pull request adafruit/Adafruit_CircuitPython_FONA#27 from tekktrik/main > Run pre-commit > Update pre-commit hooks > Add upload url to release action Updating https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C to 3.0.0 from 2.1.19: > Merge pull request adafruit/Adafruit_CircuitPython_FXAS21002C#29 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore Updating https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700 to 3.0.0 from 2.1.18: > Merge pull request adafruit/Adafruit_CircuitPython_FXOS8700#30 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP9600 to 2.0.0 from 1.3.6: > Merge pull request adafruit/Adafruit_CircuitPython_MCP9600#23 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_OV5640 to 1.1.11 from 1.1.10: > Merge pull request adafruit/Adafruit_CircuitPython_OV5640#19 from tekktrik/dev/pre-commit-patch Updating https://github.com/adafruit/Adafruit_CircuitPython_SI5351 to 1.4.0 from 1.3.6: > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#30 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 2.5.1 from 2.5.0: > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#115 from tekktrik/main > Run pre-commit > Update pre-commit hooks Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 5.7.0 from 5.6.12: > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#101 from muddi900/add/context-manager > Run pre-commit > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_binascii to 2.0.0 from 1.2.15: > Merge pull request adafruit/Adafruit_CircuitPython_binascii#18 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_BitbangIO to 1.3.10 from 1.3.9: > Merge pull request adafruit/Adafruit_CircuitPython_BitbangIO#26 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 2.0.0 from 1.5.11: > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#61 from tekktrik/main > Run pre-commit > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver to 1.2.8 from 1.2.7: > Merge pull request adafruit/Adafruit_CircuitPython_BitmapSaver#27 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Eddystone to 1.10.14 from 1.0.13: > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Eddystone#18 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_GFX to 1.1.18 from 1.1.17: > Merge pull request adafruit/Adafruit_CircuitPython_GFX#34 from peter-l5/main > Run pre-commit > Update pre-commit hooks Updating https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad to 1.17.2 from 1.17.1: > Merge pull request adafruit/Adafruit_CircuitPython_ImageLoad#69 from tekktrik/main > Update pre-commit hooks > Merge pull request adafruit/Adafruit_CircuitPython_ImageLoad#67 from Neradoc/more-docs Updating https://github.com/adafruit/Adafruit_CircuitPython_LIFX to 2.0.0 from 1.10.8: > Merge pull request adafruit/Adafruit_CircuitPython_LIFX#20 from tekktrik/main > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore > Update .pylintrc for v2.15.5 > Fix release CI files > Update pylint to 2.15.5 > Updated pylint version to 2.13.0 > Switching to composite actions Updating https://github.com/adafruit/Adafruit_CircuitPython_miniQR to 2.0.0 from 1.3.15: > Merge pull request adafruit/Adafruit_CircuitPython_miniQR#23 from tekktrik/main > Run pre-commit > Update pre-commit hooks > Add upload url to release action > Add .venv to .gitignore Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
This fix for issue #33 replaces the for loop at lines 283 to 291 with a while loop so that the y variable is properly incremented between the loops to fill the top and bottom parts of the triangle. This avoids screen row at y0 being drawn twice, and corrects the shape of the triangle. The changes to lines 278 to 282 (as numbered after the fix) initiate the two loops in a way that addresses issue #22 where a triangle with a flat bottom edge was not drawn correctly.
This fix has been implemented in the derived repository framebuf2 which applies the algorithm here and has been tested with the following code. (Note that
f=True
parameter draws a filled triangle in this implementation.)