Kanzi 3.9.10
kanzi::NodeVisual2D Class Reference

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 intcalculateContentStretch (int contentStretch, Vector2 renderSize, Vector2 contentSize)
 Calculates foreground content stretch.
 
BrushRenderergetBackgroundBrushRenderer () const
 Gets background brush renderer.
 
const GeometrygetBackgroundGeometry () const
 Gets a pointer to the background geometry.
 
Matrix3x3 getBackgroundLocalTransformation () const
 Gets transformation for transforming the background geometry vertex positions relative to the node top left corner.
 
Vector2 getBackgroundTiling () const
 Gets background tiling from brush if present.
 
BrushRenderergetForegroundBrushRenderer () const
 Gets foreground brush renderer.
 
const GeometrygetForegroundGeometry () const
 Gets a pointer to the foreground geometry.
 
Matrix3x3 getForegroundLocalTransformation () const
 Gets transformation for transforming the foreground geometry vertex positions relative to the node top left corner.
 
Vector2 getForegroundTiling () const
 Gets foreground tiling from brush if present.
 
optional< floatgetHorizontalTilingOverride () const
 Gets the horizontal tiling override.
 
optional< floatgetVerticalTilingOverride () const
 Gets the vertical tiling override.
 
bool isBackgoundBrushTilingDirty () const
 Returns whether the tiling of the Background Brush has changed.
 
bool isBackgroundGeometryValid () const
 Indicates whether background geometry is set and is valid.
 
bool isBackgroundOpaque () const
 Indicates whether background brush is present and is opaque.
 
bool isForegoundBrushTilingDirty () const
 Returns whether the tiling of the Foreground Brush has changed.
 
bool isForegroundGeometryValid () const
 Indicates whether foreground geometry is set and is valid.
 
bool isForegroundOpaque () const
 Indicates whether foreground brush is present and is opaque.
 
void onDetached ()
 Kanzi calls this function when the node that owns the visual becomes detached.
 
void renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix3x3 &transform)
 Render using background brush wrapper.
 
void renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform)
 Renders using background brush.
 
void renderBackground (Renderer3D &renderer, const Matrix3x3 &transform)
 Render using background brush wrapper.
 
void renderBackground (Renderer3D &renderer, const Matrix4x4 &transform)
 Renders using background brush.
 
void renderBackground (Renderer3D &renderer, const Matrix4x4 &transform, BrushRenderer &brushRenderer)
 Renders background using an override brush renderer.
 
void renderForeground (Renderer3D &renderer, const Matrix3x3 &transform)
 Renders using foreground brush wrapper.
 
void renderForeground (Renderer3D &renderer, const Matrix4x4 &transform)
 Renders using foreground brush.
 
void renderForeground (Renderer3D &renderer, const Matrix4x4 &transform, BrushRenderer &brushRenderer)
 Renders foreground using an override brush renderer.
 
void resetBackgroundBrush ()
 Resets background brush renderer.
 
void resetBackgroundGeometry ()
 Resets outside area quad.
 
void resetForegroundBrush ()
 Resets foreground brush renderer.
 
void resetForegroundGeometry ()
 Resets foreground geometry.
 
void restoreResources ()
 Restores resources to GPU, if applicable.
 
void setBackgroundBrush (Brush *brush, Node &node)
 Creates background brush renderer.
 
void setBackgroundGeometry (Domain *domain, const FrameDescription &frame)
 Creates the outside area quad.
 
void setBackgroundGeometry (Domain *domain, const QuadDescription &bg, const QuadDescription &fg, unsigned int clippingResult)
 Creates the outside area quad.
 
void setBackgroundGeometry (Domain *domain, const QuadDescription &quad)
 Creates a background quad.
 
void setForegroundBrushRenderer (Brush *brush, Node &node)
 Creates foreground brush renderer.
 
void setForegroundGeometry (Domain *domain, const QuadDescription &quad)
 Sets foreground quad with full data.
 
void setHorizontalTilingOverride (optional< float > tiling)
 Sets the horizontal tiling override.
 
void setVerticalTilingOverride (optional< float > tiling)
 Sets the vertical tiling override.
 
void updateBlendSettings (bool selfInCompositionTarget)
 Updates brush renderers for rendering.
 
void updateContentTexture (TextureSharedPtr texture)
 Updates content texture in foreground brush renderer, if it exists.
 
void updateRender (optional< int > blendMode, float layoutOpacity)
 Stores rendering parameters for the brushes and selects materials.
 

Static Public Member Functions

static unique_ptr< NodeVisual2Dcreate ()
 Creates a NodeVisual2D.
 

Protected Member Functions

 NodeVisual2D ()=default
 Default constructor.
 

Protected Attributes

BrushState m_backgroundBrushState
 State associated with background brush rendering.
 
optional< intm_blendMode
 Saved blend mode parameter.
 
bool m_brushRenderersDirty
 Brush renderer dirty flag.
 
BrushState m_foregroundBrushState
 State associated with foreground brush rendering.
 
optional< floatm_horizontalTilingOverride
 Optional horizontal tiling override.
 
float m_layoutOpacity
 Saved opacity parameter.
 
bool m_selfInCompositionTarget
 Flag that indicates whether the node is rendered to a composition target.
 
optional< floatm_verticalTilingOverride
 Optional vertical tiling override.
 

Detailed Description

Data and functionality required for rendering Node2D visuals.

Constructor & Destructor Documentation

◆ NodeVisual2D()

kanzi::NodeVisual2D::NodeVisual2D ( )
explicitprotecteddefault

Default constructor.

Member Function Documentation

◆ create()

static unique_ptr< NodeVisual2D > kanzi::NodeVisual2D::create ( )
static

Creates a NodeVisual2D.

Returns
NodeCompositor2D unique pointer.

◆ onDetached()

void kanzi::NodeVisual2D::onDetached ( )

Kanzi calls this function when the node that owns the visual becomes detached.

◆ calculateContentStretch()

tuple< QuadDescription, unsigned int > kanzi::NodeVisual2D::calculateContentStretch ( int contentStretch,
Vector2 renderSize,
Vector2 contentSize )

Calculates foreground content stretch.

Parameters
contentStretchContent stretch mode of type Node2D::ContentStretch.
renderSizeRender size.
contentSizeContent size.
Returns
Tuple of foreground quad and clipping result mask.

◆ renderBackground() [1/5]

void kanzi::NodeVisual2D::renderBackground ( Renderer3D & renderer,
const Matrix4x4 & transform,
BrushRenderer & brushRenderer )

Renders background using an override brush renderer.

Parameters
rendererRenderer to use.
transformTransform for the quad.
brushRendererBrush renderer to use.
Since
Kanzi 3.9.5

◆ renderBackground() [2/5]

void kanzi::NodeVisual2D::renderBackground ( Renderer3D & renderer,
const Geometry & geometry,
const Matrix4x4 & transform )

Renders using background brush.

Parameters
rendererRenderer to use.
geometryQuad to render.
transformTransform for the quad.

◆ renderBackground() [3/5]

void kanzi::NodeVisual2D::renderBackground ( Renderer3D & renderer,
const Geometry & geometry,
const Matrix3x3 & transform )
inline

Render using background brush wrapper.

◆ renderBackground() [4/5]

void kanzi::NodeVisual2D::renderBackground ( Renderer3D & renderer,
const Matrix4x4 & transform )

Renders using background brush.

Uses background quad from visual.

Parameters
rendererRenderer to use.
transformTransform for the quad.

◆ renderBackground() [5/5]

void kanzi::NodeVisual2D::renderBackground ( Renderer3D & renderer,
const Matrix3x3 & transform )
inline

Render using background brush wrapper.

◆ renderForeground() [1/3]

void kanzi::NodeVisual2D::renderForeground ( Renderer3D & renderer,
const Matrix4x4 & transform,
BrushRenderer & brushRenderer )

Renders foreground using an override brush renderer.

Parameters
rendererRenderer to use.
transformTransform for the quad.
brushRendererBrush renderer to use.
Since
Kanzi 3.9.5

◆ renderForeground() [2/3]

void kanzi::NodeVisual2D::renderForeground ( Renderer3D & renderer,
const Matrix4x4 & transform )

Renders using foreground brush.

Parameters
rendererRenderer to use.
transformTransform for the quad.

◆ renderForeground() [3/3]

void kanzi::NodeVisual2D::renderForeground ( Renderer3D & renderer,
const Matrix3x3 & transform )
inline

Renders using foreground brush wrapper.

◆ restoreResources()

void kanzi::NodeVisual2D::restoreResources ( )

Restores resources to GPU, if applicable.

Since
Kanzi 3.9.5 removed renderer parameter.

◆ updateRender()

void kanzi::NodeVisual2D::updateRender ( optional< int > blendMode,
float layoutOpacity )

Stores rendering parameters for the brushes and selects materials.

Kanzi calls this function during Node2D::updateRender(). To select the materials, this function calls BrushRenderer::updateRender() on the brush renderers. Kanzi calls updateBlendSettings() later during rendering, after determining whether to composit.

