roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
roo_display::DisplayDevice Class Reference

Base class for display device drivers. More...

#include <device.h>

Inheritance diagram for roo_display::DisplayDevice:
[legend]
Collaboration diagram for roo_display::DisplayDevice:
[legend]

Public Member Functions

virtual ~DisplayDevice ()
 
virtual void init ()
 Initialize the display driver.
 
void setOrientation (Orientation orientation)
 Set the orientation of the display.
 
virtual void orientationUpdated ()
 Invoked when orientation() is updated.
 
Orientation orientation () const
 Return the current orientation of the display.
 
int16_t raw_width () const
 Return the width of the display in its native orientation.
 
int16_t raw_height () const
 Return the height of the display in its native orientation.
 
int16_t effective_width () const
 Return the display width in the current orientation.
 
int16_t effective_height () const
 Return the display height in the current orientation.
 
virtual void setBgColorHint (Color bgcolor)
 Provide a background color hint for source-over blending.
 
- Public Member Functions inherited from roo_display::DisplayOutput
virtual ~DisplayOutput ()
 
virtual void begin ()
 Enter a write transaction.
 
virtual void end ()
 Finalize the previously entered write transaction, flushing any pending writes.
 
virtual void flush ()
 Wait until pending asynchronous drawing operations complete.
 
void setAddress (const Box &bounds, BlendingMode blending_mode)
 Convenience overload for setAddress() using a Box.
 
virtual void setAddress (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, BlendingMode blending_mode)=0
 Set a rectangular window filled by subsequent calls to write().
 
virtual void write (Color *color, uint32_t pixel_count)=0
 Write pixels into the current address window.
 
virtual void fill (Color color, uint32_t pixel_count)
 Write pixel_count copies of the same color into the current address window.
 
virtual void writePixels (BlendingMode blending_mode, Color *color, int16_t *x, int16_t *y, uint16_t pixel_count)=0
 Draw the specified pixels (per-pixel colors). Invalidates the address window.
 
virtual void fillPixels (BlendingMode blending_mode, Color color, int16_t *x, int16_t *y, uint16_t pixel_count)=0
 Draw the specified pixels using the same color. Invalidates the address window.
 
virtual void writeRects (BlendingMode blending_mode, Color *color, int16_t *x0, int16_t *y0, int16_t *x1, int16_t *y1, uint16_t count)=0
 Draw the specified rectangles (per-rectangle colors). Invalidates the address window.
 
virtual void fillRects (BlendingMode blending_mode, Color color, int16_t *x0, int16_t *y0, int16_t *x1, int16_t *y1, uint16_t count)=0
 Draw the specified rectangles using the same color. Invalidates the address window.
 
void fillRect (BlendingMode blending_mode, const Box &rect, Color color)
 Fill a single rectangle. Invalidates the address window.
 
