Data and functionality required for rendering Node2D visuals. More...
#include <kanzi/core.ui/node/node_visual2d.hpp>
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... | |
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... | |
Vector2 | getForegroundTiling () const |
Gets foreground tiling from brush if present. 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 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) |
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 (Renderer &renderer) |
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 | storeRenderingParameters (optional< int > blendMode, float layoutOpacity, bool foregroundOpaquenessHint, 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 | |
Brush * | m_backgroundBrush |
Brush for background. More... | |
BrushRendererPtr | m_backgroundBrushRenderer |
Brush renderer for background. More... | |
GeometrySharedPtr | m_backgroundGeometry |
Background geometry. More... | |
optional< int > | m_blendMode |
Saved blend mode parameter. More... | |
bool | m_brushRenderersDirty |
Brush renderer dirty flag. More... | |
Brush * | m_foregroundBrush |
Brush for foreground. More... | |
BrushRendererPtr | m_foregroundBrushRenderer |
Brush renderer for foreground. More... | |
GeometrySharedPtr | m_foregroundGeometry |
Foreground geometry. More... | |
bool | m_foregroundOpaquenessHint |
Saved opaqueness hint. More... | |
bool | m_foregroundTranslucencyHint |
Saved translucency hint. More... | |
bool | m_geometryDirty |
Geometry dirty flag that implies the geometry has to be uploaded again. More... | |
float | m_layoutOpacity |
Saved opacity parameter. More... | |
bool | m_selfInCompositionTarget |
Flag that indicates whether the node is rendered to a composition target. 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 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 | ||
) |
Renders using foreground brush.
renderer | Renderer to use. |
transform | Transform for the quad. |
|
inline |
Renders using foreground brush wrapper.
void kanzi::NodeVisual2D::restoreResources | ( | Renderer & | renderer | ) |
Restores resources to GPU, if applicable.
renderer | Renderer to use. |
void kanzi::NodeVisual2D::storeRenderingParameters | ( | optional< int > | blendMode, |
float | layoutOpacity, | ||
bool | foregroundOpaquenessHint, | ||
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 | Blend mode specified for the node. nullopt if the node is composited. |
layoutOpacity | Layout opacity of the node. |
foregroundOpaquenessHint | If you want the node foreground to use opaque render mode if possible, pass true. |
foregroundTranslucencyHint | If you want the node foreground to use translucent render mode if opaque render mode is not used, pass true. |
blendMode
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.
|
inline |
Gets background tiling from brush if present.
|
inline |
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.
|
inline |
Updates content texture in foreground brush renderer, if it exists.
|
protected |
Background geometry.
|
protected |
Foreground geometry.
|
protected |
Geometry dirty flag that implies the geometry has to be uploaded again.
|
protected |
Brush for background.
Not owned by the visual.
|
protected |
Brush for foreground.
Not owned by the visual.
|
protected |
Brush renderer for background.
|
protected |
Brush renderer for foreground.
|
protected |
Saved blend mode parameter.
Affects brush selection unless the node is composited.
|
protected |
Saved opacity parameter.
|
protected |
Saved opaqueness hint.
|
protected |
Saved translucency hint.
|
protected |
Flag that indicates whether the node is rendered to a composition target.
|
protected |
Brush renderer dirty flag.