Kanzi  3.9.7
Kanzi Engine API
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 int > calculateContentStretch (int contentStretch, Vector2 renderSize, Vector2 contentSize)
 Calculates foreground content stretch. More...
 
BrushRenderergetBackgroundBrushRenderer () const
 Gets background brush renderer. More...
 
const GeometrygetBackgroundGeometry () 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...
 
BrushRenderergetForegroundBrushRenderer () const
 Gets foreground brush renderer. More...
 
const GeometrygetForegroundGeometry () 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< NodeVisual2Dcreate ()
 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...
 

Detailed Description

Data and functionality required for rendering Node2D visuals.

Constructor & Destructor Documentation

kanzi::NodeVisual2D::NodeVisual2D ( )
explicitprotecteddefault

Default constructor.

Member Function Documentation

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

Creates a NodeVisual2D.

Returns
NodeCompositor2D unique pointer.
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.

Parameters
contentStretchContent stretch mode of type Node2D::ContentStretch.
renderSizeRender size.
contentSizeContent size.
Returns
Tuple of foreground quad and clipping result mask.
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
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.
void kanzi::NodeVisual2D::renderBackground ( Renderer3D renderer,
const Geometry geometry,
const Matrix3x3 transform 
)
inline

Render using background brush wrapper.

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.
void kanzi::NodeVisual2D::renderBackground ( Renderer3D renderer,
const Matrix3x3 transform 
)
inline

Render using background brush wrapper.

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
void kanzi::NodeVisual2D::renderForeground ( Renderer3D renderer,
const Matrix4x4 transform 
)

Renders using foreground brush.

Parameters
rendererRenderer to use.
transformTransform for the quad.
void kanzi::NodeVisual2D::renderForeground ( Renderer3D renderer,
const Matrix3x3 transform 
)
inline

Renders using foreground brush wrapper.

void kanzi::NodeVisual2D::restoreResources ( )

Restores resources to GPU, if applicable.

Since
Kanzi 3.9.5 removed 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.

Parameters
blendModeThe blend mode of the node. If the node is composited, pass nullopt.
layoutOpacityThe layout opacity of the node.
foregroundTranslucencyHintWhether you want the node foreground to use translucent render mode.
Since
Kanzi 3.9.1 added blendMode parameter.
Kanzi 3.9.6 removed foregroundOpaquenessHint parameter.
void kanzi::NodeVisual2D::updateBrushRenderers ( 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.
BrushRenderer* kanzi::NodeVisual2D::getBackgroundBrushRenderer ( ) const
inline

Gets background brush renderer.

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*.
void kanzi::NodeVisual2D::resetBackgroundBrush ( )
inline

Resets background brush renderer.

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

Gets foreground brush renderer.

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*.
void kanzi::NodeVisual2D::resetForegroundBrush ( )
inline

Resets foreground brush renderer.

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.
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.
void kanzi::NodeVisual2D::setForegroundGeometry ( Domain domain,
const QuadDescription quad 
)

Sets foreground quad with full data.

Parameters
domainDomain to use.
quadThe 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.

Returns
Transformation for foreground geometry.
Since
Kanzi 3.9.5
Vector2 kanzi::NodeVisual2D::getBackgroundTiling ( ) const

Gets background tiling from brush if present.

Vector2 kanzi::NodeVisual2D::getForegroundTiling ( ) const

Gets foreground tiling from brush if present.

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

Indicates whether background brush is present and is opaque.

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

Indicates whether foreground brush is present and is opaque.

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()
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.
void kanzi::NodeVisual2D::setBackgroundGeometry ( Domain domain,
const QuadDescription quad 
)

Creates a background quad.

Parameters
domainDomain to use.
quadQuad 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.

Parameters
domainDomain to use.
frameThe 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.

Parameters
domainDomain to use.
bgWhole background area quad.
fgWhole foreground area quad.
clippingResultClipping 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.

Returns
Transformation for background geometry.
Since
Kanzi 3.9.5
void kanzi::NodeVisual2D::updateContentTexture ( TextureSharedPtr  texture)
inline

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

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

Member Data Documentation

BrushState kanzi::NodeVisual2D::m_backgroundBrushState
protected

State associated with background brush rendering.

Since
Kanzi 3.9.5
BrushState kanzi::NodeVisual2D::m_foregroundBrushState
protected

State associated with foreground brush rendering.

Since
Kanzi 3.9.5
optional<int> kanzi::NodeVisual2D::m_blendMode
protected

Saved blend mode parameter.

Affects brush selection unless the node is composited.

Since
Kanzi 3.9.1
float kanzi::NodeVisual2D::m_layoutOpacity
protected

Saved opacity parameter.

bool kanzi::NodeVisual2D::m_foregroundTranslucencyHint
protected

Saved translucency hint.

bool kanzi::NodeVisual2D::m_selfInCompositionTarget
protected

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

bool kanzi::NodeVisual2D::m_brushRenderersDirty
protected

Brush renderer dirty flag.

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

Optional horizontal tiling override.

Since
Kanzi 3.9.5
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: