New helper for transparent bitmap background

This commit is contained in:
Bertrand Songis
2020-03-26 17:52:21 +01:00
parent 4f6627e6db
commit 68fa08ae83
+20
View File
@@ -96,4 +96,24 @@ class TransparentBufferedWindow: public BufferedWindow<T>
}
};
class TransparentBitmapBackground: public TransparentBufferedWindow<Window>
{
public:
TransparentBitmapBackground(Window * parent, const rect_t & rect, const BitmapBuffer * bitmap):
TransparentBufferedWindow<Window>(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_