void fillRect (BlendingMode blending_mode, int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
 Fill a single rectangle. Invalidates the address window.
 
void fillRect (int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
 Fill a single rectangle using BlendingMode::kSource.
 
virtual const ColorFormatgetColorFormat () const =0
 Return the native color format used by this device for direct drawing.
 
virtual void drawDirectRect (const roo::byte *data, size_t row_width_bytes, int16_t src_x0, int16_t src_y0, int16_t src_x1, int16_t src_y1, int16_t dst_x0, int16_t dst_y0)
 Draw a rectangle represented in the device's native color format.
 
virtual void drawDirectRectAsync (const roo::byte *data, size_t row_width_bytes, int16_t src_x0, int16_t src_y0, int16_t src_x1, int16_t src_y1, int16_t dst_x0, int16_t dst_y0)
 Asynchronous variant of drawDirectRect().
 

Protected Member Functions

 DisplayDevice (int16_t raw_width, int16_t raw_height)
 
 DisplayDevice (Orientation orientation, int16_t raw_width, int16_t raw_height)
 

Detailed Description

Base class for display device drivers.

In addition to the drawing methods, exposes initialization and configuration APIs for the display.

The access pattern supports a notion of a transaction (which may, but does not have to, map to the underlying hardware transaction). The transaction begins with a call to begin() and ends with a call to end(). Calls to DisplayOutput methods are allowed only within the transaction. The driver may defer writes, but they must be flushed on end().

Definition at line 223 of file device.h.

Constructor & Destructor Documentation

◆ ~DisplayDevice()

virtual roo_display::DisplayDevice::~DisplayDevice ( )
inlinevirtual

Definition at line 225 of file device.h.

◆ DisplayDevice() [1/2]

roo_display::DisplayDevice::DisplayDevice ( int16_t  raw_width,
int16_t  raw_height 
)
inlineprotected

Definition at line 283 of file device.h.

◆ DisplayDevice() [2/2]

roo_display::DisplayDevice::DisplayDevice ( Orientation  orientation,
int16_t  raw_width,
int16_t  raw_height 
)
inlineprotected

Definition at line 286 of file device.h.

Member Function Documentation

◆ effective_height()

int16_t roo_display::DisplayDevice::effective_height ( ) const
inline

Return the display height in the current orientation.

Definition at line 270 of file device.h.

References roo_display::Orientation::isXYswapped(), orientation(), raw_height(), and raw_width().

Referenced by roo_display::TouchDisplay::getTouch(), and roo_display::Display::resetExtents().

◆ effective_width()

int16_t roo_display::DisplayDevice::effective_width ( ) const
inline

Return the display width in the current orientation.

Definition at line 265 of file device.h.

References roo_display::Orientation::isXYswapped(), orientation(), raw_height(), and raw_width().

Referenced by roo_display::TouchDisplay::getTouch(), and roo_display::Display::resetExtents().

◆ init()

virtual void roo_display::DisplayDevice::init ( )
inlinevirtual

Initialize the display driver.

Must be called once before any DisplayOutput methods are used. Can be called later to re-initialize the display to default settings. Must be called outside a transaction.

Reimplemented in roo_display::AddrWindowDevice< Target >, roo_display::AddrWindowDevice< pinLcdCs, pinLcdDc, -1 >, roo_display::BufferedAddrWindowDevice< Target >, and roo_display::BackgroundFillOptimizerDevice.

Definition at line 232 of file device.h.

Referenced by roo_display::Display::init(), and roo_display::BackgroundFillOptimizerDevice::init().

◆ orientation()

◆ orientationUpdated()

◆ raw_height()

int16_t roo_display::DisplayDevice::raw_height ( ) const
inline

Return the height of the display in its native orientation.

This value does not depend on the current orientation, and is stable even before init() is called.

Definition at line 262 of file device.h.

Referenced by roo_display::Display::area(), effective_height(), effective_width(), and roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::raster().

◆ raw_width()

◆ setBgColorHint()

virtual void roo_display::DisplayDevice::setBgColorHint ( Color  bgcolor)
inlinevirtual

Provide a background color hint for source-over blending.

Devices that support BlendingMode::kSourceOver should ignore this hint. Devices that do not support alpha blending (e.g. hardware can't read the framebuffer) should use this color as the assumed background for writes using BlendingMode::kSourceOver.

Reimplemented in roo_display::BackgroundFillOptimizerDevice, roo_display::AddrWindowDevice< Target >, and roo_display::AddrWindowDevice< pinLcdCs, pinLcdDc, -1 >.

Definition at line 280 of file device.h.

Referenced by roo_display::Display::setBackgroundColor(), and roo_display::BackgroundFillOptimizerDevice::setBgColorHint().

◆ setOrientation()

void roo_display::DisplayDevice::setOrientation ( Orientation  orientation)
inline

Set the orientation of the display.

Definition at line 235 of file device.h.

References orientation(), and orientationUpdated().

Referenced by roo_display::BackgroundFillOptimizerDevice::BackgroundFillOptimizerDevice().


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