Go Down

Topic: Draw bitmap one pixel at a time? (Read 419 times) previous topic - next topic

Solipsis

How would you go about drawing a bitmap one pixel at a time (very fast)? I think I can do it if I know how to fetch or find pixels in a bitmap

(I have an Adafruit 128 x 64 OLED and an Arduino Mega)

Do you know of any place that has ideas or examples of clever animation effects with displays?

Thank you! :)

arctos

By definition 1 pixel at a time is slow
You need to think about the communication overheads

1 pixel is what 2 bytes?

Take a deep look into your graphics library and see how many bytes it takes just to instruct the display that you want to send it 2 bytes.

The only way you can achieve what you want is to write to a buffer (RAM expensive) the dump the buffer to the display.

bodmer

Have a look at the message exchange and code here.

I expect the OLED you have is a SSD1306 single colour display, the common libraries for this display (Adafruit etc) use frame buffers. For a 128x64 display only 1Kbyte of RAM is needed, easily accommodated by a Mega.
Formerly Rowboteer (now a broken user profile!)

Grumpy_Mike

#3
Dec 14, 2017, 11:49 pm Last Edit: Dec 14, 2017, 11:57 pm by Grumpy_Mike
Quote
I have an Adafruit 128 x 64 OLED
Then use the Adafruit library it has all that code in it. The OLED is one bit per pixel so you get eight pixels per byte.
The normal way to use it is to build up your image in SRAM first and then transfer the whole block over to the display.
Drawing one pixel at a time is very slow as it means eight transfers to get a byte over and I don't think you can actually read data from the OLED so you have to keep an off screen memory buffer anyway.

Go Up