Skip to content

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

Merged
merged 5 commits into from
Aug 5, 2020
Merged

first commit #1202

merged 5 commits into from
Aug 5, 2020

Conversation

jedgarpark
Copy link
Contributor

ON AIR sign for YouTube livestream using Airlift Metro M4, matrix shield, 64x32 matrix.
Note: This code requires the adafruit_matrixportal library.

@ladyada
Copy link
Member

ladyada commented Aug 5, 2020

@makermelissa plz review - do we have a way of having a bitmap background? that might be easier than the wings-drawing functions?

@jedgarpark
Copy link
Contributor Author

@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.

Copy link
Collaborator

@makermelissa makermelissa left a 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.

Comment on lines 84 to 111
# 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,
]
Copy link
Collaborator

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]))

Copy link
Contributor Author

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!

@makermelissa
Copy link
Collaborator

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:

wing_lines.append(Polygon([(3,3), (9,3), (9,4), (4,4)], outline=color[1]))
wing_lines.append(Polygon([(5,6), (9,6), (9,7), (6,7)], outline=color[1]))
wing_lines.append(Polygon([(7,9), (9,9), (9,10), (8,10)], outline=color[1]))
wing_lines.append(Polygon([(54,3), (60,3), (59,4), (54,4)], outline=color[1]))
wing_lines.append(Polygon([(54,6), (58,6), (57,7), (54,7)], outline=color[1]))
wing_lines.append(Polygon([(54,9), (56,9), (55,10), (54,10)], outline=color[1]))

Copy link
Collaborator

@makermelissa makermelissa left a 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!

@jedgarpark jedgarpark merged commit 5513343 into adafruit:master Aug 5, 2020
@jedgarpark jedgarpark deleted the matrix-on-air branch August 5, 2020 18:18
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

Successfully merging this pull request may close these issues.

3 participants