UiUiUi
A user interface library for micro controller sketches based on U8g2
UIBitmap.h
1// SPDX-License-Identifier: BSD-2-Clause
2// (C) 2023 Andrew Burks
3
4#pragma once
5
6#include "Arduino.h"
7#include <U8g2lib.h>
8
9#include "UIEnums.h"
10#include "UIPoint.h"
11#include "UISize.h"
12#include "UIArea.h"
13#include "UIWidget.h"
14
15
21class UIBitmap : public UIWidget {
22
23 public:
24
29 UIBitmap(uint16_t width, uint16_t height, const uint8_t *bitmap, UIAlignment alignment, UIWidget* next = nullptr);
30
35 UIBitmap(uint16_t width, uint16_t height, const uint8_t *bitmap, UIWidget* next = nullptr);
36
38 UIArea* render(U8G2* display,bool force);
39
40 protected:
41
43 void computePreferredSize(U8G2 *display,UISize *preferredSize);
44
45 private:
46
48 const uint8_t* bitmap;
49
51 UISize imageSize;
52
54 UIAlignment alignment;
55
57 UIPoint topLeft;
58
59
60};
61
62// end of file
Area consisting of left, top, right, and bottom value.
Definition: UIArea.h:20
A widget containing a bitmap (XBMP) which is set statically during compile time.
Definition: UIBitmap.h:21
void computePreferredSize(U8G2 *display, UISize *preferredSize)
Generate the preferred size from the bitmap size.
Definition: UIBitmap.cpp:44
UIArea * render(U8G2 *display, bool force)
A bitmap is only rendered if the rendering is forced, otherwise it never changes.
Definition: UIBitmap.cpp:22
UIBitmap(uint16_t width, uint16_t height, const uint8_t *bitmap, UIAlignment alignment, UIWidget *next=nullptr)
Create a bitmap with supplied alignment and potential successor.
Definition: UIBitmap.cpp:15
Representation of a point on the display.
Definition: UIPoint.h:9
Representation of a size, i.e.
Definition: UISize.h:9
Basic widget class, ancestor of all UI widgets.
Definition: UIWidget.h:36
UISize preferredSize(U8G2 *display)
Return the preferred size of this widget, will be called before a call to layout().
Definition: UIWidget.cpp:16
UIWidget * next
Pointer to the next widget on the same level.
Definition: UIWidget.h:65