Onion Omega OledExpansion Graphics Library in Python
OledLib is a small graphics library for the OledExpansion module for Onion Omega IoT devices.
oledExp Python module mainly deals with writing text on screen,
OledLib dives deeper into pixel precise graphics.
OledLib breaks the limit of 8 pages and 128 columns, giving access to all 128x64 pixels of the screen. It is also faster since it uses the
i2c interface which is capable of sending 32 bytes of data simultaneously instead of only 1 byte (
OledLib's ability to address each pixel individually,
OledExpansion becomes much more versatile and capable of rendering complex graphics.
- 128x64 framebuffer, pixel-level precision.
- Up to 32 bytes sent to screen simultaneously.
- 1-bit bitmap rendering.
- DMA (Direct Memory Access) functionality to fast render a portion of the screen only.
- Special effects: rotation and scaling.
Requires oledExp and onionI2C Python modules to be installed on the Onion Omega IoT device.
Below is a video showcasing most features of the
clearBuffers: Clears the framebuffer (all elements to
putPixel(x, y, value): Puts the
putRectangle(x, y, width, height, fill): Puts a rectangle (
height) at the specified
y coordinates. Setting
True will fill the rectangle, where
False will draw just the borders.
putBitmap(x, y, bitmap): Puts a
bitmap MxN array of
translateBitmap(bitmap): Converts a MxN
bitmap array where each element is a
1), to a
byte array MxL where each element is a
bits). Bitmap array sizes can be:
0<N<64, and the translated bitmap will have sizes:
0<L<8. Useful for achieving faster rendering rates. Use before calling
scaleBitmap(bitmap, scaleX, scaleY): Scales down the given
bitmap. Each axis can scale differently by setting
scaleY. Positive integer values only.
rotateBitmap90(bitmap): Rotates the
bitmap 90 degrees.
rotateBitmap180(bitmap): Rotates the
bitmap 180 degrees.
rotateBitmap270(bitmap): Rotates the
bitmap 270 degrees.
blit(): Renders the whole
framebuffer to screen at maximum fast rate.
pageBlit(pageNo, x, length): Renders portion of a page, (row) with
length starting from
x, to screen at maximum fast rate. Does not clear the
bitmapBlit(x, y, translatedBitmap): Instead of filling the whole 128x64 framebuffer it renders only the region of a
translatedBitmap on the screen at
y location, sort of Direct Memory Access (DMA). Requires the
translateBitmap() as input. Does not clear the