Ream v0.1.0-1
C++ graphics library for Linux
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RPass Class Referenceabstract

A Ream render pass. More...

#include <RPass.h>

+ Inheritance diagram for RPass:

Public Member Functions

 ~RPass () noexcept
 Destroys the render pass.
 
CZBitset< RPassCap > caps () const noexcept
 Returns the capabilities enabled for this pass.
 
virtual SkCanvas * getCanvas (bool sync=true) const noexcept=0
 Returns the SkCanvas associated with this pass, if available.
 
virtual RPaintergetPainter (bool sync=true) const noexcept=0
 Returns the RPainter associated with this pass, if available.
 
virtual void setGeometry (const RSurfaceGeometry &geometry) noexcept=0
 Sets transformation matrices.
 
void resetGeometry () noexcept
 Resets the geometry to the default RSurface geometry.
 
const RSurfaceGeometrygeometry () const noexcept
 Returns the current geometry for this pass.
 
std::shared_ptr< RSurfacesurface () const noexcept
 Returns the destination surface being rendered into.
 
void save () noexcept
 Saves the state of both RPainter and SkCanvas.
 
void restore () noexcept
 Restores the most recently saved state of RPainter and SkCanvas.
 
- Public Member Functions inherited from RObject
 RObject ()=default
 Constructs a default RObject.
 

Detailed Description

A Ream render pass.

An RPass allows an RDevice to render into an RSurface using either RPainter or SkCanvas, depending on the capabilities requested at creation time (see RSurface::beginPass()).

If you mix both RPainter and SkCanvas commands, make sure to call either getPainter() or getCanvas() first, depending on which API you intend to start using. Failing to do so may lead to synchronization issues, or in some cases, may cause Skia to crash.

Upon destruction, a fence is inserted into the underlying surface RImage to ensure that other threads wait before using the image as a source. Destroying the pass may also trigger flushing of pending Skia commands, depending on the current graphics backend.

Constructor & Destructor Documentation

◆ ~RPass()

~RPass ( )
noexcept

Destroys the render pass.

Inserts a fence into the backing storage to ensure that subsequent use of the resulting RImage from other threads is properly synchronized. May also flush pending Skia commands.

Member Function Documentation

◆ caps()

CZBitset< RPassCap > caps ( ) const
inlinenoexcept

Returns the capabilities enabled for this pass.

Indicates whether RPainter and/or SkCanvas is available, based on the flags passed to RSurface::beginPass().

Returns
A bitset of enabled RPassCap values.

◆ getCanvas()

virtual SkCanvas * getCanvas ( bool  sync = true) const
pure virtualnoexcept

Returns the SkCanvas associated with this pass, if available.

Parameters
syncWhether to synchronize and prepare the canvas for rendering. Pass false only if you intend to update canvas parameters without rendering.
Returns
A pointer to the SkCanvas, or nullptr if SkCanvas is not supported by this pass.

Implemented in RGLPass, RRSPass, and RVKPass.

◆ getPainter()

virtual RPainter * getPainter ( bool  sync = true) const
pure virtualnoexcept

Returns the RPainter associated with this pass, if available.

Parameters
syncWhether to synchronize and prepare the painter for rendering. Pass false only if you intend to update painter parameters without rendering.
Returns
A pointer to the RPainter, or nullptr if RPainter is not supported by this pass.

Implemented in RGLPass, RRSPass, and RVKPass.

◆ setGeometry()

virtual void setGeometry ( const RSurfaceGeometry geometry)
pure virtualnoexcept

Sets transformation matrices.

Updates both SkCanvas and RPainter transformation matrices to align with the given surface geometry.

Parameters
geometryThe geometry to apply.

Implemented in RGLPass, RRSPass, and RVKPass.

◆ resetGeometry()

void resetGeometry ( )
noexcept

Resets the geometry to the default RSurface geometry.

◆ geometry()

const RSurfaceGeometry & geometry ( ) const
inlinenoexcept

Returns the current geometry for this pass.

Defaults to the geometry of the associated RSurface at creation time, unless overridden via setGeometry().

Returns
The current RSurfaceGeometry in use.

◆ surface()

std::shared_ptr< RSurface > surface ( ) const
inlinenoexcept

Returns the destination surface being rendered into.

Returns
A shared pointer to the target RSurface.

◆ save()

void save ( )
noexcept

Saves the state of both RPainter and SkCanvas.

◆ restore()

void restore ( )
noexcept

Restores the most recently saved state of RPainter and SkCanvas.