Data and functionality required for rendering Node2D visuals. More...
#include <kanzi/core.ui/node/node_visual2d.hpp>
Classes | |
struct | BrushState |
State associated with brush rendering. More... | |
Public Member Functions | |
tuple< QuadDescription, unsigned int > | calculateContentStretch (int contentStretch, Vector2 renderSize, Vector2 contentSize) |
Calculates foreground content stretch. More... | |
BrushRenderer * | getBackgroundBrushRenderer () const |
Gets background brush renderer. More... | |
const Geometry & | getBackgroundGeometry () const |
Gets a pointer to the background geometry. More... | |
Matrix3x3 | getBackgroundLocalTransformation () const |
Gets transformation for transforming the background geometry vertex positions relative to the node top left corner. More... | |
Vector2 | getBackgroundTiling () const |
Gets background tiling from brush if present. More... | |
BrushRenderer * | getForegroundBrushRenderer () const |
Gets foreground brush renderer. More... | |
const Geometry & | getForegroundGeometry () const |
Gets a pointer to the foreground geometry. More... | |
Matrix3x3 | getForegroundLocalTransformation () const |
Gets transformation for transforming the foreground geometry vertex positions relative to the node top left corner. More... | |
Vector2 | getForegroundTiling () const |
Gets foreground tiling from brush if present. More... | |
optional< float > | getHorizontalTilingOverride () const |
Gets the horizontal tiling override. More... | |
optional< float > | getVerticalTilingOverride () const |
Gets the vertical tiling override. More... | |
bool | isBackgroundGeometryValid () const |
Indicates whether background geometry is set and is valid. More... | |
bool | isBackgroundOpaque () const |
Indicates whether background brush is present and is opaque. More... | |
bool | isForegroundGeometryValid () const |
Indicates whether foreground geometry is set and is valid. More... | |
bool | isForegroundOpaque () const |
Indicates whether foreground brush is present and is opaque. More... | |
void | onDetached () |
Kanzi calls this function when the node that owns the visual becomes detached. More... | |
void | renderBackground (Renderer3D &renderer, const Matrix4x4 &transform, BrushRenderer &brushRenderer) |
Renders background using an override brush renderer. More... | |
void | renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform) |
Renders using background brush. More... | |
void | renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix3x3 &transform) |
Render using background brush wrapper. More... | |
void | renderBackground (Renderer3D &renderer, const Matrix4x4 &transform) |
Renders using background brush. More... | |
void | renderBackground (Renderer3D &renderer, const Matrix3x3 &transform) |
Render using background brush wrapper. More... | |
void | renderForeground (Renderer3D &renderer, const Matrix4x4 &transform, BrushRenderer &brushRenderer) |
Renders foreground using an override brush renderer. More... | |
void | renderForeground (Renderer3D &renderer, const Matrix4x4 &transform) |
Renders using foreground brush. More... | |
void | renderForeground (Renderer3D &renderer, const Matrix3x3 &transform) |
Renders using foreground brush wrapper. More... | |
void | resetBackgroundBrush () |
Resets background brush renderer. More... | |
void | resetBackgroundGeometry () |
Resets outside area quad. More... | |
void | resetForegroundBrush () |
Resets foreground brush renderer. More... | |
void | resetForegroundGeometry () |
Resets foreground geometry. More... | |
void | restoreResources () |
Restores resources to GPU, if applicable. More... | |
void | setBackgroundBrush (Brush *brush, Node &node) |
Creates background brush renderer. More... | |
void | setBackgroundGeometry (Domain *domain, const QuadDescription &quad) |
Creates a background quad. More... | |
void | setBackgroundGeometry (Domain *domain, const FrameDescription &frame) |
Creates the outside area quad. More... | |
void | setBackgroundGeometry (Domain *domain, const QuadDescription &bg, const QuadDescription &fg, unsigned int clippingResult) |
Creates the outside area quad. More... | |
void | setForegroundBrushRenderer (Brush *brush, Node &node) |
Creates foreground brush renderer. More... | |
void | setForegroundGeometry (Domain *domain, const QuadDescription &quad) |
Sets foreground quad with full data. More... | |
void | setHorizontalTilingOverride (optional< float > tiling) |
Sets the horizontal tiling override. More... | |
void | setVerticalTilingOverride (optional< float > tiling) |
Sets the vertical tiling override. More... | |
void | storeRenderingParameters (optional< int > blendMode, float layoutOpacity, bool foregroundTranslucencyHint) |
Stores rendering parameters for the brushes. More... | |
void | updateBrushRenderers (bool selfInCompositionTarget) |
Updates brush renderers for rendering. More... | |
void | updateContentTexture (TextureSharedPtr texture) |
Updates content texture in foreground brush renderer, if it exists. More... | |
Static Public Member Functions | |
static unique_ptr< NodeVisual2D > | create () |
Creates a NodeVisual2D. More... | |
Protected Member Functions | |
NodeVisual2D ()=default | |
Default constructor. More... | |
Protected Attributes | |
BrushState | m_backgroundBrushState |
State associated with background brush rendering. More... | |
optional< int > | m_blendMode |
Saved blend mode parameter. More... | |
bool | m_brushRenderersDirty |
Brush renderer dirty flag. More... | |
BrushState | m_foregroundBrushState |
State associated with foreground brush rendering. More... | |
bool | m_foregroundTranslucencyHint |
Saved translucency hint. More... | |
optional< float > | m_horizontalTilingOverride |
Optional horizontal tiling override. More... | |
float | m_layoutOpacity |
Saved opacity parameter. More... | |
bool | m_selfInCompositionTarget |
Flag that indicates whether the node is rendered to a composition target. More... | |
optional< float > | m_verticalTilingOverride |
Optional vertical tiling override. More... | |
Data and functionality required for rendering Node2D visuals.
|
explicitprotecteddefault |
Default constructor.
|
static |
Creates a NodeVisual2D.
void kanzi::NodeVisual2D::onDetached | ( | ) |
Kanzi calls this function when the node that owns the visual becomes detached.
tuple<QuadDescription, unsigned int> kanzi::NodeVisual2D::calculateContentStretch | ( | int | contentStretch, |
Vector2 | renderSize, | ||
Vector2 | contentSize | ||
) |
Calculates foreground content stretch.
contentStretch | Content stretch mode of type Node2D::ContentStretch. |
renderSize | Render size. |
contentSize | Content size. |
void kanzi::NodeVisual2D::renderBackground | ( | Renderer3D & | renderer, |
const Matrix4x4 & | transform, | ||
BrushRenderer & | brushRenderer | ||
) |
void kanzi::NodeVisual2D::renderBackground | ( | Renderer3D & | renderer, |
const Geometry & | geometry, | ||
const Matrix4x4 & | transform | ||
) |
Renders using background brush.
renderer | Renderer to use. |
geometry | Quad to render. |
transform | Transform for the quad. |
|
inline |
Render using background brush wrapper.
void kanzi::NodeVisual2D::renderBackground | ( | Renderer3D & | renderer, |
const Matrix4x4 & | transform | ||
) |
Renders using background brush.
Uses background quad from visual.
renderer | Renderer to use. |
transform | Transform for the quad. |
|
inline |
Render using background brush wrapper.
void kanzi::NodeVisual2D::renderForeground | ( | Renderer3D & | renderer, |
const Matrix4x4 & | transform, | ||
BrushRenderer & | brushRenderer | ||
) |
void kanzi::NodeVisual2D::renderForeground | ( | Renderer3D & | renderer, |
const Matrix4x4 & | transform | ||
) |
Renders using foreground brush.
renderer | Renderer to use. |
transform | Transform for the quad. |
|
inline |
Renders using foreground brush wrapper.
void kanzi::NodeVisual2D::restoreResources | ( | ) |
Restores resources to GPU, if applicable.
renderer
parameter. void kanzi::NodeVisual2D::storeRenderingParameters | ( | optional< int > | blendMode, |
float | layoutOpacity, | ||
bool | foregroundTranslucencyHint | ||
) |
Stores rendering parameters for the brushes.
Kanzi calls this function during updateRender(). If the parameters differ, Kanzi marks the brush renderers dirty. Kanzi updates the brush renderers during rendering based on the composition status.
blendMode | The blend mode of the node. If the node is composited, pass nullopt. |
layoutOpacity | The layout opacity of the node. |
foregroundTranslucencyHint | Whether you want the node foreground to use translucent render mode. |
blendMode
parameter. foregroundOpaquenessHint
parameter. void kanzi::NodeVisual2D::updateBrushRenderers | ( | bool | selfInCompositionTarget | ) |
Updates brush renderers for rendering.
If no settings have changed, this call is a NOP.
selfInCompositionTarget | Whether the node is rendered to a composition target. |
|
inline |
Gets background brush renderer.
Creates background brush renderer.
node | The node to which to attach. |
brush | The brush from which to create the renderer. |
brush
parameter changed from BrushSharedPtr to Brush*.
|
inline |
Resets background brush renderer.
|
inline |
Gets foreground brush renderer.
Creates foreground brush renderer.
node | The node to which to attach. |
brush | The brush from which to create the renderer. |
brush
parameter changed from BrushSharedPtr to Brush*.
|
inline |
Resets foreground brush renderer.
|
inline |
Gets a pointer to the foreground geometry.
Call this function only if you know that foreground geometry is valid.
bool kanzi::NodeVisual2D::isForegroundGeometryValid | ( | ) | const |
Indicates whether foreground geometry is set and is valid.
void kanzi::NodeVisual2D::setForegroundGeometry | ( | Domain * | domain, |
const QuadDescription & | quad | ||
) |
Sets foreground quad with full data.
domain | Domain to use. |
quad | The quad to set. |
void kanzi::NodeVisual2D::resetForegroundGeometry | ( | ) |
Resets foreground geometry.
Matrix3x3 kanzi::NodeVisual2D::getForegroundLocalTransformation | ( | ) | const |
Gets transformation for transforming the foreground geometry vertex positions relative to the node top left corner.
Vector2 kanzi::NodeVisual2D::getBackgroundTiling | ( | ) | const |
Gets background tiling from brush if present.
Vector2 kanzi::NodeVisual2D::getForegroundTiling | ( | ) | const |
Gets foreground tiling from brush if present.
|
inline |
Indicates whether background brush is present and is opaque.
|
inline |
Indicates whether foreground brush is present and is opaque.
|
inline |
Gets a pointer to the background geometry.
Call this function only if you know that background geometry is valid.
bool kanzi::NodeVisual2D::isBackgroundGeometryValid | ( | ) | const |
Indicates whether background geometry is set and is valid.
void kanzi::NodeVisual2D::setBackgroundGeometry | ( | Domain * | domain, |
const QuadDescription & | quad | ||
) |
Creates a background quad.
domain | Domain to use. |
quad | Quad description. |
void kanzi::NodeVisual2D::setBackgroundGeometry | ( | Domain * | domain, |
const FrameDescription & | frame | ||
) |
Creates the outside area quad.
Creates a frame that does not include the foreground area.
domain | Domain to use. |
frame | The frame description to use. |
void kanzi::NodeVisual2D::setBackgroundGeometry | ( | Domain * | domain, |
const QuadDescription & | bg, | ||
const QuadDescription & | fg, | ||
unsigned int | clippingResult | ||
) |
Creates the outside area quad.
Creates a frame that does not include the foreground area.
domain | Domain to use. |
bg | Whole background area quad. |
fg | Whole foreground area quad. |
clippingResult | Clipping result. |
void kanzi::NodeVisual2D::resetBackgroundGeometry | ( | ) |
Resets outside area quad.
Matrix3x3 kanzi::NodeVisual2D::getBackgroundLocalTransformation | ( | ) | const |
Gets transformation for transforming the background geometry vertex positions relative to the node top left corner.
|
inline |
Updates content texture in foreground brush renderer, if it exists.
|
inline |
Sets the horizontal tiling override.
This overrides the horizontal tiling set in a brush.
tiling | Horizontal tiling override to use, or nullopt to disable the override. |
|
inline |
Gets the horizontal tiling override.
|
inline |
Sets the vertical tiling override.
This overrides the vertical tiling set in a brush.
tiling | Vertical tiling override to use, or nullopt to disable the override. |
|
inline |
Gets the vertical tiling override.
|
protected |
State associated with background brush rendering.
|
protected |
State associated with foreground brush rendering.
|
protected |
Saved blend mode parameter.
Affects brush selection unless the node is composited.
|
protected |
Saved opacity parameter.
|
protected |
Saved translucency hint.
|
protected |
Flag that indicates whether the node is rendered to a composition target.
|
protected |
Brush renderer dirty flag.
|
protected |
Optional horizontal tiling override.
|
protected |
Optional vertical tiling override.