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

Vulkan implementation of RPainter (native SPIR-V shaders). More...

#include <RVKPainter.h>

+ Inheritance diagram for RVKPainter:

Public Member Functions

bool drawImage (const RDrawImageInfo &image, const SkRegion *region=nullptr, const RDrawImageInfo *mask=nullptr) noexcept override
 Draws an image onto the surface.
 
bool drawColor (const SkRegion &region) noexcept override
 Fills the specified region with the current color().
 
bool drawImageEffect (const RDrawImageInfo &image, ImageEffect effect, const SkRegion *region=nullptr) noexcept override
 Draws an image applying a built-in image effect.
 
bool setGeometry (const RSurfaceGeometry &geometry) noexcept override
 Sets the viewport -> (transform) -> dst mapping used by draw operations.
 
- 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

Vulkan implementation of RPainter (native SPIR-V shaders).

Records drawing commands into a per-pass command buffer inside a VkRenderPass targeting the surface image, and submits at flush() (called by ~RVKPass). Positions/UVs are pre-transformed to NDC/normalized image coords on the CPU; blend modes map to fixed-function blend state.

Member Function Documentation

◆ drawImage()

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

Draws an image onto the surface.

This function renders an image onto the target RSurface, clipped to a specified region.

  • If no mask is provided, the effective rendering area is the intersection between region and image.dst.
  • If a mask is provided, the region is further intersected with mask.dst.
Parameters
imageInformation about the image to draw.
regionClipping region within the RSurface viewport.
maskOptional mask image. If provided, applies alpha masking using mask.a.
Returns
true if the image was successfully drawn, false otherwise.

Implements RPainter.

◆ drawColor()

bool drawColor ( const SkRegion &  region)
overridevirtualnoexcept

Fills the specified region with the current color().

Parameters
regionThe region within the surface to fill.
Returns
true if the operation succeeded, false otherwise.

Implements RPainter.

◆ drawImageEffect()

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

Draws an image applying a built-in image effect.

Note
The current opacity, factor, blend mode, and similar state are ignored.
Parameters
imageInformation about the image to draw.
effectThe effect to apply (see ImageEffect).
regionOptional clipping region within the RSurface viewport.
Returns
true if the image was successfully drawn, false otherwise.

Implements RPainter.

◆ setGeometry()

bool setGeometry ( const RSurfaceGeometry geometry)
overridevirtualnoexcept

Sets the viewport -> (transform) -> dst mapping used by draw operations.

Parameters
geometryThe geometry to apply.
Returns
true if the geometry was applied, false if it is invalid.

Implements RPainter.