Skip to content

Instantly share code, notes, and snippets.

@phoddie
Last active September 18, 2020 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phoddie/cc3eac687a165dd06ecb8721854bb2d0 to your computer and use it in GitHub Desktop.
Save phoddie/cc3eac687a165dd06ecb8721854bb2d0 to your computer and use it in GitHub Desktop.
Uses Poco clipping too decompress and draw a JPEG image with text superimposed using no extra microcontroller memory needed.
let palatino36 = parseBMF(new Resource("palatino_36.fnt"));
palatino36.bitmap = parseBMP(new Resource("palatino_36.bmp"));
// background
poco.begin()
poco.fillRectangle(gray, 0, 0, poco.width, poco.height);
poco.drawText("Hello Basuke", palatino36, white, 15, 20);
poco.end();
// render JPEG blocks with text composed on top
let jpeg = new JPEG(new Resource("piano.jpg"));
let block;
while (block = jpeg.read()) {
poco.begin(block.x + 60, block.y, block.width, block.height);
poco.drawBitmap(block, block.x + 60, block.y);
poco.drawText("Hello Basuke", palatino36, white, 15, 20);
poco.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment