diff --git a/radio/src/thirdparty/libopenui/src/bitmapbuffer.cpp b/radio/src/thirdparty/libopenui/src/bitmapbuffer.cpp index 03543a2cf..6763cf060 100755 --- a/radio/src/thirdparty/libopenui/src/bitmapbuffer.cpp +++ b/radio/src/thirdparty/libopenui/src/bitmapbuffer.cpp @@ -676,6 +676,32 @@ BitmapBuffer * BitmapBuffer::loadMask(const char * filename) return bitmap; } +BitmapBuffer * BitmapBuffer::horizontalFlip() const +{ + BitmapBuffer * result = new BitmapBuffer(format, width(), height()); + pixel_t * srcData = data; + pixel_t * destData = result->data; + for (uint8_t y = 0; y < height(); y++) { + for (uint8_t x = 0; x < width(); x++) { + destData[x] = srcData[width() - 1 - x]; + } + srcData += width(); + destData += width(); + } + return result; +} + +BitmapBuffer * BitmapBuffer::verticalFlip() const +{ + BitmapBuffer * result = new BitmapBuffer(format, width(), height()); + for (uint8_t y = 0; y < height(); y++) { + for (uint8_t x = 0; x < width(); x++) { + result->data[y * width() + x] = data[(height() - 1 - y) * width() + x]; + } + } + return result; +} + BitmapBuffer * BitmapBuffer::loadMaskOnBackground(const char * filename, LcdFlags foreground, LcdFlags background) { BitmapBuffer * result = nullptr; diff --git a/radio/src/thirdparty/libopenui/src/bitmapbuffer.h b/radio/src/thirdparty/libopenui/src/bitmapbuffer.h index dcb63abe6..c50db7c13 100755 --- a/radio/src/thirdparty/libopenui/src/bitmapbuffer.h +++ b/radio/src/thirdparty/libopenui/src/bitmapbuffer.h @@ -232,7 +232,7 @@ class RLEBitmap: } }; -class BitmapBuffer: public BitmapBufferBase +class BitmapBuffer: public BitmapBufferBase { private: bool dataAllocated; @@ -500,6 +500,10 @@ class BitmapBuffer: public BitmapBufferBase drawBitmap(x + xshift, y + yshift, bitmap, 0, 0, 0, 0, scale); } + BitmapBuffer * horizontalFlip() const; + + BitmapBuffer * verticalFlip() const; + protected: static BitmapBuffer * load_bmp(const char * filename); static BitmapBuffer * load_stb(const char * filename);