EpdBmpFromCode()

Library Description ›› EPD ›› Common ›› Display ››
Parent Previous Next

Syntax

EpdBmpFromCode(dwBmpAlias As Dword, wOriginX As Word, wOriginY As Word)

Parameters

dwBmpAlias — Name of the BMP image table stored in flash

wOriginX — X-coordinate of the bottom-left corner where the image will be drawn

wOriginY — Y-coordinate of the bottom-left corner where the image will be drawn


Prints a BW/RY compressed picture from a flash table.


Buffered mode: the compressed data is read linearly from flash and written directly into the frame buffer.
Where in the frame buffer each pixel actually lands depends on the current virtual orientation, so the destination coordinates aren't visited in a simple linear order — but the source data is still read sequentially, start to finish, exactly once, regardless of orientation.
Since the frame buffer can be written to in any order (unlike GRAM), this remains a fast, single-pass operation no matter which orientation is set.


Bufferless mode: at 0° orientation, decompression and GRAM writing happen together in one pass — each byte is built directly from the flash data as it's read and sent to the EPD immediately, the fastest path available.


At any other orientation, the EPD's byte/bit-oriented, write-only GRAM means each output byte has to be built one bit at a time, and how expensive that is depends on the compression mode:


Raw (uncompressed) bitmap data: each bit's source position in flash is computed directly from its row/column — a single, direct flash read per bit, regardless of orientation.
Rotated printing costs more than 0° printing, but stays fast.


RLE-compressed data: a run's position in the stream depends on decoding every run before it, so there's no way to jump directly to an arbitrary bit the way raw bitmap data allows.
At 90° and 270° specifically, the library works around this with a small decompression buffer (bDecodeBufferSize, and its backing array baDecodeBuffer) rather than re-walking the stream separately for every single bit: the image is processed in vertical strips, each as wide as the buffer, and for each strip the compressed stream is decoded exactly once, sequentially, with the decoded bits written directly into their correct rotated positions as they're produced.
How much this buys you depends directly on how the buffer size compares to the image's own width.
The number of full passes through the compressed stream works out to image width ÷ buffer size, rounded up — so an 8-byte buffer needs roughly twice as many passes for a 240-pixel-wide image as for a 120-pixel-wide one, and the RLE path's speed advantage narrows accordingly.
In practice this means: pick a buffer size with your largest expected image width in mind, not just a fixed small default.
A buffer that comfortably outperforms raw bitmap decoding on small icons can fall noticeably behind on a wider image unless it's sized up to match — bDecodeBufferSize values of 32 or 64 bytes are reasonable choices once images grow past a couple hundred pixels wide, trading that many extra bytes of RAM for staying close to a single pass.
bDecodeBufferSize can be set anywhere from 4 to 256 bytes; there's no single correct value, only the right tradeoff for your specific images and available RAM.


Note: bDecodeBufferSize is declared at the top of EpdBmpFromCode(), in TftLib\EPD\System\EPD_System_V1.inc — adjust it there to change the buffer size for your project.


Symbol bDecodeBufferSize = 16


In all cases, this extra cost is still small relative to how the display itself operates:
EPD refresh times run from hundreds of milliseconds to several seconds, which already dominates total operation time by a wide margin (see Understanding EPD Displays) — so even the slower rotated-RLE case rarely becomes the actual bottleneck in practice.


Note: The image must have been compressed with PositronPixelFoundry.exe


    EpdSetOrientation(3)                                            'Rotate working plane 90 degrees

    EpdBmpFromCode(ATOM_90, 90,45)                                  'Draw Atom picture from FLASH code   

    EpdFrameUpdate(EPD_UPDATE_NORMAL)                               'Update EPD screen

....

' 90x90

Dim ATOM_90 As Flash8 = 0x00,0x5A,0x00,0x5A,0x01,0x01,0xE0,0x03,0x55,0x02,0x02,0x03,0x52,0x02,0x05,0x02,0x50,0x02,0x07,0x02,0x4E,0x02,0x09,0x01,_

0x4E,0x01,0x0A,0x02,0x49,0x05,0x0B,0x01,0x48,0x07,0x0B,0x01,0x47,0x07,0x0B,0x01,0x0C,0x03,0x37,0x08,0x0C,0x01,0x09,0x07,_

0x3A,0x03,0x0C,0x01,0x09,0x07,0x25,0x05,0x10,0x03,0x0C,0x02,0x08,0x0B,0x1F,0x03,0x03,0x04,0x09,0x01,0x03,0x02,0x0E,0x01,_

