|
Ream v0.1.0-1
C++ graphics library for Linux
|
High-performance built-in renderer. More...
#include <RPainter.h>
Inheritance diagram for RPainter:Classes | |
| struct | State |
| Snapshot of the painter's mutable rendering state. More... | |
Public Types | |
| enum | Option : UInt32 |
| Rendering options. More... | |
| enum | ImageEffect : UInt32 |
| Image effects available through drawImageEffect(). More... | |
Public Member Functions | |
| const State & | state () 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. | |
| virtual bool | drawImage (const RDrawImageInfo &image, const SkRegion *region=nullptr, const RDrawImageInfo *mask=nullptr) noexcept=0 |
| Draws an image onto the surface. | |
| virtual bool | drawColor (const SkRegion ®ion) noexcept=0 |
| Fills the specified region with the current color(). | |
| virtual bool | drawImageEffect (const RDrawImageInfo &image, ImageEffect effect, const SkRegion *region=nullptr) noexcept=0 |
| Draws an image applying a built-in image effect. | |
| virtual bool | setGeometry (const RSurfaceGeometry &geometry) noexcept=0 |
| Sets the viewport -> (transform) -> dst mapping used by draw operations. | |
| const RSurfaceGeometry & | geometry () const noexcept |
| Returns the current geometry. | |
| void | clear () noexcept |
| Clears the current viewport using the current color. | |
| RDevice * | device () const noexcept |
| Returns the device used for rendering by this painter. | |
| std::shared_ptr< RSurface > | surface () const noexcept |
| Returns the surface this painter draws into. | |
Public Member Functions inherited from RObject | |
| RObject ()=default | |
| Constructs a default RObject. | |
High-performance built-in renderer.
RPainter is Ream's native drawing API, providing operations such as drawColor(), drawImage(), and drawImageEffect() with configurable blend modes, filtering, and geometry. It is implemented directly on each graphics backend (a native SPIR-V pipeline on Vulkan, GLSL on OpenGL, a software rasterizer on Raster), so it avoids the overhead of routing through Skia.
A painter is obtained from an RPass (RPass::getPainter()) and draws into the pass's surface.
| struct CZ::RPainter::State |
Snapshot of the painter's mutable rendering state.
Captured and restored by save()/restore().
| Class Members | ||
|---|---|---|
| CZBitset< Option > | options { 0 } | Enabled rendering options (see Option). |
| RBlendMode | blendMode { RBlendMode::SrcOver } | Blend mode used by draw operations. |
| SkScalar | opacity { 1.f } | Global opacity in the range [0, 1]. |
| SkColor | color { SK_ColorBLACK } | Color used by drawColor() and, when ReplaceImageColor is set, by drawImage(). |
| SkColor4f | factor { 1.f, 1.f, 1.f, 1.f } | Per-channel RGBA multiplication factors. |
| RSurfaceGeometry | geometry {} | Viewport -> (transform) -> dst mapping. |
| enum Option : UInt32 |
Rendering options.
| Enumerator | |
|---|---|
| ReplaceImageColor | Replaces the image's RGB values with the value from color(), while preserving the image's alpha. This effectively tints the image with a solid color. Disabled by default. |
| ColorIsPremult | Indicates that color() is premultiplied alpha. Disabled by default. |
| enum ImageEffect : UInt32 |
Image effects available through drawImageEffect().
| Enumerator | |
|---|---|
| VibrancyH | Sigma 6 horizontal blur pass. |
| VibrancyLightV | Sigma 3 vertical blur pass + light tone saturation. |
| VibrancyDarkV | Sigma 3 vertical blur pass + dark tone saturation. |
|
inlinenoexcept |
Returns the current painter state.
|
inlinenoexcept |
Replaces the current painter state.
The call is ignored if state has an invalid geometry.
| state | The new state to apply. |
|
noexcept |
Saves the current RPainter state.
|
noexcept |
Restores the most recently saved RPainter state.
If no saved state exists, the painter is reset to its default values.
|
noexcept |
Clears the saved state history and resets the current state to its defaults.
|
noexcept |
Resets the current RPainter state to its default configuration.
Does not affect the saved state history.
|
inlinenoexcept |
Sets an option.
|
inline |
Sets the current rendering options, replacing any previously set flags.
| options | The new set of options to apply. Defaults to none. |
|
inlinenoexcept |
Sets the current blend mode used for drawing operations.
This affects both drawColor() and drawImage(). The default blend mode is SrcOver.
| mode | The blend mode to set. |
|
inlinenoexcept |
Returns the current blend mode.
|
inlinenoexcept |
Sets the global opacity for drawing operations.
This affects both drawImage() and drawColor(). The opacity value is clamped to the range [0, 1].
| opacity | The opacity to set, where 0 is fully transparent and 1 is fully opaque. Defaults to 1.0 (fully opaque). |
|
inlinenoexcept |
Returns the current global opacity.
|
inlinenoexcept |
Specifies the color used by drawColor() and clearSurface().
The default color is black.
When Option::ReplaceImageColor is enabled, this color replaces the RGB components of the RImage in drawImage().
Use Option::ColorIsPremult to indicate if this color uses premultiplied alpha.
| color | The color to set. |
|
inlinenoexcept |
Returns the current drawing color.
|
inlinenoexcept |
Sets per-channel multiplication factors applied in drawColor() and drawImage().
Each RGBA component of the drawn color/image is multiplied by the corresponding factor. Factors can exceed the [0, 1] range.
A factor value of 1 disables multiplication for that channel (the shader skips it for performance).
Defaults to {1.f, 1.f, 1.f, 1.f}.
| factor | Multiplication factors for red, green, blue, and alpha channels. |
|
inlinenoexcept |
Returns the current per-channel multiplication factors.
|
pure virtualnoexcept |
Draws an image onto the surface.
This function renders an image onto the target RSurface, clipped to a specified region.
region and image.dst.mask.dst.| image | Information about the image to draw. |
| region | Clipping region within the RSurface viewport. |
| mask | Optional mask image. If provided, applies alpha masking using mask.a. |
Implemented in RGLPainter, RRSPainter, and RVKPainter.
|
pure virtualnoexcept |
Fills the specified region with the current color().
| region | The region within the surface to fill. |
Implemented in RGLPainter, RRSPainter, and RVKPainter.
|
pure virtualnoexcept |
Draws an image applying a built-in image effect.
| image | Information about the image to draw. |
| effect | The effect to apply (see ImageEffect). |
| region | Optional clipping region within the RSurface viewport. |
Implemented in RGLPainter, RRSPainter, and RVKPainter.
|
pure virtualnoexcept |
Sets the viewport -> (transform) -> dst mapping used by draw operations.
| geometry | The geometry to apply. |
Implemented in RGLPainter, RRSPainter, and RVKPainter.
|
inlinenoexcept |
Returns the current geometry.
|
noexcept |
Clears the current viewport using the current color.
|
inlinenoexcept |
Returns the device used for rendering by this painter.
|
inlinenoexcept |
Returns the surface this painter draws into.