ESPHome  2023.11.6
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::display::DisplayBuffer Class Referenceabstract

#include <display_buffer.h>

Inheritance diagram for esphome::display::DisplayBuffer:
esphome::display::Display esphome::addressable_light::AddressableLightDisplay esphome::ili9xxx::ILI9XXXDisplay esphome::inkplate6::Inkplate6 esphome::max7219digit::MAX7219Component esphome::pcd8544::PCD8544 esphome::ssd1306_base::SSD1306 esphome::ssd1322_base::SSD1322 esphome::ssd1325_base::SSD1325 esphome::ssd1327_base::SSD1327 esphome::ssd1331_base::SSD1331 esphome::ssd1351_base::SSD1351 esphome::st7735::ST7735 esphome::st7789v::ST7789V esphome::st7920::ST7920 esphome::waveshare_epaper::WaveshareEPaper

Public Member Functions

int get_width () override
 Get the width of the image in pixels with rotation applied. More...
 
int get_height () override
 Get the height of the image in pixels with rotation applied. More...
 
void draw_pixel_at (int x, int y, Color color) override
 Set a single pixel at the specified coordinates to the given color. More...
 
virtual int get_height_internal ()=0
 
virtual int get_width_internal ()=0
 
- Public Member Functions inherited from esphome::display::Display
virtual void fill (Color color)
 Fill the entire screen with the given color. More...
 
void clear ()
 Clear the entire screen by filling it with OFF pixels. More...
 
void draw_pixel_at (int x, int y)
 Set a single pixel at the specified coordinates to default color. More...
 
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. More...
 
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. More...
 
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. More...
 
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+width,y1+height]. More...
 
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,y1+height]. More...
 
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 given color. More...
 
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. More...
 
void print (int x, int y, BaseFont *font, Color color, TextAlign align, const char *text)
 Print text with the anchor point at [x,y] with font. More...
 
void print (int x, int y, BaseFont *font, Color color, const char *text)
 Print text with the top left at [x,y] with font. More...
 
void print (int x, int y, BaseFont *font, TextAlign align, const char *text)
 Print text with the anchor point at [x,y] with font. More...
 
void print (int x, int y, BaseFont *font, const char *text)
 Print text with the top left at [x,y] with font. More...
 