Parameters
blendModeThe blend mode of the node. If the node is composited, pass nullopt.
layoutOpacityThe layout opacity of the node.
Since
Kanzi 3.9.1 added blendMode parameter.
Kanzi 3.9.6 removed foregroundOpaquenessHint parameter.
Kanzi 3.9.9 renamed from storeRenderingParameters() to updateRender() and removed foregroundTranslucencyHint parameter.

◆ updateBlendSettings()

void kanzi::NodeVisual2D::updateBlendSettings ( bool selfInCompositionTarget)

Updates brush renderers for rendering.

If no settings have changed, this call is a NOP.

Parameters
selfInCompositionTargetWhether the node is rendered to a composition target.
Since
Kanzi 3.9.9 renamed from updateBrushRenderers() to updateBlendSettings().

◆ getBackgroundBrushRenderer()

BrushRenderer * kanzi::NodeVisual2D::getBackgroundBrushRenderer ( ) const
inline

Gets background brush renderer.

◆ setBackgroundBrush()

void kanzi::NodeVisual2D::setBackgroundBrush ( Brush * brush,
Node & node )
inline

Creates background brush renderer.

Parameters
nodeThe node to which to attach.
brushThe brush from which to create the renderer.
Since
Kanzi 3.9.1 data type of brush parameter changed from BrushSharedPtr to Brush*.

◆ resetBackgroundBrush()

void kanzi::NodeVisual2D::resetBackgroundBrush ( )
inline

Resets background brush renderer.

◆ getForegroundBrushRenderer()

BrushRenderer * kanzi::NodeVisual2D::getForegroundBrushRenderer ( ) const
inline

Gets foreground brush renderer.

◆ setForegroundBrushRenderer()

void kanzi::NodeVisual2D::setForegroundBrushRenderer ( Brush * brush,
Node & node )
inline

Creates foreground brush renderer.

Parameters
nodeThe node to which to attach.
brushThe brush from which to create the renderer.
Since
Kanzi 3.9.1 data type of brush parameter changed from BrushSharedPtr to Brush*.

◆ resetForegroundBrush()

void kanzi::NodeVisual2D::resetForegroundBrush ( )
inline

Resets foreground brush renderer.

◆ getForegroundGeometry()

const Geometry & kanzi::NodeVisual2D::getForegroundGeometry ( ) const
inline

Gets a pointer to the foreground geometry.

Call this function only if you know that foreground geometry is valid.

See also
isForegroundGeometryValid()
Returns
Pointer to valid foreground geometry or nullptr.

◆ isForegroundGeometryValid()

bool kanzi::NodeVisual2D::isForegroundGeometryValid ( ) const

Indicates whether foreground geometry is set and is valid.

Returns
If foreground geometry is set and valid, true, otherwise false.

◆ setForegroundGeometry()

void kanzi::NodeVisual2D::setForegroundGeometry ( Domain * domain,
const QuadDescription & quad )

Sets foreground quad with full data.

Parameters
domainDomain to use.
quadThe quad to set.

◆ resetForegroundGeometry()

void kanzi::NodeVisual2D::resetForegroundGeometry ( )

Resets foreground geometry.

◆ getForegroundLocalTransformation()

Matrix3x3 kanzi::NodeVisual2D::getForegroundLocalTransformation ( ) const

Gets transformation for transforming the foreground geometry vertex positions relative to the node top left corner.

Returns
Transformation for foreground geometry.
Since
Kanzi 3.9.5

◆ getBackgroundTiling()

Vector2 kanzi::NodeVisual2D::getBackgroundTiling ( ) const

Gets background tiling from brush if present.

◆ getForegroundTiling()

Vector2 kanzi::NodeVisual2D::getForegroundTiling ( ) const

Gets foreground tiling from brush if present.

◆ isBackgroundOpaque()

bool kanzi::NodeVisual2D::isBackgroundOpaque ( ) const
inline

Indicates whether background brush is present and is opaque.

◆ isForegroundOpaque()

bool kanzi::NodeVisual2D::isForegroundOpaque ( ) const
inline

Indicates whether foreground brush is present and is opaque.

◆ getBackgroundGeometry()

const Geometry & kanzi::NodeVisual2D::getBackgroundGeometry ( ) const
inline

Gets a pointer to the background geometry.

Call this function only if you know that background geometry is valid.

Returns
Pointer to valid background geometry or nullptr.
See also
isBackgroundGeometryValid()

◆ isBackgroundGeometryValid()

bool kanzi::NodeVisual2D::isBackgroundGeometryValid ( ) const

Indicates whether background geometry is set and is valid.

Returns
If background geometry is set and valid, true, otherwise false.

◆ setBackgroundGeometry() [1/3]

