Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::NodeVisual2D Class Reference

Composition functionality for 2D nodes. More...

#include <kanzi/core.ui/node/node_visual2d.hpp>

Public Member Functions

tuple< QuadDescription, unsigned int > calculateContentStretch (int contentStretch, Vector2 renderSize, Vector2 contentSize)
 Calculate foreground content stretch. More...
 
void createBackgroundGeometry (const QuadDescription &quad)
 Create background quad. More...
 
void createBackgroundGeometry (const QuadDescription &bg, const QuadDescription &fg, unsigned int clippingResult)
 Create the outside area quad. More...
 
BrushRenderergetBackgroundBrushRenderer () const
 Get background brush renderer. More...
 
GeometrygetBackgroundGeometry () const
 Access background geometry. More...
 
Vector2 getBackgroundTiling () const
 Get background tiling from brush if present. More...
 
BrushRenderergetForegroundBrushRenderer () const
 Get foreground brush renderer. More...
 
GeometryQuadgetForegroundGeometry () const
 Access foreground quad. More...
 
Vector2 getForegroundTiling () const
 Get foreground tiling from brush if present. More...
 
bool isBackgroundOpaque () const
 Tell if background brush is present and is opaque. More...
 
bool isForegroundOpaque () const
 Tell if foreground brush is present and is opaque. More...
 
 NodeVisual2D ()=default
 Default constructor. More...
 
void renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform)
 Render 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)
 Render using background brush. More...
 
void renderBackground (Renderer3D &renderer, const Matrix3x3 &transform)
 Render using background brush wrapper. More...
 
void renderForeground (Renderer3D &renderer, const Matrix4x4 &transform)
 Render using foreground brush. More...
 
void renderForeground (Renderer3D &renderer, const Matrix3x3 &transform)
 Render using foreground brush wrapper. More...
 
void resetBackgroundBrush ()
 Reset background brush renderer. More...
 
void resetBackgroundGeometry ()
 Reset outside area quad. More...
 
void resetForegroundBrush ()
 Reset foreground brush renderer. More...
 
void resetForegroundGeometry ()
 Reset foreground geometry. More...
 
void restoreResources ()
 Restore resources to GPU, if applicable. More...
 
void setBackgroundBrush (BrushSharedPtr brush, Node &node)
 Create background brush renderer. More...
 
void setForegroundBrushRenderer (BrushSharedPtr brush, Node &node)
 Create foreground brush renderer. More...
 
void setForegroundGeometry (const QuadDescription &quad)
 Set foreground quad with full data. More...
 
void storeRenderingParameters (float layoutOpacity, bool foregroundOpaquenessHint, bool foregroundTranslucencyHint)
 Store rendering parameters for the brushes. More...
 
void updateBrushRenderers (bool selfInCompositionTarget)
 Update brush renderers for rendering. More...
 
void updateContentTexture (TextureSharedPtr texture)
 Update content texture in foreground brush renderer, if it exists. More...
 

Detailed Description

Composition functionality for 2D nodes.

Constructor & Destructor Documentation

◆ NodeVisual2D()

kanzi::NodeVisual2D::NodeVisual2D ( )
explicitdefault

Default constructor.

Member Function Documentation

◆ calculateContentStretch()

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

Calculate 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/4]

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

Render using background brush.

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

◆ renderBackground() [2/4]

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

Render using background brush wrapper.

◆ renderBackground() [3/4]

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

Render using background brush.

Uses background quad from visual.

Parameters
rendererRenderer to use.
transformTransform for the quad.

◆ renderBackground() [4/4]

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

Render using background brush wrapper.

◆ renderForeground() [1/2]

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

Render using foreground brush.

Parameters
rendererRenderer to use.
transformTransform for the quad.

◆ renderForeground() [2/2]

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

Render using foreground brush wrapper.

◆ restoreResources()

void kanzi::NodeVisual2D::restoreResources ( )

Restore resources to GPU, if applicable.

◆ storeRenderingParameters()

void kanzi::NodeVisual2D::storeRenderingParameters ( float  layoutOpacity,
bool  foregroundOpaquenessHint,
bool  foregroundTranslucencyHint 
)

Store 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.

Parameters
layoutOpacityLayout opacity of the node.
foregroundOpaquenessHintTrue if node foreground should use opaque render mode if possible.
foregroundTranslucencyHintTrue if node foreground should use translucent render mode if opaque render mode is not used.

◆ updateBrushRenderers()

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

Update brush renderers for rendering.

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

Parameters
selfInCompositionTargetWhether the node is rendered to a composition target.

◆ getBackgroundBrushRenderer()

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

Get background brush renderer.

◆ setBackgroundBrush()

void kanzi::NodeVisual2D::setBackgroundBrush ( BrushSharedPtr  brush,
Node node 
)
inline

Create background brush renderer.

Parameters
nodeNode to attach to.
brushBrush to create from.

◆ resetBackgroundBrush()

void kanzi::NodeVisual2D::resetBackgroundBrush ( )
inline

Reset background brush renderer.

◆ getForegroundBrushRenderer()

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

Get foreground brush renderer.

◆ setForegroundBrushRenderer()

void kanzi::NodeVisual2D::setForegroundBrushRenderer ( BrushSharedPtr  brush,
Node node 
)
inline

Create foreground brush renderer.

Parameters
nodeNode to attach to.
brushBrush to create from.

◆ resetForegroundBrush()

void kanzi::NodeVisual2D::resetForegroundBrush ( )
inline

Reset foreground brush renderer.

◆ getForegroundGeometry()

GeometryQuad* kanzi::NodeVisual2D::getForegroundGeometry ( ) const
inline

Access foreground quad.

◆ setForegroundGeometry()

void kanzi::NodeVisual2D::setForegroundGeometry ( const QuadDescription quad)
inline

Set foreground quad with full data.

Parameters
quadThe quad to set.

◆ resetForegroundGeometry()

void kanzi::NodeVisual2D::resetForegroundGeometry ( )
inline

Reset foreground geometry.

◆ getBackgroundTiling()

Vector2 kanzi::NodeVisual2D::getBackgroundTiling ( ) const
inline

Get background tiling from brush if present.

◆ getForegroundTiling()

Vector2 kanzi::NodeVisual2D::getForegroundTiling ( ) const
inline

Get foreground tiling from brush if present.

◆ isBackgroundOpaque()

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

Tell if background brush is present and is opaque.

◆ isForegroundOpaque()

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

Tell if foreground brush is present and is opaque.

◆ createBackgroundGeometry() [1/2]

void kanzi::NodeVisual2D::createBackgroundGeometry ( const QuadDescription quad)
inline

Create background quad.

Creates a complete background quad.

Parameters
quadQuad description.

◆ createBackgroundGeometry() [2/2]

void kanzi::NodeVisual2D::createBackgroundGeometry ( const QuadDescription bg,
const QuadDescription fg,
unsigned int  clippingResult 
)
inline

Create the outside area quad.

Creates a frame that does not include the foreground area.

Parameters
bgWhole background area quad.
fgWhole foreground area quad.
clippingResultClipping result.

◆ getBackgroundGeometry()

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

Access background geometry.

◆ resetBackgroundGeometry()

void kanzi::NodeVisual2D::resetBackgroundGeometry ( )
inline

Reset outside area quad.

◆ updateContentTexture()

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

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


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