|
roo_display
API Documentation for roo_display
|
In-memory DisplayDevice backed by a pixel buffer.
More...
#include <offscreen.h>
Public Member Functions | |
| OffscreenDevice (int16_t width, int16_t height, roo::byte *buffer, ColorMode color_mode) | |
| Create an offscreen device with the given geometry and buffer. | |
| OffscreenDevice (OffscreenDevice &&other) noexcept | |
| void | orientationUpdated () |
| Update orientation-dependent state. | |
| 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 | 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. | |
| 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 | end () override |
| Finalize the previously entered write transaction, flushing any pending writes. | |
| 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. | |
| 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) override |
| Asynchronous variant of drawDirectRect(). | |
| void | flush () override |
| Wait until pending asynchronous drawing operations complete. | |
| ColorMode & | color_mode () |
| Access color mode. | |
| const ColorMode & | color_mode () const |
| Access color mode (const). | |
| const ColorFormat & | getColorFormat () const override |
| Return the native color format used by this device for direct drawing. | |
| const ConstDramRaster< ColorMode, pixel_order, byte_order > | raster () const |
| Return a raster view of the full buffer. | |
| const ConstDramRaster< ColorMode, pixel_order, byte_order > | raster (int16_t dx, int16_t dy) const |
| Return a raster view of the buffer with an offset. | |
| roo::byte * | buffer () |
| Direct access to the underlying buffer. | |
| const roo::byte * | buffer () const |
| Direct access to the underlying buffer (const). | |
| int16_t | window_x () const |
| Current address window x cursor. | |
| int16_t | window_y () const |
| Current address window y cursor. | |
Public Member Functions inherited from roo_display::DisplayDevice | |
| virtual | ~DisplayDevice () |
| virtual void | init () |
| Initialize the display driver. | |
| void | setOrientation (Orientation orientation) |
| Set the orientation of the display. | |
| 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. | |
| void | setAddress (const Box &bounds, BlendingMode blending_mode) |
Convenience overload for setAddress() using a Box. | |
| virtual void | fill (Color color, uint32_t pixel_count) |
Write pixel_count copies of the same color into the current 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. | |
Friends | |
| template<typename , typename , ColorPixelOrder , ByteOrder > | |
| struct | WriteOp |
Additional Inherited Members | |
Protected Member Functions inherited from roo_display::DisplayDevice | |
| DisplayDevice (int16_t raw_width, int16_t raw_height) | |
| DisplayDevice (Orientation orientation, int16_t raw_width, int16_t raw_height) | |
In-memory DisplayDevice backed by a pixel buffer.
Supports arbitrary color modes, byte orders, and pixel orders via template parameters:
pixel_order applies to sub-byte modes (MSB/LSB first).byte_order applies to multi-byte modes (big/little endian).Orientation affects how content is written to the buffer. Existing content is not rotated when orientation changes, but subsequent writes are. For example, Orientation::Default().rotateLeft() renders content rotated 90 degrees counter-clockwise.
Definition at line 134 of file offscreen.h.
|
inline |
Create an offscreen device with the given geometry and buffer.
The buffer must have capacity $(width * height * ColorMode::bits_per_pixel + 7) / 8$ bytes. The buffer is not modified on construction.
Definition at line 141 of file offscreen.h.
References roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::buffer().
|
inlinenoexcept |
Definition at line 151 of file offscreen.h.
|
inline |
Direct access to the underlying buffer.
Definition at line 433 of file offscreen.h.
Referenced by roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::OffscreenDevice().
|
inline |
Direct access to the underlying buffer (const).
Definition at line 435 of file offscreen.h.
|
inline |
Access color mode.
Definition at line 394 of file offscreen.h.
Referenced by roo_display::BufferedAddrWindowDevice< Target >::color_mode().
|
inline |
Access color mode (const).
Definition at line 396 of file offscreen.h.
|
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 185 of file offscreen.h.
References roo_display::blit(), roo_display::Orientation::Default(), roo_display::kSource, roo_display::DisplayDevice::orientation(), roo_display::DisplayDevice::raw_width(), roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::setAddress(), width_, and writer.
Referenced by roo_display::BufferedAddrWindowDevice< Target >::drawDirectRect(), and roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::drawDirectRectAsync().
|
inlineoverridevirtual |
Asynchronous variant of drawDirectRect().
This method may continue executing after it returns. The caller must keep data valid until any subsequent drawing method call or until flush() is called.
The default implementation calls drawDirectRect() synchronously.
Reimplemented from roo_display::DisplayOutput.
Definition at line 335 of file offscreen.h.
References roo_display::async_blit(), roo_display::Orientation::Default(), roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::drawDirectRect(), roo_display::DisplayDevice::orientation(), and roo_display::DisplayDevice::raw_width().
|
inlineoverridevirtual |
Finalize the previously entered write transaction, flushing any pending writes.
Normally called by the DrawingContext destructor, and does not need to be called explicitly.
Reimplemented from roo_display::DisplayOutput.
Definition at line 183 of file offscreen.h.
|
overridevirtual |
Draw the specified pixels using the same color. Invalidates the address window.
| blending_mode | Blending mode used for drawing. |
| color | The color to use for all pixels. |
| x | Pointer to x-coordinates for each pixel. |
| y | Pointer to y-coordinates for each pixel. |
| pixel_count | Number of pixels. |
Implements roo_display::DisplayOutput.
Definition at line 1524 of file offscreen.h.
References blending_mode, color, roo_display::kDestination, roo_display::kSource, roo_display::kSourceOver, roo_display::kSourceOverOpaque, and roo_display::internal::ResolveBlendingModeForFill().
Referenced by roo_display::FrontToBackWriter::fillPixels(), and roo_display::FrontToBackWriter::writePixels().
|
overridevirtual |
Draw the specified rectangles using the same color. Invalidates the address window.
| blending_mode | Blending mode used for drawing. |
| color | The color to use for all rectangles. |
| x0 | Pointer to left coordinates for each rectangle. |
| y0 | Pointer to top coordinates for each rectangle. |
| x1 | Pointer to right coordinates for each rectangle. |
| y1 | Pointer to bottom coordinates for each rectangle. |
| count | Number of rectangles. |
Implements roo_display::DisplayOutput.
Definition at line 1587 of file offscreen.h.
References blending_mode, color, roo_display::kDestination, roo_display::kSource, and roo_display::internal::ResolveBlendingModeForFill().
Referenced by roo_display::BufferedAddrWindowDevice< Target >::fillRects().
|
inlineoverridevirtual |
Wait until pending asynchronous drawing operations complete.
Implementations that perform deferred writes should override this method and block until it is safe to reuse source buffers passed to async drawing APIs.
Reimplemented from roo_display::DisplayOutput.
Definition at line 391 of file offscreen.h.
|
inlineoverridevirtual |
Return the native color format used by this device for direct drawing.
Implements roo_display::DisplayOutput.
Definition at line 398 of file offscreen.h.
Referenced by roo_display::BufferedAddrWindowDevice< Target >::getColorFormat().
|
virtual |
Update orientation-dependent state.
Reimplemented from roo_display::DisplayDevice.
Definition at line 1373 of file offscreen.h.
|
inline |
Return a raster view of the full buffer.
Definition at line 407 of file offscreen.h.
References roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::raster().
Referenced by roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::raster().
|
inline |
Return a raster view of the buffer with an offset.
Definition at line 412 of file offscreen.h.
References roo_display::DisplayDevice::raw_height(), and roo_display::DisplayDevice::raw_width().
|
overridevirtual |
Set a rectangular window filled by subsequent calls to write().
| x0 | Left coordinate (inclusive). |
| y0 | Top coordinate (inclusive). |
| x1 | Right coordinate (inclusive). |
| y1 | Bottom coordinate (inclusive). |
| blending_mode | Blending mode for subsequent writes. |
Implements roo_display::DisplayOutput.
Definition at line 1381 of file offscreen.h.
References blending_mode, roo_display::kSource, and roo_display::internal::ResolveBlendingModeForWrite().
Referenced by roo_display::OffscreenDevice< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::drawDirectRect(), roo_display::BufferedAddrWindowDevice< Target >::setAddress(), roo_display::FrontToBackWriter::setAddress(), and roo_display::BufferedAddrWindowDevice< Target >::writePixels().
|
inline |
Current address window x cursor.
Definition at line 438 of file offscreen.h.
References roo_display::internal::AddressWindow::x().
|
inline |
Current address window y cursor.
Definition at line 440 of file offscreen.h.
References roo_display::internal::AddressWindow::y().
|
overridevirtual |
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.
| color | Pointer to source pixels. |
| pixel_count | Number of pixels to write. |
Implements roo_display::DisplayOutput.
Definition at line 1410 of file offscreen.h.
References color, roo_display::kDestination, roo_display::kSource, roo_display::kSourceOver, roo_display::kSourceOverOpaque, and writer.
Referenced by roo_display::BufferedAddrWindowDevice< Target >::write(), and roo_display::BufferedAddrWindowDevice< Target >::writePixels().
|
overridevirtual |
Draw the specified pixels (per-pixel colors). Invalidates the address window.
| blending_mode | Blending mode used for drawing. |
| color | Pointer to colors for each pixel. |
| x | Pointer to x-coordinates for each pixel. |
| y | Pointer to y-coordinates for each pixel. |
| pixel_count | Number of pixels. |
Implements roo_display::DisplayOutput.
Definition at line 1460 of file offscreen.h.
References blending_mode, color, roo_display::kDestination, roo_display::kSource, roo_display::kSourceOver, roo_display::kSourceOverOpaque, and roo_display::internal::ResolveBlendingModeForWrite().
|
overridevirtual |
Draw the specified rectangles (per-rectangle colors). Invalidates the address window.
| blending_mode | Blending mode used for drawing. |
| color | Pointer to colors for each rectangle. |
| x0 | Pointer to left coordinates for each rectangle. |
| y0 | Pointer to top coordinates for each rectangle. |
| x1 | Pointer to right coordinates for each rectangle. |
| y1 | Pointer to bottom coordinates for each rectangle. |
| count | Number of rectangles. |
Implements roo_display::DisplayOutput.
Definition at line 1568 of file offscreen.h.
References blending_mode, color, roo_display::kDestination, roo_display::kSource, and roo_display::internal::ResolveBlendingModeForWrite().
Referenced by roo_display::BufferedAddrWindowDevice< Target >::writeRects().
|
friend |
Definition at line 444 of file offscreen.h.