-
Notifications
You must be signed in to change notification settings - Fork 789
first commit #1202
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
first commit #1202
Conversation
@makermelissa plz review - do we have a way of having a bitmap background? that might be easier than the wings-drawing functions? |
@ladyada I was trying to show how we can do the graphics in code without needing people to create a bitmap (protest sign project was all about bitmaps) so that was my thinking behind using the lines and rectangle shapes. |
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.
Looks good for the most part. Some of the drawing code can be reduced. I was going to suggest using a polygon, but when I tested it out, there appears to be an off by one type issue, so I'm not suggesting it at this time.
Matrix_On_Air/matrix_on_air.py
Outdated
# draw the wings w line shapes | ||
wing1 = Line(3, 3, 10, 3, color[1]) # x-start, y-start, x-end, y-end, color | ||
wing2 = Line(4, 4, 10, 4, color[1]) | ||
wing3 = Line(5, 6, 10, 6, color[1]) | ||
wing4 = Line(6, 7, 10, 7, color[1]) | ||
wing5 = Line(7, 9, 10, 9, color[1]) | ||
wing6 = Line(8, 10, 10, 10, color[1]) | ||
wing7 = Line(54, 3, 61, 3, color[1]) | ||
wing8 = Line(54, 4, 60, 4, color[1]) | ||
wing9 = Line(54, 6, 59, 6, color[1]) | ||
wing10 = Line(54, 7, 58, 7, color[1]) | ||
wing11 = Line(54, 9, 57, 9, color[1]) | ||
wing12 = Line(54, 10, 56, 10, color[1]) | ||
|
||
wing_lines = [ | ||
wing1, | ||
wing2, | ||
wing3, | ||
wing4, | ||
wing5, | ||
wing6, | ||
wing7, | ||
wing8, | ||
wing9, | ||
wing10, | ||
wing11, | ||
wing12, | ||
] |
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 could probably be reduced significantly with:
# draw the wings w line shapes
wing_lines = []
wing_lines.append(Line(3, 3, 10, 3, color[1])) # x-start, y-start, x-end, y-end, color
wing_lines.append(Line(4, 4, 10, 4, color[1]))
wing_lines.append(Line(5, 6, 10, 6, color[1]))
wing_lines.append(Line(6, 7, 10, 7, color[1]))
wing_lines.append(Line(7, 9, 10, 9, color[1]))
wing_lines.append(Line(8, 10, 10, 10, color[1]))
wing_lines.append(Line(54, 3, 61, 3, color[1]))
wing_lines.append(Line(54, 4, 60, 4, color[1]))
wing_lines.append(Line(54, 6, 59, 6, color[1]))
wing_lines.append(Line(54, 7, 58, 7, color[1]))
wing_lines.append(Line(54, 9, 57, 9, color[1]))
wing_lines.append(Line(54, 10, 56, 10, color[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.
great, I just incorporated that, thanks!
I just pushed a fix for the line/polygon drawing code in display shapes that fixes the off by one issue. It will have to be a major release bump due to it breaking code, but a heads up that the X-offset will need to be adjusted in this code for that as it was missing a pixel at the end of each line. Once it works, here's some even more optimized code that also fixes the location of the pixels so it looks like it originally did:
|
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 tested. It looks good!
ON AIR sign for YouTube livestream using Airlift Metro M4, matrix shield, 64x32 matrix.
Note: This code requires the
adafruit_matrixportal
library.