Graphics object¶
The Graphics object stores and shares parameters used by the graphic elements.
Configure¶
Warning
Ensure the screen is declared and initialised according to the configuration procedure.
#include "Graphics.h"
The pre-processor statement includes the GUI library.
Graphics myGraphics(&myScreen);
The constructor Graphics()
sets the link to the screen.
myGraphics.begin();
begin()
- initialises the GUI with the default parameters.
The default parameters set the colours of the interface to black for text, white for background and grey for middle.
Then, if needed,
myGraphics.setColours(myColours.black, myColours.white, myColours.grey);
myGraphics.setMarginXY(0, 0);
setColours()
- sets the front, back and middle colours of the interface.
Note
For monochrome and colour e-paper screens, ensure the selected colours are supported.
setMarginXY()
- sets the size of the margins of the elements, to the number of pixels on the x- and y-axis, with
0
as default values.
Default margins
Margins set to 4, 4
The optional parameters are:
-
The first parameter sets the margin in pixels for the x axis, default is
0
; -
The second parameter sets the margin in pixels for the y axis, default is
0
.
To clear the margin, call setMarginXY(0, 0)
.
Use¶
The graphic elements include the following objects
and one function
- Label called from a Graphics object.