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

Writer that ensures front-most pixels are written first. More...

#include <front_to_back_writer.h>

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

Public Member Functions

 FrontToBackWriter (DisplayOutput &output, Box bounds)
 Construct a front-to-back writer for a given bounds rectangle.
 
void setAddress (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, BlendingMode mode) override
 Set a rectangular window filled by subsequent calls to write().
 
void write (Color *color, uint32_t pixel_count) override
 Write pixels into the current address window.
 
void fill (Color color, uint32_t pixel_count) override
 Write pixel_count copies of the same color into the current address window.
 
void writeRects (BlendingMode mode, Color *color, int16_t *x0, int16_t *y0, int16_t *x1, int16_t *y1, uint16_t count) override
 Draw the specified rectangles (per-rectangle colors). Invalidates the address window.
 
void fillRects (BlendingMode mode, Color color, int16_t *x0, int16_t *y0, int16_t *x1, int16_t *y1, uint16_t count) override
 Draw the specified rectangles using the same color. Invalidates the address window.
 
void writePixels (BlendingMode mode, Color *color, int16_t *x, int16_t *y, uint16_t pixel_count) override
 Draw the specified pixels (per-pixel colors). Invalidates the address window.
 
void fillPixels (BlendingMode mode, Color color, int16_t *x, int16_t *y, uint16_t pixel_count) override
 Draw the specified pixels using the same color. Invalidates the address window.
 
const ColorFormatgetColorFormat () const override
 Return the native color format used by this device for direct drawing.
 
- 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.
 
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 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().
 

Detailed Description

Writer that ensures front-most pixels are written first.

Uses an offscreen mask to avoid overwriting already-drawn pixels.

Definition at line 14 of file front_to_back_writer.h.

Constructor & Destructor Documentation

◆ FrontToBackWriter()

roo_display::FrontToBackWriter::FrontToBackWriter ( DisplayOutput output,
Box  bounds 
)
inline

Construct a front-to-back writer for a given bounds rectangle.

The caller must guarantee bounds are within the output area and no writes go out of bounds.

Definition at line 20 of file front_to_back_writer.h.

References color.

Member Function Documentation

◆ fill()

void roo_display::FrontToBackWriter::fill ( Color  color,
uint32_t  pixel_count 
)
inlineoverridevirtual

Write pixel_count copies of the same color into the current address window.

The same preconditions as write() apply: the address must be set via setAddress() and not invalidated by any of the write* / fill* methods. Otherwise, the behavior is undefined.

Default implementation falls back to chunked write(). Drivers and filters can override this for a more efficient single-color path.

Reimplemented from roo_display::DisplayOutput.

Definition at line 39 of file front_to_back_writer.h.

References roo_display::color::Black, color, roo_display::DisplayOutput::fill(), roo_display::ClipMaskFilter::fill(), and roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output().

◆ fillPixels()

void roo_display::FrontToBackWriter::fillPixels ( BlendingMode  blending_mode,
Color  color,
int16_t x,
int16_t y,
uint16_t  pixel_count 
)
inlineoverridevirtual

Draw the specified pixels using the same color. Invalidates the address window.

Parameters
blending_modeBlending mode used for drawing.
colorThe color to use for all pixels.
xPointer to x-coordinates for each pixel.
yPointer to y-coordinates for each pixel.
pixel_countNumber of pixels.

Implements roo_display::DisplayOutput.

Definition at line 98 of file front_to_back_writer.h.

References roo_display::color::Black, color, roo_display::Box::contains(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::extents(), roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::fillPixels(), roo_display::ClipMaskFilter::fillPixels(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output(), roo_display::Box::xMin(), and roo_display::Box::yMin().

◆ fillRects()

void roo_display::FrontToBackWriter::fillRects ( BlendingMode  blending_mode,
Color  color,
int16_t x0,
int16_t y0,
int16_t x1,
int16_t y1,
uint16_t  count 
)
inlineoverridevirtual

Draw the specified rectangles using the same color. Invalidates the address window.

Parameters
blending_modeBlending mode used for drawing.
colorThe color to use for all rectangles.
x0Pointer to left coordinates for each rectangle.
y0Pointer to top coordinates for each rectangle.
x1Pointer to right coordinates for each rectangle.
y1Pointer to bottom coordinates for each rectangle.
countNumber of rectangles.

Implements roo_display::DisplayOutput.

Definition at line 60 of file front_to_back_writer.h.

References roo_display::color::Black, color, roo_display::Box::empty(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::extents(), roo_display::DisplayOutput::fillRect(), roo_display::Box::Intersect(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output(), roo_display::Box::translate(), roo_display::Box::xMin(), and roo_display::Box::yMin().

◆ getColorFormat()

const ColorFormat & roo_display::FrontToBackWriter::getColorFormat ( ) const
inlineoverridevirtual

Return the native color format used by this device for direct drawing.

Implements roo_display::DisplayOutput.

Definition at line 120 of file front_to_back_writer.h.

◆ setAddress()

void roo_display::FrontToBackWriter::setAddress ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1,
BlendingMode  blending_mode 
)
inlineoverridevirtual

Set a rectangular window filled by subsequent calls to write().

Parameters
x0Left coordinate (inclusive).
y0Top coordinate (inclusive).
x1Right coordinate (inclusive).
y1Bottom coordinate (inclusive).
blending_modeBlending mode for subsequent writes.

Implements roo_display::DisplayOutput.

Definition at line 26 of file front_to_back_writer.h.

References roo_display::ClipMask::bounds(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output(), roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::setAddress(), roo_display::ClipMaskFilter::setAddress(), roo_display::Box::xMin(), and roo_display::Box::yMin().

◆ write()

void roo_display::FrontToBackWriter::write ( Color color,
uint32_t  pixel_count 
)
inlineoverridevirtual

Write pixels into the current address window.

The address must be set via setAddress() and not invalidated by any of the write* / fill* methods. Otherwise, the behavior is undefined.

Parameters
colorPointer to source pixels.
pixel_countNumber of pixels to write.

Implements roo_display::DisplayOutput.

Definition at line 34 of file front_to_back_writer.h.

References roo_display::color::Black, color, roo_display::DisplayOutput::fill(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output(), and roo_display::ClipMaskFilter::write().

◆ writePixels()

void roo_display::FrontToBackWriter::writePixels ( BlendingMode  blending_mode,
Color color,
int16_t x,
int16_t y,
uint16_t  pixel_count 
)
inlineoverridevirtual

Draw the specified pixels (per-pixel colors). Invalidates the address window.

Parameters
blending_modeBlending mode used for drawing.
colorPointer to colors for each pixel.
xPointer to x-coordinates for each pixel.
yPointer to y-coordinates for each pixel.
pixel_countNumber of pixels.

Implements roo_display::DisplayOutput.

Definition at line 76 of file front_to_back_writer.h.

References roo_display::color::Black, color, roo_display::Box::contains(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::extents(), roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::fillPixels(), roo_display::ClipMaskFilter::fillPixels(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output(), roo_display::Box::xMin(), and roo_display::Box::yMin().

◆ writeRects()

void roo_display::FrontToBackWriter::writeRects ( BlendingMode  blending_mode,
Color color,
int16_t x0,
int16_t y0,
int16_t x1,
int16_t y1,
uint16_t  count 
)
inlineoverridevirtual

Draw the specified rectangles (per-rectangle colors). Invalidates the address window.

Parameters
blending_modeBlending mode used for drawing.
colorPointer to colors for each rectangle.
x0Pointer to left coordinates for each rectangle.
y0Pointer to top coordinates for each rectangle.
x1Pointer to right coordinates for each rectangle.
y1Pointer to bottom coordinates for each rectangle.
countNumber of rectangles.

Implements roo_display::DisplayOutput.

Definition at line 44 of file front_to_back_writer.h.

References roo_display::color::Black, color, roo_display::Box::empty(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::extents(), roo_display::DisplayOutput::fillRect(), roo_display::Box::Intersect(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::output(), roo_display::Box::translate(), roo_display::Box::xMin(), and roo_display::Box::yMin().


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