From 79ccdda9e368e354598e53428dd9eadcfa56a2e6 Mon Sep 17 00:00:00 2001 From: fruchti Date: Thu, 23 Aug 2018 13:41:07 +0200 Subject: [PATCH] Centre images when printing --- build-number.txt | 2 +- src/print.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build-number.txt b/build-number.txt index 68cfb10..8410b8b 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -472 +473 diff --git a/src/print.c b/src/print.c index fc19327..82ad27a 100644 --- a/src/print.c +++ b/src/print.c @@ -60,8 +60,10 @@ void Print_Image(const uint8_t *data, int width, int height, int scale) & (0x80 >> ((j / scale) % 8)); if(black) { - Print_Buffer[i * LTP1245_LINE_BYTES + j / 8] |= - (0x80 >> (j % 8)); + int x = j; + x += (LTP1245_LINEWIDTH - width * scale) / 2; + Print_Buffer[i * LTP1245_LINE_BYTES + x / 8] |= + (0x80 >> (x % 8)); } } currentline++;