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

Raster (software) implementation of RPainter. More...

#include <RRSPainter.h>

+ Inheritance diagram for RRSPainter:

Public Member Functions

bool drawImage (const RDrawImageInfo &image, const SkRegion *region=nullptr, const RDrawImageInfo *mask=nullptr) noexcept override
 Draws an image (optionally masked) into the surface. Implements RPainter::drawImage().
 
bool drawImageEffect (const RDrawImageInfo &image, ImageEffect effect, const SkRegion *region=nullptr) noexcept override
 Draws an image effect into the surface. Implements RPainter::drawImageEffect().
 
bool drawColor (const SkRegion &region) noexcept override
 Fills the given region with the current color. Implements RPainter::drawColor().
 
RRSDevicedevice () const noexcept
 Returns the associated device downcast to the Raster backend type.
 
bool setGeometry (const RSurfaceGeometry &geometry) noexcept override
 Sets the surface geometry used to build the drawing matrix. Implements RPainter::setGeometry().
 
- Public Member Functions inherited from RPainter
const Statestate () const noexcept
 Returns the current painter state.
 
void setState (const State &state) noexcept
 Replaces the current painter state.
 
void save () noexcept
 Saves the current RPainter state.
 
void restore () noexcept
 Restores the most recently saved RPainter state.
 
void clearHistory () noexcept
 Clears the saved state history and resets the current state to its defaults.
 
void reset () noexcept
 Resets the current RPainter state to its default configuration.
 
void setOption (Option option, bool enabled) noexcept
 Sets an option.
 
void setOptions (CZBitset< Option > options=0)
 Sets the current rendering options, replacing any previously set flags.
 
void setBlendMode (RBlendMode mode=RBlendMode::SrcOver) noexcept
 Sets the current blend mode used for drawing operations.
 
RBlendMode blendMode () const noexcept
 Returns the current blend mode.
 
void setOpacity (SkScalar opacity=1.f) noexcept
 Sets the global opacity for drawing operations.
 
SkScalar opacity () const noexcept
 Returns the current global opacity.
 
void setColor (SkColor color=SK_ColorBLACK) noexcept
 Specifies the color used by drawColor() and clearSurface().
 
SkColor color () const noexcept
 Returns the current drawing color.
 
void setFactor (const SkColor4f &factor={1.f, 1.f, 1.f, 1.f}) noexcept
 Sets per-channel multiplication factors applied in drawColor() and drawImage().
 
const SkColor4f & factor () const noexcept
 Returns the current per-channel multiplication factors.
 
const RSurfaceGeometrygeometry () const noexcept
 Returns the current geometry.
 
void clear () noexcept
 Clears the current viewport using the current color.
 
RDevicedevice () const noexcept
 Returns the device used for rendering by this painter.
 
std::shared_ptr< RSurfacesurface () const noexcept
 Returns the surface this painter draws into.
 
- Public Member Functions inherited from RObject
 RObject ()=default
 Constructs a default RObject.
 

Additional Inherited Members

- Public Types inherited from RPainter
enum  Option : UInt32
 Rendering options. More...
 
enum  ImageEffect : UInt32
 Image effects available through drawImageEffect(). More...
 

Detailed Description

Raster (software) implementation of RPainter.

RRSPainter carries out RPainter's drawing operations on the CPU by rendering into the target surface's SkSurface with Skia (shaders, color filters, blend modes and clip regions), rather than through a GPU pipeline. It is created by RRSDevice and drives an RRSImage-backed surface.

Member Function Documentation

◆ drawImage()

bool drawImage ( const RDrawImageInfo image,
const SkRegion *  region = nullptr,
const RDrawImageInfo mask = nullptr 
)
overridevirtualnoexcept

Draws an image (optionally masked) into the surface. Implements RPainter::drawImage().

The source image is drawn through a Skia shader built from the draw info (source rect/transform, filtering and wrap modes), honoring the current opacity, blend mode, per-channel factor and optional color replacement. When a mask is provided it is applied as a DstIn alpha mask.

Implements RPainter.

◆ drawImageEffect()

bool drawImageEffect ( const RDrawImageInfo image,
ImageEffect  effect,
const SkRegion *  region = nullptr 
)
overridevirtualnoexcept

Draws an image effect into the surface. Implements RPainter::drawImageEffect().

Note
The Raster backend does not implement the actual effects; it currently fills the affected region with a fixed translucent color as a placeholder.

Implements RPainter.

◆ drawColor()

bool drawColor ( const SkRegion &  region)
overridevirtualnoexcept

Fills the given region with the current color. Implements RPainter::drawColor().

The region is intersected with the current viewport, and the fill honors the current opacity, blend mode, per-channel factor and premultiplied-color option.

Implements RPainter.

◆ device()

RRSDevice * device ( ) const
inlinenoexcept

Returns the associated device downcast to the Raster backend type.

◆ setGeometry()

bool setGeometry ( const RSurfaceGeometry geometry)
overridevirtualnoexcept

Sets the surface geometry used to build the drawing matrix. Implements RPainter::setGeometry().

Returns
false if the geometry is invalid, true otherwise.

Implements RPainter.