From 68fa08ae83e4157e0161f060a001f4e73298321a Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 26 Mar 2020 17:52:21 +0100 Subject: [PATCH] New helper for transparent bitmap background --- .../thirdparty/libopenui/src/bufferedwindow.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/radio/src/thirdparty/libopenui/src/bufferedwindow.h b/radio/src/thirdparty/libopenui/src/bufferedwindow.h index 6e6aa4a2c..a7f693cc1 100644 --- a/radio/src/thirdparty/libopenui/src/bufferedwindow.h +++ b/radio/src/thirdparty/libopenui/src/bufferedwindow.h @@ -96,4 +96,24 @@ class TransparentBufferedWindow: public BufferedWindow } }; +class TransparentBitmapBackground: public TransparentBufferedWindow +{ + public: + TransparentBitmapBackground(Window * parent, const rect_t & rect, const BitmapBuffer * bitmap): + TransparentBufferedWindow(parent, rect, OPAQUE), + background(bitmap) + { + } + + protected: + const BitmapBuffer * background; + + void paintUpdate(BitmapBuffer * dc) override + { + if (background) { + dc->drawBitmap((width() - background->width()) / 2, (height() - background->height()) / 2, background); + } + } +}; + #endif // _BUFFERED_WINDOW_H_