0x08,0x01,0x03,0x04,0x02,0x03,0x1C,0x02,0x08,0x04,0x07,0x04,0x0F,0x01,0x0C,0x03,0x05,0x01,0x1C,0x01,0x0C,0x03,0x05,0x01,_

0x12,0x01,0x06,0x03,0x03,0x03,0x06,0x01,0x1A,0x02,0x0E,0x02,0x04,0x01,0x12,0x02,0x03,0x03,0x04,0x03,0x07,0x01,0x1A,0x01,_

0x11,0x02,0x01,0x02,0x13,0x05,0x10,0x01,0x1A,0x01,0x13,0x03,0x13,0x03,0x12,0x01,0x1A,0x02,0x13,0x03,0x11,0x03,0x13,0x01,_

0x1B,0x01,0x13,0x04,0x0F,0x04,0x13,0x01,0x1B,0x01,0x13,0x01,0x02,0x02,0x0C,0x02,0x03,0x01,0x13,0x01,0x1B,0x01,0x13,0x01,_

0x04,0x02,0x04,0x02,0x03,0x02,0x04,0x01,0x12,0x02,0x1B,0x02,0x12,0x01,0x05,0x02,0x01,0x07,0x06,0x01,0x12,0x01,0x1D,0x01,_

0x1A,0x08,0x06,0x01,0x12,0x01,0x1D,0x01,0x11,0x01,0x08,0x08,0x06,0x01,0x11,0x01,0x1F,0x01,0x10,0x01,0x08,0x08,0x06,0x01,_

0x11,0x01,0x1F,0x01,0x10,0x01,0x08,0x02,0x02,0x04,0x06,0x02,0x0F,0x02,0x20,0x01,0x0F,0x01,0x08,0x01,0x03,0x04,0x07,0x01,_

0x0F,0x01,0x21,0x01,0x0F,0x01,0x07,0x03,0x01,0x04,0x08,0x01,0x0E,0x02,0x22,0x01,0x0E,0x01,0x06,0x03,0x02,0x06,0x06,0x01,_

0x0E,0x01,0x23,0x01,0x0C,0x1C,0x0C,0x01,0x25,0x01,0x05,0x0A,0x02,0x04,0x08,0x10,0x05,0x02,0x24,0x06,0x08,0x02,0x03,0x02,_

0x0D,0x02,0x03,0x01,0x08,0x06,0x21,0x07,0x0A,0x01,0x03,0x02,0x03,0x04,0x08,0x02,0x02,0x01,0x0A,0x07,0x1B,0x04,0x05,0x01,_

0x0A,0x02,0x01,0x02,0x03,0x06,0x01,0x03,0x04,0x02,0x01,0x01,0x0A,0x02,0x05,0x03,0x16,0x03,0x09,0x01,0x09,0x04,0x03,0x0C,_

0x04,0x03,0x0A,0x01,0x09,0x02,0x12,0x03,0x0B,0x01,0x09,0x03,0x04,0x0D,0x04,0x03,0x08,0x01,0x0C,0x03,0x0D,0x03,0x0E,0x01,_

0x08,0x02,0x05,0x02,0x02,0x09,0x04,0x03,0x08,0x01,0x0E,0x02,0x0B,0x02,0x10,0x02,0x06,0x03,0x04,0x02,0x03,0x04,0x02,0x04,_

0x04,0x03,0x06,0x01,0x11,0x02,0x08,0x02,0x12,0x02,0x04,0x03,0x03,0x04,0x01,0x05,0x01,0x07,0x03,0x03,0x05,0x02,0x12,0x02,_

0x06,0x02,0x14,0x01,0x04,0x03,0x02,0x13,0x03,0x04,0x03,0x02,0x14,0x01,0x06,0x01,0x16,0x01,0x01,0x03,0x01,0x01,0x02,0x13,_

0x04,0x01,0x01,0x02,0x01,0x02,0x16,0x01,0x04,0x01,0x17,0x04,0x02,0x01,0x02,0x02,0x01,0x10,0x03,0x02,0x02,0x03,0x17,0x01,_

0x04,0x01,0x02,0x02,0x13,0x03,0x03,0x01,0x02,0x01,0x02,0x02,0x02,0x05,0x03,0x05,0x02,0x02,0x02,0x03,0x17,0x01,0x04,0x07,_

0x11,0x04,0x02,0x01,0x05,0x01,0x04,0x04,0x03,0x05,0x02,0x02,0x02,0x03,0x17,0x01,0x04,0x08,0x0F,0x02,0x02,0x04,0x05,0x01,_

0x04,0x04,0x02,0x06,0x02,0x05,0x02,0x01,0x16,0x01,0x04,0x0A,0x0D,0x01,0x04,0x03,0x05,0x02,0x02,0x0D,0x02,0x04,0x04,0x01,_