void kanzi::NodeVisual2D::setBackgroundGeometry ( Domain * domain,
const QuadDescription & quad )

Creates a background quad.

Parameters
domainDomain to use.
quadQuad description.

◆ setBackgroundGeometry() [2/3]

void kanzi::NodeVisual2D::setBackgroundGeometry ( Domain * domain,
const FrameDescription & frame )

Creates the outside area quad.

Creates a frame that does not include the foreground area.

Parameters
domainDomain to use.
frameThe frame description to use.

◆ setBackgroundGeometry() [3/3]

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.

Parameters
domainDomain to use.
bgWhole background area quad.
fgWhole foreground area quad.
clippingResultClipping result.

◆ resetBackgroundGeometry()

void kanzi::NodeVisual2D::resetBackgroundGeometry ( )

Resets outside area quad.

◆ getBackgroundLocalTransformation()

Matrix3x3 kanzi::NodeVisual2D::getBackgroundLocalTransformation ( ) const

Gets transformation for transforming the background geometry vertex positions relative to the node top left corner.

Returns
Transformation for background geometry.
Since
Kanzi 3.9.5

◆ updateContentTexture()

void kanzi::NodeVisual2D::updateContentTexture ( TextureSharedPtr texture)
inline

Updates content texture in foreground brush renderer, if it exists.

◆ setHorizontalTilingOverride()

void kanzi::NodeVisual2D::setHorizontalTilingOverride ( optional< float > tiling)
inline

Sets the horizontal tiling override.

This overrides the horizontal tiling set in a brush.

Parameters
tilingHorizontal tiling override to use, or nullopt to disable the override.
Since
Kanzi 3.9.5

◆ getHorizontalTilingOverride()

optional< float > kanzi::NodeVisual2D::getHorizontalTilingOverride ( ) const
inline

Gets the horizontal tiling override.

Returns
Horizontal tiling override, or nullopt if tiling override is not enabled.
Since
Kanzi 3.9.5

◆ setVerticalTilingOverride()

void kanzi::NodeVisual2D::setVerticalTilingOverride ( optional< float > tiling)
inline

Sets the vertical tiling override.

This overrides the vertical tiling set in a brush.

Parameters
tilingVertical tiling override to use, or nullopt to disable the override.
Since
Kanzi 3.9.5

◆ getVerticalTilingOverride()

optional< float > kanzi::NodeVisual2D::getVerticalTilingOverride ( ) const
inline

Gets the vertical tiling override.

Returns
Vertical tiling override, or nullopt if tiling override is not enabled.
Since
Kanzi 3.9.5

◆ isForegoundBrushTilingDirty()

bool kanzi::NodeVisual2D::isForegoundBrushTilingDirty ( ) const
inline

Returns whether the tiling of the Foreground Brush has changed.

Returns
If Foreground Brush tiling has changed, true, otherwise false.
Since
Kanzi 3.9.9

◆ isBackgoundBrushTilingDirty()

bool kanzi::NodeVisual2D::isBackgoundBrushTilingDirty ( ) const
inline

Returns whether the tiling of the Background Brush has changed.

Returns
If Background Brush tiling has changed, true, otherwise false.
Since
Kanzi 3.9.9

Member Data Documentation

◆ m_backgroundBrushState

BrushState kanzi::NodeVisual2D::m_backgroundBrushState
protected

State associated with background brush rendering.

Since
Kanzi 3.9.5

◆ m_foregroundBrushState

BrushState kanzi::NodeVisual2D::m_foregroundBrushState
protected

State associated with foreground brush rendering.

Since
Kanzi 3.9.5

◆ m_blendMode

optional<int> kanzi::NodeVisual2D::m_blendMode
protected

Saved blend mode parameter.

Affects brush selection unless the node is composited.

Since
Kanzi 3.9.1

◆ m_layoutOpacity

float kanzi::NodeVisual2D::m_layoutOpacity
protected

Saved opacity parameter.

◆ m_selfInCompositionTarget

bool kanzi::NodeVisual2D::m_selfInCompositionTarget
protected

Flag that indicates whether the node is rendered to a composition target.

◆ m_brushRenderersDirty

bool kanzi::NodeVisual2D::m_brushRenderersDirty
protected

Brush renderer dirty flag.

◆ m_horizontalTilingOverride

optional<float> kanzi::NodeVisual2D::m_horizontalTilingOverride
protected

Optional horizontal tiling override.

Since
Kanzi 3.9.5

◆ m_verticalTilingOverride

optional<float> kanzi::NodeVisual2D::m_verticalTilingOverride
protected

Optional vertical tiling override.

Since
Kanzi 3.9.5

The documentation for this class was generated from the following file: