109 #define LOG_DISPLAY(prefix, type, obj) \ 110 if ((obj) != nullptr) { \ 111 ESP_LOGCONFIG(TAG, prefix type); \ 112 ESP_LOGCONFIG(TAG, "%s Rotations: %d °", prefix, (obj)->rotation_); \ 113 ESP_LOGCONFIG(TAG, "%s Dimensions: %dpx x %dpx", prefix, (obj)->get_width(), (obj)->get_height()); \ 119 virtual void fill(
Color color);
128 void draw_pixel_at(
int x,
int y,
Color color = COLOR_ON);
131 void line(
int x1,
int y1,
int x2,
int y2,
Color color = COLOR_ON);
134 void horizontal_line(
int x,
int y,
int width,
Color color = COLOR_ON);
137 void vertical_line(
int x,
int y,
int height,
Color color = COLOR_ON);
141 void rectangle(
int x1,
int y1,
int width,
int height,
Color color = COLOR_ON);
144 void filled_rectangle(
int x1,
int y1,
int width,
int height,
Color color = COLOR_ON);
147 void circle(
int center_x,
int center_xy,
int radius,
Color color = COLOR_ON);
150 void filled_circle(
int center_x,
int center_y,
int radius,
Color color = COLOR_ON);
171 void print(
int x,
int y,
Font *font,
Color color,
const char *text);
181 void print(
int x,
int y,
Font *font,
TextAlign align,
const char *text);
190 void print(
int x,
int y,
Font *font,
const char *text);
202 void printf(
int x,
int y,
Font *font,
Color color,
TextAlign align,
const char *format, ...)
214 void printf(
int x,
int y,
Font *font,
Color color,
const char *format, ...)
__attribute__((format(printf, 6, 7)));
235 void printf(
int x,
int y,
Font *font,
const char *format, ...)
__attribute__((format(printf, 5, 6)));
295 void image(
int x,
int y,
Image *image,
Color color_on = COLOR_ON,
Color color_off = COLOR_OFF);
344 void get_text_bounds(
int x,
int y,
const char *text,
Font *font,
TextAlign align,
int *x1,
int *y1,
int *width,
351 void show_next_page();
352 void show_prev_page();
354 void set_pages(std::vector<DisplayPage *> pages);
364 void set_auto_clear(
bool auto_clear_enabled) { this->auto_clear_enabled_ = auto_clear_enabled; }
366 virtual int get_height_internal() = 0;
367 virtual int get_width_internal() = 0;
376 void vprintf_(
int x,
int y,
Font *font,
Color color,
TextAlign align,
const char *format, va_list arg);
378 virtual void draw_absolute_pixel_internal(
int x,
int y,
Color color) = 0;
380 void init_internal_(uint32_t buffer_length);
384 uint8_t *buffer_{
nullptr};
390 bool auto_clear_enabled_{
true};
424 bool get_pixel(
int x,
int y)
const;
426 const char *get_char()
const;
428 bool compare_to(
const char *str)
const;
430 int match_length(
const char *str)
const;
432 void scan_area(
int *x1,
int *y1,
int *width,
int *height)
const;
449 Font(
const GlyphData *data,
int data_nr,
int baseline,
int bottom);
451 int match_next_glyph(
const char *str,
int *match_length);
453 void measure(
const char *str,
int *width,
int *x_offset,
int *baseline,
int *height);
455 const std::vector<Glyph> &get_glyphs()
const;
466 virtual bool get_pixel(
int x,
int y)
const;
467 virtual Color get_color_pixel(
int x,
int y)
const;
468 virtual Color get_rgb565_pixel(
int x,
int y)
const;
469 virtual Color get_grayscale_pixel(
int x,
int y)
const;
470 int get_width()
const;
471 int get_height()
const;
483 Animation(
const uint8_t *data_start,
int width,
int height, uint32_t animation_frame_count,
ImageType type);
484 bool get_pixel(
int x,
int y)
const override;
485 Color get_color_pixel(
int x,
int y)
const override;
486 Color get_rgb565_pixel(
int x,
int y)
const override;
487 Color get_grayscale_pixel(
int x,
int y)
const override;
489 int get_animation_frame_count()
const;
490 int get_current_frame()
const;
503 void play(Ts... x)
override {
504 auto *page = this->page_.value(x...);
505 if (page !=
nullptr) {
515 void play(Ts... x)
override { this->buffer_->show_next_page(); }
524 void play(Ts... x)
override { this->buffer_->show_prev_page(); }
534 bool check(Ts... x)
override {
return this->parent_->get_active_page() == this->page_; }
void play(Ts... x) override
DisplayIsDisplayingPageCondition(DisplayBuffer *parent)
void set_auto_clear(bool auto_clear_enabled)
DisplayPageShowPrevAction(DisplayBuffer *buffer)
void set_page(DisplayPage *page)
void set_to(DisplayPage *p)
const Color COLOR_OFF(0, 0, 0, 0)
Turn the pixel OFF.
DisplayRotation get_rotation() const
const uint8_t * data_start_
Glyph(const GlyphData *data)
int animation_frame_count_
DisplayPageShowNextAction(DisplayBuffer *buffer)
TextAlign
TextAlign is used to tell the display class how to position a piece of text.
A more user-friendly version of struct tm from time.h.
Base class for all automation conditions.
const DisplayPage * get_active_page() const
void set_from(DisplayPage *p)
std::vector< Glyph > glyphs_
void play(Ts... x) override
std::vector< DisplayOnPageChangeTrigger * > on_page_change_triggers_
enum esphome::EntityCategory __attribute__
bool check(Ts... x) override
const Color COLOR_ON(255, 255, 255, 255)
Turn the pixel ON.
TEMPLATABLE_VALUE(DisplayPage *, page) void play(Ts... x) override
const GlyphData * glyph_data_
std::function< void(DisplayBuffer &)> display_writer_t
DisplayOnPageChangeTrigger(DisplayBuffer *parent)
void add_on_page_change_trigger(DisplayOnPageChangeTrigger *t)