roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
roo_display::BlendingFilter< Blender > Class Template Reference

Filtering device that blends with a rasterizable image. More...

#include <blender.h>

Inheritance diagram for roo_display::BlendingFilter< Blender >:
[legend]
Collaboration diagram for roo_display::BlendingFilter< Blender >:
[legend]

Public Member Functions

 BlendingFilter (DisplayOutput &output, const Rasterizable *raster, Color bgcolor=color::Transparent)
 Create a blending filter with default blender and no offset.
 
 BlendingFilter (DisplayOutput &output, const Rasterizable *raster, int16_t dx, int16_t dy, Color bgcolor=color::Transparent)
 Create a blending filter with an offset.
 
 BlendingFilter (DisplayOutput &output, Blender blender, const Rasterizable *raster, Color bgcolor=color::Transparent)
 Create a blending filter with a custom blender.
 
 BlendingFilter (DisplayOutput &output, Blender blender, const Rasterizable *raster, int16_t dx, int16_t dy, Color bgcolor=color::Transparent)
 Create a blending filter with a custom blender and offset.
 
virtual ~BlendingFilter ()
 
void setOutput (DisplayOutput &output)
 Replace the underlying output.
 
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.
 
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) override
 Draw a rectangle represented in the device's native color format.
 
- 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 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

template<typename Blender>
class roo_display::BlendingFilter< Blender >

Filtering device that blends with a rasterizable image.

The Blender template matches BlendOp:

struct T {
Color operator()(Color dst, Color src) const;
};
ARGB8888 color stored as a 32-bit unsigned integer.
Definition color.h:16

where dst is the raster color and src is the drawable color.

Definition at line 19 of file blender.h.

Constructor & Destructor Documentation

◆ BlendingFilter() [1/4]

template<typename Blender >
roo_display::BlendingFilter< Blender >::BlendingFilter ( DisplayOutput output,
const Rasterizable raster,
Color  bgcolor = color::Transparent 
)
inline

Create a blending filter with default blender and no offset.

Definition at line 22 of file blender.h.

◆ BlendingFilter() [2/4]

template<typename Blender >
roo_display::BlendingFilter< Blender >::BlendingFilter ( DisplayOutput output,
const Rasterizable raster,
int16_t  dx,
int16_t  dy,
Color  bgcolor = color::Transparent 
)
inline

Create a blending filter with an offset.

Definition at line 27 of file blender.h.

◆ BlendingFilter() [3/4]

template<typename Blender >
roo_display::BlendingFilter< Blender >::BlendingFilter ( DisplayOutput output,
Blender  blender,
const Rasterizable raster,
Color  bgcolor = color::Transparent 
)
inline

Create a blending filter with a custom blender.

Definition at line 32 of file blender.h.

◆ BlendingFilter() [4/4]

template<typename Blender >
roo_display::BlendingFilter< Blender >::BlendingFilter ( DisplayOutput output,
Blender  blender,
const Rasterizable raster,
int16_t  dx,
int16_t  dy,
Color  bgcolor = color::Transparent 
)
inline

Create a blending filter with a custom blender and offset.

Definition at line 37 of file blender.h.

◆ ~BlendingFilter()

Definition at line 50 of file blender.h.

Member Function Documentation

◆ drawDirectRect()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 
)
inlineoverridevirtual

Draw a rectangle represented in the device's native color format.

Source data pointer correspond to the (0, 0) point in the source coordinate system, with stride of row_width_bytes. The source rectangle at (src_x0, src_y0, src_x1, src_y1) relative to the data pointer, gets copied to the destination rectangle with top-left corner at (dst_x0, dst_y0). The caller must ensure that the destination rectangle fits within the device's bounds.

The default implementation processes the rectangle by small tiles, converting the data to an array of regular colors, and calling regular window functions to draw them. Specific devices can override this method to provide a more efficient implementation that draws directly from the source data.

Reimplemented from roo_display::DisplayOutput.

Definition at line 182 of file blender.h.

References roo_display::DisplayOutput::drawDirectRect().

◆ fill()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 90 of file blender.h.

References roo_display::AlphaBlend(), color, roo_display::Rasterizable::readColorsMaybeOutOfBounds(), roo_display::DisplayOutput::write(), roo_display::Box::xMax(), and roo_display::Box::xMin().

◆ fillPixels()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 162 of file blender.h.

References roo_display::AlphaBlend(), color, and roo_display::DisplayOutput::writePixels().

◆ fillRects()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 139 of file blender.h.

References color.

◆ getColorFormat()

template<typename Blender >
const ColorFormat & roo_display::BlendingFilter< Blender >::getColorFormat ( ) const
inlineoverridevirtual

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

Implements roo_display::DisplayOutput.

Definition at line 178 of file blender.h.

References roo_display::DisplayOutput::getColorFormat().

◆ setAddress()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 55 of file blender.h.

References roo_display::DisplayOutput::setAddress().

◆ setOutput()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::setOutput ( DisplayOutput output)
inline

Replace the underlying output.

Definition at line 53 of file blender.h.

◆ write()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 63 of file blender.h.

References roo_display::AlphaBlend(), color, roo_display::Rasterizable::readColorsMaybeOutOfBounds(), roo_display::DisplayOutput::write(), roo_display::Box::xMax(), and roo_display::Box::xMin().

◆ writePixels()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 146 of file blender.h.

References roo_display::AlphaBlend(), color, and roo_display::DisplayOutput::writePixels().

◆ writeRects()

template<typename Blender >
void roo_display::BlendingFilter< Blender >::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 132 of file blender.h.

References color.


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