Phoenard
PHNDisplay.h
Go to the documentation of this file.
1 /*
2 The MIT License (MIT)
3 
4 This file is part of the Phoenard Arduino library
5 Copyright (c) 2014 Phoenard
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 */
25 
45 #ifndef _PHN_DISPLAY_H_
46 #define _PHN_DISPLAY_H_
47 
48 #include "PHNDisplayHardware.h"
49 #include "PHNSettings.h"
50 #include "PHNWidget.h"
51 #include "PHNDate.h"
52 #include <utility/PHNUtils.h>
53 
55 typedef struct {
56  public:
57  uint16_t x, y, w, h;
58 } Viewport;
59 
61 typedef struct {
62  int x, y;
63  float pressure;
64 
65  bool isPressed() const { return pressure > 0.0F; }
66 
67  bool isPressed(int x, int y, int width, int height) {
68  return isPressed() && this->x >= x && this->y >= y && this->x < (x + width) && this->y < (y + height);
69  }
70 } PressPoint;
71 
73 typedef struct {
74  uint8_t textsize;
75  uint16_t cursor_x, cursor_y;
76  uint16_t cursor_x_start;
77  color_t textcolor;
78  color_t textbg;
79  bool text_hasbg;
80 } TextOptions;
81 
83 typedef struct TextBounds {
84  uint8_t size;
85  uint16_t x, y, w, h;
86 
87  bool operator == (const TextBounds &o) {
88  return size==o.size && x==o.x && y==o.y && w==o.w && h==o.h;
89  }
90 } TextBounds;
91 
93 typedef struct {
94  uint8_t bpp;
95  uint16_t width;
96  uint16_t height;
97  uint16_t colors;
98  // color values
99  // pixel data
101 
103 typedef struct {
104  uint32_t size;
105  uint16_t unused1;
106  uint16_t unused2;
107  uint32_t pixelDataOffset;
108  uint32_t headerSize;
109  uint32_t width;
110  uint32_t height;
111  uint16_t planes;
112  uint16_t bitCount;
113  uint32_t compression;
114  uint32_t bitmapSize;
115  uint32_t PPM_x;
116  uint32_t PPM_y;
117  uint32_t biClrUsed;
118  uint32_t biClrImportant;
120 
122 typedef struct {
123  uint8_t b;
124  uint8_t g;
125  uint8_t r;
126  uint8_t a;
127 } Color_ARGB;
128 
129 // Touchscreen constants
130 #define TFTLCD_TOUCH_PRESSURE_THRESHOLD 90 // Pressed down above this value
131 #define TFTLCD_TOUCH_PRESSDELAY 30 // Time in MS required before a press change is registered
132 
133 // Wrap-around modes for setWrapMode(mode)
134 #define WRAPMODE_DOWN 0x0
135 #define WRAPMODE_UP 0x4
136 
137 // Touch input smoothen function - touch change (delta) passes through here
138 #define TFTLCD_TOUCH_SMOOTH(x) (0.01 * abs(x) * x)
139 
150  public:
152  PHN_Display();
154  void setSleeping(bool sleeping);
156  void setBacklight(int level);
158  void update();
160  void updateTouch();
162  void updateWidgets();
164  void invalidate(void);
166  uint16_t width();
168  uint16_t height();
170  bool isWidescreen(void);
171 
176  void setScreenRotation(uint8_t rotation);
178  uint8_t getScreenRotation(void);
179 
184  void setWrapMode(uint8_t mode);
185 
190  void goTo(uint16_t x, uint16_t y);
197  void goTo(uint16_t x, uint16_t y, uint8_t direction);
198 
199  // Viewport functions
201  void setViewport(Viewport viewport);
203  void setViewport(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
205  void setViewportRelative(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
207  void resetViewport(void);
209  Viewport getViewport(void);
211  uint32_t getViewportArea(void);
212 
213  // Screen touch functions
215  PressPoint getTouchLast(void);
217  PressPoint getTouch(void);
221  bool isTouched(void);
223  bool isTouchDown(void);
225  bool isTouchUp(void);
227  bool isTouched(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
229  bool isTouchEnter(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
231  bool isTouchLeave(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
233  bool isTouchClicked(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
235  bool isTouchChange(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
236 
237  // Slider touch functions
239  float getSlider(void);
241  float getSliderStart(void);
243  bool isSliderTouched(void);
245  bool isSliderTouchDown(void);
247  bool isSliderTouchUp(void);
248 
249  // Shape drawing
251  void drawPixel(uint16_t x, uint16_t y, color_t color);
253  void fill(color_t color);
255  void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, color_t color);
256 
263  void drawStraightLine(uint16_t x, uint16_t y, uint16_t length, uint8_t direction, color_t color);
264 
273  void drawLineAngle(int x, int y, int r1, int r2, float angle, color_t color);
274 
276  void drawVerticalLine(uint16_t x, uint16_t y, uint16_t length, color_t color);
278  void drawHorizontalLine(uint16_t x, uint16_t y, uint16_t length, color_t color);
280  void drawTriangle(uint16_t x0, uint16_t y0,
281  uint16_t x1, uint16_t y1,
282  uint16_t x2, uint16_t y2, color_t color);
284  void fillTriangle(int32_t x0, int32_t y0,
285  int32_t x1, int32_t y1,
286  int32_t x2, int32_t y2,
287  color_t color);
289  void drawRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, color_t color);
291  void fillRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, color_t color);
293  void fillBorderRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, color_t color, color_t borderColor);
295  void drawRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t radius, color_t color);
297  void fillRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t radius, color_t color);
299  void fillBorderRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t radius, color_t color, color_t borderColor);
301  void drawCircle(uint16_t x, uint16_t y, uint16_t r, color_t color);
303  void fillCircle(uint16_t x, uint16_t y, uint16_t r, color_t color);
305  void fillBorderCircle(uint16_t x, uint16_t y, uint16_t r, color_t color, color_t borderColor);
306 
307  /* ====================================== TEXT DRAWING ======================================== */
308 
309  /* Sets the cursor pixel x/y where new text will be drawn */
311  const uint16_t getCursorX(void) {return textOpt.cursor_x;}
313  const uint16_t getCursorY(void) {return textOpt.cursor_y;}
315  void setCursor(uint16_t x, uint16_t y);
317  void setCursorDown(uint16_t x);
318 
320  void setScroll(int value);
322  uint16_t getScroll() const { return _scroll; }
324  void scroll(int offset) { setScroll((int) _scroll + offset); }
325 
326  /* Options for printing text */
328  void setTextColor(color_t c);
330  void setTextColor(color_t c, color_t bg);
332  void setTextSize(uint8_t s);
334  color_t getTextBackground(void) {return textOpt.textbg;}
336  color_t getTextColor(void) {return textOpt.textcolor;}
338  uint8_t getTextSize(void) {return textOpt.textsize;}
340  TextOptions getTextOptions(void) { return textOpt; }
342  void setTextOptions(TextOptions opt) { textOpt = opt; }
343 
344  /* Draw text at specific coordinates */
346  void drawChar(uint16_t x, uint16_t y, char c, uint8_t s = 1);
348  void drawCharMem(uint16_t x, uint16_t y, const uint8_t* font_char, uint8_t s = 1);
350  void drawCharRAM(uint16_t x, uint16_t y, const uint8_t* font_data, uint8_t s = 1);
352  void drawString(uint16_t x, uint16_t y, const char* text, uint8_t s = 1);
353 
360  TextBounds computeMiddleBounds(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char* text);
361 
367  void drawStringMiddle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char* text);
368 
370  void printShortTime(Date date);
372  void printTime(Date date);
374  void printDate(Date date);
376  void printMem(const uint8_t* font_char);
378  void printPadding(int nrChars);
379 
381  void debugPrint(uint16_t x, uint16_t y, uint8_t size, const char* text, uint8_t padding = 0);
383  void debugPrint(uint16_t x, uint16_t y, uint8_t size, int value);
385  void debugPrint(uint16_t x, uint16_t y, uint8_t size, float value);
386 
397  size_t printNumber(unsigned long, uint8_t);
398  size_t printFloat(double, uint8_t);
399  size_t write(const uint8_t *buffer, size_t size);
400  size_t write(const char *str);
401  size_t write(uint8_t c);
402 
403  size_t print(const __FlashStringHelper *);
404  size_t print(const String &);
405  size_t print(const char[]);
406  size_t print(char);
407  size_t print(unsigned char, int = DEC);
408  size_t print(int, int = DEC);
409  size_t print(unsigned int, int = DEC);
410  size_t print(long, int = DEC);
411  size_t print(unsigned long, int = DEC);
412  size_t print(double, int = 2);
413 
414  size_t println(const __FlashStringHelper *);
415  size_t println(const String &s);
416  size_t println(const char[]);
417  size_t println(char);
418  size_t println(unsigned char, int = DEC);
419  size_t println(int, int = DEC);
420  size_t println(unsigned int, int = DEC);
421  size_t println(long, int = DEC);
422  size_t println(unsigned long, int = DEC);
423  size_t println(double, int = 2);
424  size_t println(void);
426 
427  /* Image drawing routines */
448  void drawImage(Stream &imageStream, int x, int y);
449  void drawImage(Stream &imageStream, int x, int y, float brightness);
450  void drawImage(Stream &imageStream, int x, int y, float cr, float cg, float cb);
451  void drawImage(Stream &imageStream, int x, int y, void (*color)(uint8_t*, uint8_t*, uint8_t*));
452  void drawImage(Stream &imageStream, int x, int y, const color_t *colorMapInput);
454  private:
455  void drawImageMain(Stream &imageStream, int x, int y, void (*color)(uint8_t*, uint8_t*, uint8_t*), const color_t *colorMapInput);
456  void drawCircleHelper(uint16_t x0, uint16_t y0, uint16_t r, uint8_t corner, color_t color);
457  void fillCircleHelper(uint16_t x0, uint16_t y0, uint16_t r, uint8_t corner, uint16_t delta, color_t color);
458 
459  uint8_t screenRot;
460  uint8_t wrapMode;
461  uint16_t _width, _height;
462  uint16_t _scroll;
463  Viewport _viewport;
464  void (*cgramFunc)(uint16_t*, uint16_t*);
465  void (*cgramFunc_inv)(uint16_t*, uint16_t*);
466 
467  // Text drawing
468  TextOptions textOpt;
469 
470  // Touchscreen input variables
471  bool touchInputLive, touchInput, touchInputSlider;
472  long touchInputLastStable;
473 
474  // Touchscreen API variables
475  PressPoint touchStart, touchLive, touchLast;
476  bool touchClicked;
477  bool sliderDown, sliderWasDown;
478  float sliderStart, sliderLive;
479 };
480 
482 extern PHN_Display display;
483 
486 #endif
uint8_t getScreenRotation(void)
Gets the screen rotation transform ranging [0..3].
Definition: PHNDisplay.cpp:133
void debugPrint(uint16_t x, uint16_t y, uint8_t size, const char *text, uint8_t padding=0)
Prints out text in a convenient short way.
Definition: PHNDisplay.cpp:968
Struct to hold the information for drawing text inside an area.
Definition: PHNDisplay.h:83
void goTo(uint16_t x, uint16_t y)
Sets drawn pixel position to [x,y] and a horizontal direction.
Definition: PHNDisplay.cpp:141
void setBacklight(int level)
Changes the brightness of the LCD LED backlight, level being 0 - 256.
Definition: PHNDisplay.cpp:83
const uint16_t getCursorX(void)
Gets the current text-drawing cursor x-coordinate.
Definition: PHNDisplay.h:311
Simplifies the use of the display with drawing, touch input and widgets .
Definition: PHNDisplay.h:149
void drawCharMem(uint16_t x, uint16_t y, const uint8_t *font_char, uint8_t s=1)
Draws character data stored in FLASH (8x5 size) at [x, y] of an optional size scaling specified...
Definition: PHNDisplay.cpp:896
void drawCharRAM(uint16_t x, uint16_t y, const uint8_t *font_data, uint8_t s=1)
Draws character data (8x5 size) at [x, y] of an optional size scaling specified.
Definition: PHNDisplay.cpp:903
void setCursorDown(uint16_t x)
Sets the current text-drawing cursor one newline down at the x-coordinate specified.
Definition: PHNDisplay.cpp:739
void setViewport(Viewport viewport)
Sets a viewport (rectangular area) to draw in.
Definition: PHNDisplay.cpp:198
struct TextBounds TextBounds
Struct to hold the information for drawing text inside an area.
Struct to hold ARGB 32-bit color information used in bitmaps.
Definition: PHNDisplay.h:122
bool isSliderTouchDown(void)
Gets whether the slider is touched and was not before.
Definition: PHNDisplay.cpp:565
void setScroll(int value)
Sets the absolute horizontal scrolling value.
Definition: PHNDisplay.cpp:764
Struct to hold years, months, days, hours, minutes and seconds for a given Date.
Definition: PHNDate.h:37
bool isWidescreen(void)
Gets whether the width is greater than the height, and the screen is a widescreen.
Definition: PHNDisplay.cpp:101
void setCursor(uint16_t x, uint16_t y)
Sets the current text-drawing cursor [x,y] coordinate.
Definition: PHNDisplay.cpp:743
void setTextOptions(TextOptions opt)
Sets all current text rendering options.
Definition: PHNDisplay.h:342
PHN_Display display
Global variable from which the display functions can be accessed.
Definition: PHNDisplay.cpp:60
void updateWidgets()
Updates only the widgets, assuming no touch. Use this when the ADC is used for something else...
Definition: PHNDisplay.cpp:624
void invalidate(void)
Invalidates all added widgets, forcing them to redraw upon the next update.
Definition: PHNDisplay.cpp:637
void drawVerticalLine(uint16_t x, uint16_t y, uint16_t length, color_t color)
Draws a straight line down starting at [x, y].
Definition: PHNDisplay.cpp:468
void fillTriangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, color_t color)
Fills in a triangle connecting the three points specified.
Definition: PHNDisplay.cpp:227
const uint16_t getCursorY(void)
Gets the current text-drawing cursor y-coordinate.
Definition: PHNDisplay.h:313
void updateTouch()
Updates only the touch input, use this instead of update() to save code if not using widgets...
Definition: PHNDisplay.cpp:644
void printPadding(int nrChars)
Pads the space up until some amount of characters with white spaces.
Definition: PHNDisplay.cpp:818
void fillCircle(uint16_t x, uint16_t y, uint16_t r, color_t color)
Fills a circle at [x, y] of radius [r].
Definition: PHNDisplay.cpp:314
void drawHorizontalLine(uint16_t x, uint16_t y, uint16_t length, color_t color)
Draws a straight line to the right starting at [x, y].
Definition: PHNDisplay.cpp:472
void drawCircle(uint16_t x, uint16_t y, uint16_t r, color_t color)
Draws a circle at [x, y] of radius [r].
Definition: PHNDisplay.cpp:365
void setTextSize(uint8_t s)
Sets the text size ranging [1..20].
Definition: PHNDisplay.cpp:749
void scroll(int offset)
Scrolls the screen horizontally by an offset.
Definition: PHNDisplay.h:324
void printTime(Date date)
Prints hours, minutes and seconds part of a date.
Definition: PHNDisplay.cpp:796
Struct to hold the header information of the Bitmap image format.
Definition: PHNDisplay.h:103
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, color_t color)
Draws a line from one point to another.
Definition: PHNDisplay.cpp:482
TextOptions getTextOptions(void)
Gets all current text rendering options.
Definition: PHNDisplay.h:340
void setWrapMode(uint8_t mode)
Sets the wrap-around mode when reaching screen/viewport borders.
Definition: PHNDisplay.cpp:137
bool isTouchChange(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Gets whether a touch change occurred for an area, such as entering/leaving/clicking.
Definition: PHNDisplay.cpp:613
bool isTouchUp(void)
Gets whether the screen was previously touched but now no more.
Definition: PHNDisplay.cpp:600
void drawString(uint16_t x, uint16_t y, const char *text, uint8_t s=1)
Draws a String of characters at [x, y] of an optional size specified.
Definition: PHNDisplay.cpp:876
void printMem(const uint8_t *font_char)
Prints a character stored in memory in 7x5 size format.
Definition: PHNDisplay.cpp:826
void drawPixel(uint16_t x, uint16_t y, color_t color)
Draws a single pixel to the screen.
Definition: PHNDisplay.cpp:548
Low-level utility functions for working with the display.
void setTextColor(color_t c)
Sets the text color to a color, with a transparent background.
Definition: PHNDisplay.cpp:753
color_t getTextBackground(void)
Gets the current text background color set.
Definition: PHNDisplay.h:334
bool isTouchDown(void)
Gets whether the screen was previously not touched but now is.
Definition: PHNDisplay.cpp:592
PHN_Display()
Is constructed globally, do not use (?), use 'display' global variable instead.
Definition: PHNDisplay.cpp:62
uint16_t width()
Gets the width of the display - height when screen is rotated 90/270 degrees.
Definition: PHNDisplay.cpp:93
void drawChar(uint16_t x, uint16_t y, char c, uint8_t s=1)
Draws a single character at [x, y] of an optional size specified.
Definition: PHNDisplay.cpp:892
void fillBorderRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t radius, color_t color, color_t borderColor)
Fills a rounded rectangle at [x, y] with dimensions [w, h], the outside set to a 1-pixel wide border...
Definition: PHNDisplay.cpp:463
void fillRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t radius, color_t color)
Fills a rounded rectangle at [x, y] with dimensions [w, h] with the rounded radius.
Definition: PHNDisplay.cpp:303
uint16_t color_t
Definition of the 16-bit 565 color type.
Definition: PHNDisplayHardware.h:97
uint16_t getScroll() const
Gets the absolute horizontal scrolling value.
Definition: PHNDisplay.h:322
void drawStringMiddle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char *text)
Draws a String of characters in the area [x, y, width, height].
Definition: PHNDisplay.cpp:869
void drawRoundRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t radius, color_t color)
Draws a rounded rectangle at [x, y] with dimensions [w, h] with the rounded radius.
Definition: PHNDisplay.cpp:288
Struct to hold the touch screen input information.
Definition: PHNDisplay.h:61
color_t getTextColor(void)
Gets the current text foreground color set.
Definition: PHNDisplay.h:336
uint32_t getViewportArea(void)
Gets the total amount of pixels the viewport area currently occupies.
Definition: PHNDisplay.cpp:214
Struct to hold the header information of the LCD image format.
Definition: PHNDisplay.h:93
bool isSliderTouchUp(void)
Gets whether the slider is no longer touched and was before.
Definition: PHNDisplay.cpp:568
Various utility functions for use all-around.
void drawStraightLine(uint16_t x, uint16_t y, uint16_t length, uint8_t direction, color_t color)
Draws a straight line starting at [x, y], moving into the direction.
Definition: PHNDisplay.cpp:476
PressPoint getTouchStart(void)
Gets the location and pressure of the last time the screen was touched down.
Definition: PHNDisplay.cpp:577
void resetViewport(void)
Resets the viewport to draw in the entire screen.
Definition: PHNDisplay.cpp:180
bool isTouchLeave(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Gets whether a particular area was previously touched but is now no more.
Definition: PHNDisplay.cpp:603
void setViewportRelative(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
Sets a viewport (rectangular area) to draw in.
Definition: PHNDisplay.cpp:184
void setScreenRotation(uint8_t rotation)
Gets or sets the screen rotation transform.
Definition: PHNDisplay.cpp:105
void drawLineAngle(int x, int y, int r1, int r2, float angle, color_t color)
Draws a line at an angle between two radius's around the center point [x, y].
Definition: PHNDisplay.cpp:537
void update()
Updates the touch input, then all widgets attached to the display.
Definition: PHNDisplay.cpp:619
bool isTouchClicked(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Gets whether a particular area was previously touched and was then released shortly to engage a click...
Definition: PHNDisplay.cpp:608
void printDate(Date date)
Prints the month and day of a date.
Definition: PHNDisplay.cpp:804
void fillRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, color_t color)
Fills a rectangle at [x, y] with dimensions [w, h].
Definition: PHNDisplay.cpp:434
void printShortTime(Date date)
Prints hours and minutes part of a date.
Definition: PHNDisplay.cpp:786
A container for storing multiple PHN_Widget instances.
Definition: PHNWidget.h:74
bool isTouched(void)
Gets whether the screen is touched down on.
Definition: PHNDisplay.cpp:585
Date-related functions.
Holds the PHN_Widget and PHN_WidgetContainer classes used for managing widgets.
void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, color_t color)
Draws a triangle connecting the three points specified.
Definition: PHNDisplay.cpp:219
void drawRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, color_t color)
Draws a rectangle at [x, y] with dimensions [w, h].
Definition: PHNDisplay.cpp:278
void fill(color_t color)
Fills the entire screen or viewport.
Definition: PHNDisplay.cpp:543
Struct to hold the screen text drawing options.
Definition: PHNDisplay.h:73
Struct to hold the viewport information.
Definition: PHNDisplay.h:55
void fillBorderCircle(uint16_t x, uint16_t y, uint16_t r, color_t color, color_t borderColor)
Fills a circle at [x, y] of radius [r] with a 1-pixel wide border.
Definition: PHNDisplay.cpp:320
uint8_t getTextSize(void)
Gets the current text size set.
Definition: PHNDisplay.h:338
uint16_t height()
Gets the height of the display - width when screen is rotated 90/270 degrees.
Definition: PHNDisplay.cpp:97
Manages the loading and saving of settings in EEPROM with the PHN_Settings struct.
void fillBorderRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, color_t color, color_t borderColor)
Fills a rectangle at [x, y] with dimensions [w, h], the outside set to a 1-pixel wide border...
Definition: PHNDisplay.cpp:457
bool isTouchEnter(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
Gets whether a particular area was previously not touched but now is.
Definition: PHNDisplay.cpp:595
void setSleeping(bool sleeping)
Put the LCD-screen to sleep or wake it up again for reducing power consumption.
Definition: PHNDisplay.cpp:79
bool isSliderTouched(void)
Gets whether the slider is touched.
Definition: PHNDisplay.cpp:562
Viewport getViewport(void)
Gets the current viewport that is applied.
Definition: PHNDisplay.cpp:210
PressPoint getTouch(void)
Gets the location and pressure of the current touch state.
Definition: PHNDisplay.cpp:574
TextBounds computeMiddleBounds(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const char *text)
Computes the bounds of a piece of text to fit it inside an area.
Definition: PHNDisplay.cpp:831
PressPoint getTouchLast(void)
Gets the location and pressure of the previous touch state.
Definition: PHNDisplay.cpp:581
float getSlider(void)
Gets the current slider value ranging [0..1].
Definition: PHNDisplay.cpp:555
float getSliderStart(void)
Gets the slider value ranging [0..1] obtained at the start of a press.
Definition: PHNDisplay.cpp:558