0x14,0x01,0x05,0x02,0x01,0x09,0x0A,0x01,0x06,0x03,0x04,0x10,0x03,0x03,0x05,0x02,0x12,0x01,0x06,0x01,0x03,0x09,0x08,0x01,_

0x07,0x03,0x04,0x08,0x02,0x05,0x04,0x02,0x07,0x02,0x0F,0x02,0x07,0x01,0x03,0x09,0x08,0x01,0x08,0x02,0x04,0x01,0x03,0x04,_

0x02,0x04,0x04,0x03,0x08,0x01,0x0D,0x03,0x09,0x01,0x01,0x05,0x01,0x04,0x07,0x01,0x09,0x03,0x03,0x01,0x03,0x03,0x03,0x03,_

0x05,0x03,0x09,0x01,0x0A,0x03,0x0D,0x04,0x02,0x04,0x06,0x02,0x09,0x04,0x03,0x01,0x02,0x04,0x02,0x02,0x05,0x03,0x0A,0x01,_

0x08,0x02,0x13,0x01,0x02,0x07,0x02,0x02,0x0A,0x01,0x03,0x01,0x04,0x02,0x04,0x01,0x06,0x01,0x02,0x01,0x0A,0x03,0x02,0x04,_

0x16,0x01,0x01,0x03,0x03,0x06,0x09,0x01,0x03,0x02,0x0F,0x01,0x03,0x01,0x0A,0x06,0x23,0x03,0x01,0x07,0x01,0x03,0x03,0x03,_

0x0B,0x03,0x02,0x04,0x01,0x0B,0x24,0x02,0x08,0x22,0x09,0x01,0x24,0x01,0x0D,0x03,0x02,0x10,0x03,0x03,0x0C,0x02,0x22,0x02,_

0x0E,0x01,0x07,0x02,0x04,0x03,0x07,0x01,0x0E,0x01,0x22,0x01,0x0F,0x01,0x08,0x02,0x03,0x02,0x08,0x01,0x0F,0x01,0x20,0x02,_

0x0F,0x01,0x09,0x05,0x09,0x01,0x0F,0x01,0x20,0x01,0x10,0x01,0x0A,0x03,0x09,0x01,0x10,0x02,0x1E,0x02,0x10,0x01,0x09,0x04,_

0x09,0x01,0x11,0x01,0x1E,0x01,0x11,0x01,0x08,0x02,0x03,0x01,0x08,0x01,0x11,0x02,0x1D,0x01,0x19,0x02,0x05,0x02,0x06,0x01,_

0x12,0x01,0x1C,0x01,0x13,0x01,0x05,0x02,0x07,0x02,0x05,0x01,0x12,0x01,0x1C,0x01,0x13,0x01,0x03,0x02,0x0B,0x02,0x03,0x01,_

0x13,0x01,0x1B,0x01,0x13,0x04,0x0E,0x05,0x13,0x01,0x1A,0x02,0x0D,0x02,0x04,0x03,0x11,0x03,0x13,0x01,0x1A,0x01,0x0C,0x06,_

0x01,0x03,0x12,0x03,0x13,0x01,0x1A,0x01,0x0B,0x0B,0x13,0x04,0x11,0x01,0x1A,0x02,0x0A,0x08,0x02,0x01,0x13,0x01,0x02,0x03,_

0x02,0x05,0x08,0x01,0x1B,0x01,0x0A,0x02,0x02,0x04,0x02,0x01,0x12,0x02,0x04,0x09,0x07,0x01,0x1B,0x01,0x0A,0x01,0x03,0x04,_

0x02,0x02,0x11,0x01,0x07,0x08,0x05,0x02,0x1C,0x01,0x07,0x03,0x03,0x04,0x03,0x01,0x11,0x01,0x07,0x08,0x04,0x02,0x1E,0x08,_

0x02,0x01,0x02,0x03,0x04,0x01,0x11,0x01,0x07,0x01,0x03,0x09,0x2B,0x02,0x06,0x01,0x10,0x01,0x08,0x01,0x03,0x04,0x39,0x01,_

0x0F,0x01,0x0C,0x03,0x3A,0x01,0x0E,0x02,0x0B,0x02,0x3D,0x01,0x0D,0x01,0x4B,0x01,0x0C,0x02,0x4B,0x02,0x0B,0x01,0x4D,0x01,_

0x0A,0x02,0x4E,0x01,0x08,0x02,0x4F,0x02,0x07,0x01,0x51,0x02,0x05,0x01,0x54,0x05,0xDE,0x02

Created with the Personal Edition of HelpNDoc: Free HTML Help documentation generator