Skip to content
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

Method for drawing custom graphics #2

Open
OliverMardle opened this issue Aug 9, 2017 · 2 comments
Open

Method for drawing custom graphics #2

OliverMardle opened this issue Aug 9, 2017 · 2 comments

Comments

@OliverMardle
Copy link

Hi, is there a way of drawing custom bitmaps onto the display. I have found your examples but they appear to be using font sheets which isn't ideal for me. is there a way of sending the bytes that make up a bitmap?

cheers.

@JMW95
Copy link
Owner

JMW95 commented Aug 9, 2017

The tricky thing with sending bitmap data is that the screen uses 1-bit-per-pixel, so you have to pack 8 pixels into a single byte. Have a look at the load_font_sheet() method, combined with the put_string() method to see how I handle loading and displaying the fontsheet data.

The easiest way to display an image would be to loop over all the pixels in your bitmap (assuming it will fit on the screen!) and call plot() to set each pixel of the display to white or black. You could write a nice helper method to do this for you.

A more efficient way would be to pre-calculate the 8-pixels-per-byte version of your image, then overwrite the appropriate part of the .fbuff array when you want to display it.

@OliverMardle
Copy link
Author

Ahh, ok. Yes... ill give that a go.

Thank You.

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

No branches or pull requests

2 participants