esphome/esphome/components/display/display_buffer.h

35 lines
809 B
C++

#pragma once
#include <cstdarg>
#include <vector>
#include "display.h"
#include "display_color_utils.h"
#include "esphome/core/component.h"
#include "esphome/core/defines.h"
namespace esphome {
namespace display {
class DisplayBuffer : public Display {
public:
/// Get the width of the image in pixels with rotation applied.
int get_width() override;
/// Get the height of the image in pixels with rotation applied.
int get_height() override;
/// Set a single pixel at the specified coordinates to the given color.
void draw_pixel_at(int x, int y, Color color) override;
protected:
virtual void draw_absolute_pixel_internal(int x, int y, Color color) = 0;
void init_internal_(uint32_t buffer_length);
uint8_t *buffer_{nullptr};
};
} // namespace display
} // namespace esphome