22#ifdef USE_GRAPHICAL_DISPLAY_MENU
141#define PI 3.1415926535897932384626433832795
179class DisplayOnPageChangeTrigger;
183#define LOG_DISPLAY(prefix, type, obj) \
184 if ((obj) != nullptr) { \
185 ESP_LOGCONFIG(TAG, prefix type); \
186 ESP_LOGCONFIG(TAG, "%s Rotations: %d °", prefix, (obj)->rotation_); \
187 ESP_LOGCONFIG(TAG, "%s Dimensions: %dpx x %dpx", prefix, (obj)->get_width(), (obj)->get_height()); \
205 virtual void measure(
const char *str,
int *width,
int *x_offset,
int *baseline,
int *height) = 0;
251 ColorBitness bitness,
bool big_endian,
int x_offset,
int y_offset,
int x_pad);
256 this->
draw_pixels_at(x_start, y_start, w,
h, ptr, order, bitness, big_endian, 0, 0, 0);
557#ifdef USE_GRAPHICAL_DISPLAY_MENU
590 void set_pages(std::vector<DisplayPage *> pages);
654 bool clip(
int x,
int y);
660 bool clamp_x_(
int x,
int w,
int &min_x,
int &max_x);
661 bool clamp_y_(
int y,
int h,
int &min_y,
int &max_y);
712 void play(Ts...
x)
override {
713 auto *page = this->page_.value(
x...);
714 if (page !=
nullptr) {
virtual void play(Ts... x)=0
Base class for all automation conditions.
This class simplifies creating components that periodically check a state.
virtual void measure(const char *str, int *width, int *x_offset, int *baseline, int *height)=0
virtual void print(int x, int y, Display *display, Color color, const char *text, Color background)=0
virtual int get_height() const =0
virtual int get_width() const =0
virtual void draw(int x, int y, Display *display, Color color_on, Color color_off)=0
void show_page(DisplayPage *page)
bool clip(int x, int y)
Check if pixel is within region of display.
void get_regular_polygon_vertex(int vertex_id, int *vertex_x, int *vertex_y, int center_x, int center_y, int radius, int edges, RegularPolygonVariation variation=VARIATION_POINTY_TOP, float rotation_degrees=ROTATION_0_DEGREES)
Get the specified vertex (x,y) coordinates for the regular polygon inscribed in the circle centered o...
void clear()
Clear the entire screen by filling it with OFF pixels.
void end_clipping()
Reset the invalidation region.
void start_clipping(Rect rect)
Set the clipping rectangle for further drawing.
void shrink_clipping(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom)
void set_pages(std::vector< DisplayPage * > pages)
const DisplayPage * get_active_page() const
void vprintf_(int x, int y, BaseFont *font, Color color, Color background, TextAlign align, const char *format, va_list arg)
int get_native_width()
Get the native (original) width of the display in pixels.
virtual int get_height()
Get the calculated height of the display in pixels with rotation applied.
virtual void fill(Color color)
Fill the entire screen with the given color.
void horizontal_line(int x, int y, int width, Color color=COLOR_ON)
Draw a horizontal line from the point [x,y] to [x+width,y] with the given color.
void sort_triangle_points_by_y_(int *x1, int *y1, int *x2, int *y2, int *x3, int *y3)
void add_on_page_change_trigger(DisplayOnPageChangeTrigger *t)
virtual int get_width()
Get the calculated width of the display in pixels with rotation applied.
void circle(int center_x, int center_xy, int radius, Color color=COLOR_ON)
Draw the outline of a circle centered around [center_x,center_y] with the radius radius with the give...
void filled_triangle(int x1, int y1, int x2, int y2, int x3, int y3, Color color=COLOR_ON)
Fill a triangle contained between the points [x1,y1], [x2,y2] and [x3,y3] with the given color.
void set_rotation(DisplayRotation rotation)
Internal method to set the display rotation with.
void filled_regular_polygon(int x, int y, int radius, int edges, RegularPolygonVariation variation=VARIATION_POINTY_TOP, float rotation_degrees=ROTATION_0_DEGREES, Color color=COLOR_ON)
Fill a regular polygon inscribed in the circle centered on [x,y] with the given radius and color.
virtual void draw_pixel_at(int x, int y, Color color)=0
Set a single pixel at the specified coordinates to the given color.
bool clamp_x_(int x, int w, int &min_x, int &max_x)
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorOrder order, ColorBitness bitness, bool big_endian)
Convenience overload for base case where the pixels are packed into the buffer with no gaps (e....
void line(int x1, int y1, int x2, int y2, Color color=COLOR_ON)
Draw a straight line from the point [x1,y1] to [x2,y2] with the given color.
bool clamp_y_(int y, int h, int &min_y, int &max_y)
void filled_gauge(int center_x, int center_y, int radius1, int radius2, int progress, Color color=COLOR_ON)
Fill a half-ring "gauge" centered around [center_x,center_y] between two circles with the radius1 and...
virtual DisplayType get_display_type()=0
Get the type of display that the buffer corresponds to.
void legend(int x, int y, graph::Graph *graph, Color color_on=COLOR_ON)
Draw the legend for graph with the top-left corner at [x,y] to the screen.
void start_clipping(int16_t left, int16_t top, int16_t right, int16_t bottom)
DisplayRotation get_rotation() const
void rectangle(int x1, int y1, int width, int height, Color color=COLOR_ON)
Draw the outline of a rectangle with the top left point at [x1,y1] and the bottom right point at [x1+...
virtual int get_width_internal()=0
DisplayPage * previous_page_
void filled_circle(int center_x, int center_y, int radius, Color color=COLOR_ON)
Fill a circle centered around [center_x,center_y] with the radius radius with the given color.
void void void void void void strftime(int x, int y, BaseFont *font, Color color, Color background, TextAlign align, const char *format, ESPTime time) __attribute__((format(strftime
Evaluate the strftime-format format and print the result with the anchor point at [x,...
void triangle(int x1, int y1, int x2, int y2, int x3, int y3, Color color=COLOR_ON)
Draw the outline of a triangle contained between the points [x1,y1], [x2,y2] and [x3,...
void printf(int x, int y, BaseFont *font, Color color, Color background, TextAlign align, const char *format,...) __attribute__((format(printf
Evaluate the printf-format format and print the result with the anchor point at [x,...
void set_writer(display_writer_t &&writer)
Internal method to set the display writer lambda.
void draw_pixel_at(int x, int y)
Set a single pixel at the specified coordinates to default color.
void vertical_line(int x, int y, int height, Color color=COLOR_ON)
Draw a vertical line from the point [x,y] to [x,y+width] with the given color.
int get_native_height()
Get the native (original) height of the display in pixels.
virtual int get_height_internal()=0
optional< display_writer_t > writer_
Rect get_clipping() const
Get the current the clipping rectangle.
void filled_ring(int center_x, int center_y, int radius1, int radius2, Color color=COLOR_ON)
Fill a ring centered around [center_x,center_y] between two circles with the radius1 and radius2 with...
void extend_clipping(Rect rect)
Add a rectangular region to the invalidation region.
void menu(int x, int y, graphical_display_menu::GraphicalDisplayMenu *menu, int width, int height)
void line_at_angle(int x, int y, int angle, int length, Color color=COLOR_ON)
Draw a straight line at the given angle based on the origin [x, y] for a specified length with the gi...
void get_text_bounds(int x, int y, const char *text, BaseFont *font, TextAlign align, int *x1, int *y1, int *width, int *height)
Get the text bounds of the given string.
void set_auto_clear(bool auto_clear_enabled)
DisplayRotation rotation_
std::vector< DisplayOnPageChangeTrigger * > on_page_change_triggers_
virtual void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorOrder order, ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad)
Given an array of pixels encoded in the nominated format, draw these into the display's buffer.
void regular_polygon(int x, int y, int radius, int edges, RegularPolygonVariation variation=VARIATION_POINTY_TOP, float rotation_degrees=ROTATION_0_DEGREES, Color color=COLOR_ON, RegularPolygonDrawing drawing=DRAWING_OUTLINE)
Draw the outline of a regular polygon inscribed in the circle centered on [x,y] with the given radius...
void filled_flat_side_triangle_(int x1, int y1, int x2, int y2, int x3, int y3, Color color)
This method fills a triangle using only integer variables by using a modified bresenham algorithm.
void extend_clipping(int16_t left, int16_t top, int16_t right, int16_t bottom)
void shrink_clipping(Rect rect)
substract a rectangular region to the invalidation region
void filled_rectangle(int x1, int y1, int width, int height, Color color=COLOR_ON)
Fill a rectangle with the top left point at [x1,y1] and the bottom right point at [x1+width,...
std::vector< Rect > clipping_rectangle_
void set_page(DisplayPage *page)
bool check(Ts... x) override
DisplayIsDisplayingPageCondition(Display *parent)
void set_from(DisplayPage *p)
void process(DisplayPage *from, DisplayPage *to)
DisplayOnPageChangeTrigger(Display *parent)
void set_to(DisplayPage *p)
void set_next(DisplayPage *next)
const display_writer_t & get_writer() const
void set_parent(Display *parent)
DisplayPage(display_writer_t writer)
void set_prev(DisplayPage *prev)
TEMPLATABLE_VALUE(DisplayPage *, page) void play(Ts... x) override
DisplayPageShowNextAction(Display *buffer)
void play(Ts... x) override
DisplayPageShowPrevAction(Display *buffer)
void play(Ts... x) override
struct @67::@68 __attribute__
@ DISPLAY_ROTATION_0_DEGREES
@ DISPLAY_ROTATION_270_DEGREES
@ DISPLAY_ROTATION_180_DEGREES
@ DISPLAY_ROTATION_90_DEGREES
const Color COLOR_ON(255, 255, 255, 255)
Turn the pixel ON.
const int EDGES_PENTADECAGON
const int EDGES_HEXADECAGON
const int EDGES_DODECAGON
const float ROTATION_45_DEGREES
const LogString * text_align_to_string(TextAlign textalign)
ImageAlign
ImageAlign is used to tell the display class how to position a image.
const int EDGES_QUADRILATERAL
const int EDGES_TETRADECAGON
const float ROTATION_270_DEGREES
const float ROTATION_180_DEGREES
std::function< void(Display &)> display_writer_t
const int EDGES_HENDECAGON
const int EDGES_TRIDECAGON
TextAlign
TextAlign is used to tell the display class how to position a piece of text.
const float ROTATION_90_DEGREES
const Color COLOR_OFF(0, 0, 0, 0)
Turn the pixel OFF.
const float ROTATION_0_DEGREES
Providing packet encoding functions for exchanging data with a remote host.
A more user-friendly version of struct tm from time.h.