void printf (int x, int y, BaseFont *font, Color color, TextAlign align, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the anchor point at [x,y] with font. More...
 
void void printf (int x, int y, BaseFont *font, Color color, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the top left at [x,y] with font. More...
 
void void void printf (int x, int y, BaseFont *font, TextAlign align, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the anchor point at [x,y] with font. More...
 
void void void void printf (int x, int y, BaseFont *font, const char *format,...) __attribute__((format(printf
 Evaluate the printf-format format and print the result with the top left at [x,y] with font. More...
 
void void void void void strftime (int x, int y, BaseFont *font, Color color, 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,y] with font. More...
 
void void void void void void strftime (int x, int y, BaseFont *font, Color color, const char *format, ESPTime time) __attribute__((format(strftime
 Evaluate the strftime-format format and print the result with the top left at [x,y] with font. More...
 
void void void void void void void strftime (int x, int y, BaseFont *font, 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,y] with font. More...
 
void void void void void void void void strftime (int x, int y, BaseFont *font, const char *format, ESPTime time) __attribute__((format(strftime
 Evaluate the strftime-format format and print the result with the top left at [x,y] with font. More...
 
void void void void void void void void void image (int x, int y, BaseImage *image, Color color_on=COLOR_ON, Color color_off=COLOR_OFF)
 Draw the image with the top-left corner at [x,y] to the screen. More...
 
void image (int x, int y, BaseImage *image, ImageAlign align, Color color_on=COLOR_ON, Color color_off=COLOR_OFF)
 Draw the image at [x,y] to the screen. More...
 
void graph (int x, int y, graph::Graph *graph, Color color_on=COLOR_ON)
 Draw the graph with the top-left corner at [x,y] to the screen. More...
 
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. More...
 
void qr_code (int x, int y, qr_code::QrCode *qr_code, Color color_on=COLOR_ON, int scale=1)
 Draw the qr_code with the top-left corner at [x,y] to the screen. More...
 
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. More...
 
void set_writer (display_writer_t &&writer)
 Internal method to set the display writer lambda. More...
 
void show_page (DisplayPage *page)
 
void show_next_page ()
 
void show_prev_page ()
 
void set_pages (std::vector< DisplayPage *> pages)
 
const DisplayPageget_active_page () const
 
void add_on_page_change_trigger (DisplayOnPageChangeTrigger *t)
 
void set_rotation (DisplayRotation rotation)
 Internal method to set the display rotation with. More...
 
void set_auto_clear (bool auto_clear_enabled)
 
DisplayRotation get_rotation () const
 
virtual DisplayType get_display_type ()=0
 Get the type of display that the buffer corresponds to. More...
 
void start_clipping (Rect rect)
 Set the clipping rectangle for further drawing. More...
 
void start_clipping (int16_t left, int16_t top, int16_t right, int16_t bottom)
 
void extend_clipping (Rect rect)
 Add a rectangular region to the invalidation region. More...
 
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 More...
 
void shrink_clipping (uint16_t left, uint16_t top, uint16_t right, uint16_t bottom)
 
void end_clipping ()
 Reset the invalidation region. More...
 
Rect get_clipping () const
 Get the current the clipping rectangle. More...
 
bool is_clipping () const
 
bool clip (int x, int y)
 Check if pixel is within region of display. More...
 

Protected Member Functions

virtual void draw_absolute_pixel_internal (int x, int y, Color color)=0
 
void init_internal_ (uint32_t buffer_length)
 
- Protected Member Functions inherited from esphome::display::Display
bool clamp_x_ (int x, int w, int &min_x, int &max_x)
 
bool clamp_y_ (int y, int h, int &min_y, int &max_y)
 
void vprintf_ (int x, int y, BaseFont *font, Color color, TextAlign align, const char *format, va_list arg)
 
void do_update_ ()
 
void clear_clipping_ ()
 

Protected Attributes

uint8_t * buffer_ {nullptr}
 
- Protected Attributes inherited from esphome::display::Display
DisplayRotation rotation_ {DISPLAY_ROTATION_0_DEGREES}
 
optional< display_writer_twriter_ {}
 
DisplayPagepage_ {nullptr}
 
DisplayPageprevious_page_ {nullptr}
 
std::vector< DisplayOnPageChangeTrigger * > on_page_change_triggers_
 
bool auto_clear_enabled_ {true}
 
std::vector< Rectclipping_rectangle_
 

Detailed Description

Definition at line 15 of file display_buffer.h.

Member Function Documentation

◆ draw_absolute_pixel_internal()

virtual void esphome::display::DisplayBuffer::draw_absolute_pixel_internal ( int  x,
int  y,
Color  color 
)
protectedpure virtual

◆ draw_pixel_at()

void HOT esphome::display::DisplayBuffer::draw_pixel_at ( int  x,
int  y,
Color  color 
)
overridevirtual

Set a single pixel at the specified coordinates to the given color.

Implements esphome::display::Display.

Definition at line 47 of file display_buffer.cpp.

◆ get_height()

int esphome::display::DisplayBuffer::get_height ( )
overridevirtual

Get the height of the image in pixels with rotation applied.

Implements esphome::display::Display.

Definition at line 35 of file display_buffer.cpp.

◆ get_height_internal()

virtual int esphome::display::DisplayBuffer::get_height_internal ( )
pure virtual

◆ get_width()

int esphome::display::DisplayBuffer::get_width ( )
overridevirtual

Get the width of the image in pixels with rotation applied.

Implements esphome::display::Display.

Definition at line 23 of file display_buffer.cpp.

◆ get_width_internal()

virtual int esphome::display::DisplayBuffer::get_width_internal ( )
pure virtual

◆ init_internal_()

void esphome::display::DisplayBuffer::init_internal_ ( uint32_t  buffer_length)
protected

Definition at line 13 of file display_buffer.cpp.

Field Documentation

◆ buffer_

uint8_t* esphome::display::DisplayBuffer::buffer_ {nullptr}
protected

Definition at line 33 of file display_buffer.h.


The documentation for this class was generated from the following files: