Skip to content

Instantly share code, notes, and snippets.

@hollyhockberry
Created September 26, 2021 11:33
Show Gist options
  • Save hollyhockberry/000326050e6c184fdf14ee987c31f92f to your computer and use it in GitHub Desktop.
Save hollyhockberry/000326050e6c184fdf14ee987c31f92f to your computer and use it in GitHub Desktop.
M5Paper: draw bitmap to fixed size with M5GFX
#include <M5EPD.h>
#include <M5GFX.h>
void setup() {
M5.begin();
M5GFX display;
display.begin();
display.invertDisplay(false);
display.clear(TFT_WHITE);
float dx, dy;
M5Canvas canvas(&display);
canvas.setPsram(true);
canvas.createFromBmpFile(SD, "/inaba.bmp");
dx = 400.f / static_cast<float>(canvas.width());
dy = 400.f / static_cast<float>(canvas.height());
canvas.pushRotateZoomWithAA(270, 240, 0.f, dx, dy);
canvas.createFromBmpFile(SD, "/inaba2.bmp");
dx = 400.f / static_cast<float>(canvas.width());
dy = 400.f / static_cast<float>(canvas.height());
canvas.pushRotateZoomWithAA(270, 720, 0.f, dx, dy);
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment