Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::OutlineEffectRenderer2D Class Reference

Outline effect renderer class. More...

#include <kanzi/core.ui/effect/outline_effect_renderer2d.hpp>

Inheritance diagram for kanzi::OutlineEffectRenderer2D:
[legend]

Public Member Functions

optional< int > getBlendMode () const
 Gets the blend mode override. More...
 
ColorRGBA getColor () const
 Gets the outline color. More...
 
Vector2 getContentGradient () const
 Gets the content gradient. More...
 
Vector4 getContentMask () const
 Gets the content mask. More...
 
float getContentOffset () const
 Gets the content offset. More...
 
unsigned int getInnerWidth () const
 Gets the maximum thickness of the outline inside the content area. More...
 
bool getInvertContentMask () const
 Indicates whether the content mask is inverted. More...
 
OutlineEffect2D::OutlineMethod getMethod () const
 Gets the outline calculation method. More...
 
unsigned int getOuterWidth () const
 Gets the maximum thickness of the outline outside the content area. More...
 
TextureSharedPtr getOutlineTexture () const
 Gets the outline texture. More...
 
Vector2 getOutlineTextureSettings () const
 Gets the texture settings. More...
 
Vector2 getSoftness () const
 Gets the outline softness. More...
 
void setBlendMode (optional< int > blendMode)
 Sets the blend mode override used for rendering the outline. More...
 
void setColor (ColorRGBA color)
 Sets the outline color at maximum intensity. More...
 
void setContentGradient (Vector2 value)
 Sets the content gradient. More...
 
void setContentMaskParameters (Vector4 mask, float threshold)
 Sets the content masking parameters. More...
 
void setInvertContentMask (bool invert)
 Sets the content mask inverting parameters. More...
 
void setMethod (OutlineEffect2D::OutlineMethod method)
 Sets the outline calculation method. More...
 
void setOutlineTexture (TextureSharedPtr texture)
 Sets the outline texture. More...
 
void setOutlineTextureSettings (Vector2 settings)
 Sets the texture settings. More...
 
void setSoftness (Vector2 softness)
 Sets the softness of the outline. More...
 
void setWidths (unsigned int outerWidth, unsigned int innerWidth)
 Sets the maximum thickness of the outline. More...
 
- Public Member Functions inherited from kanzi::NodeEffectRenderer2D
void applyEffect (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const Matrix3x3 &worldTransform, const CompositionContentRequirements &requirements, TextureSharedPtr sourceContent)
 Applies the effect on the source content provided as texture. More...
 
void beginEffect (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const Matrix3x3 &worldTransform, const CompositionContentRequirements &requirements)
 Begins the effect. More...
 
void blitEffect (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const QuadDescription &effectQuad, const Matrix3x3 &transform, const Matrix4x4 *perspectiveMatrix, const Matrix4x4 *projectionMatrix, int blendMode, bool needsClear)
 Blits the effect to the current framebuffer. More...
 
void endEffect (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager)
 Ends the effect. More...
 
NodeEffect2DSharedPtr getEffect () const
 Get NodeEffect2D instance where this renderer has been instantiated from. More...
 
size_t getEffectPassCount () const
 Gets the number of effect passes. More...
 
bool isLayeredOnTop () const
 Whether a compatible effect renders logically on top of its source content. More...
 
bool isRenderEffectOnlyEnabled () const
 Whether the effect only mode is enabled. More...
 
void restoreResources ()
 Restores resources after the rendering context has been lost. More...
 
void setRenderEffectOnly (bool renderEffectOnly)
 Sets the render effect only mode. More...
 
virtual ~NodeEffectRenderer2D ()
 Declare NodeEffectRenderer2D as not movable nor copyable. More...
 

Static Public Member Functions

static OutlineEffectRenderer2DUniquePtr create (OutlineEffect2DSharedPtr outlineEffect)
 Creates instances of OutlineEffectRenderer2D. More...
 

Protected Member Functions

void beginEffectOverride (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const Matrix3x3 &worldTransform, const CompositionContentRequirements &requirements) override
 NodeEffectRenderer2D::beginEffectOverride() implementation. More...
 
void blitEffectOverride (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const QuadDescription &effectQuad, const Matrix3x3 &transform, const Matrix4x4 *perspectiveMatrix, const Matrix4x4 *projectionMatrix, int blendMode, bool needsClear) override
 NodeEffectRenderer2D::blitEffectOverride() implementation. More...
 
void createOutlineEffectPasses ()
 Creates the effect passes. More...
 
void endEffectOverride (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager) override
 NodeEffectRenderer2D::endEffectOverride() implementation. More...
 
void onRenderEffectOnlyChanged () override
 NodeEffectRenderer2D::onRenderEffectOnlyChanged() implementation. More...
 
 OutlineEffectRenderer2D (OutlineEffect2DSharedPtr outlineEffect)
 Constructor. More...
 
void restoreResourcesOverride () override
 NodeEffectRenderer2D::restoreResourcesOverride() implementation. More...
 
bool supportsBlitBlendMode (int blendMode) override
 NodeEffectRenderer2D::supportsBlitBlendMode() implementation. More...
 
void validateContentColorScale ()
 Validates the content color scale. More...
 
void validateContentMaskParameters ()
 Prepares the parameters for content masking. More...
 
void validateEffectPasses (Vector2 nodeSize)
 Prepares the effect passes. More...
 
void validateRenderStates ()
 Prepares the render states. More...
 
- Protected Member Functions inherited from kanzi::NodeEffectRenderer2D
EffectPassaddEffectPass ()
 Adds an effect pass and gets a reference to that pass. More...
 
void beginInitialEffectPass (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const CompositionContentRequirements &requirements)
 Begins the initial effect pass (effect pass at index 0). More...
 
void blitEffectPass (int effectPassIndex, Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const QuadDescription &effectQuad, const Matrix3x3 &transform, const Matrix4x4 *perspectiveMatrix, const Matrix4x4 *projectionMatrix, int blendMode, bool needsClear)
 Blits the effect pass and handles the perspective transform if necessary. More...
 
void blitFinalEffectPass (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, const QuadDescription &effectQuad, const Matrix3x3 &transform, const Matrix4x4 *perspectiveMatrix, const Matrix4x4 *projectionMatrix, int blendMode, bool needsClear)
 Blits the final effect pass, whose index is getEffectPassCount() - 1, and handles the perspective transform if necessary. More...
 
void blitIntermediateEffectPass (int effectPassIndex, Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager)
 Blits the intermediate effect pass. More...
 
void clearRenderTarget (Renderer3D &renderer, CompositionStack &compositionStack, TextureSharedPtr texture, ColorRGBA clearColor)
 Clears the render target texture with a given color. More...
 
void clearRenderTarget (Renderer3D &renderer, CompositionStack &compositionStack, NativeFramebufferHandle framebufferHandle, ColorRGBA clearColor)
 Clears the native framebuffer with a given color. More...
 
void configureInitialEffectPass (Vector2 sourceContentSize)
 Configures the initial effect pass. More...
 
void endInitialEffectPass (CompositionStack &compositionStack)
 Ends the initial effect pass, whose index is 0. More...
 
void finalizeEffectPasses ()
 Finalizes the effect passes. More...
 
Vector2 getEffectInputTexelSize (int effectPassIndex, int inputIndex)
 Gets the texel size of the input effect pass texture in texture coordinates. More...
 
EffectPassgetEffectPass (int index)
 Gets a reference to the effect pass at a given index. More...
 
int getLastEffectPassIndex () const
 Gets the index of the last effect pass. More...
 
bool isInitialPassRenderTargetTemporary () const
 Whether the initial pass render target is temporary. More...
 
 NodeEffectRenderer2D (NodeEffect2DSharedPtr nodeEffect)
 Constructor. More...
 
void releaseEffectPassInputRenderTargets (EffectPass &currentEffectPass, CompositionManager *compositionManager)
 Releases those temporary render targets used by input that have EffectPass::Input::releaseRenderTarget set to true. More...
 
void removeAllEffectPasses ()
 Removes all user-added effect passes, but leaves the internal initial effect pass. More...
 
void setLayeredOnTop (bool layeredOnTop)
 Sets whether the effect is layered on top of the source content. More...
 

Protected Attributes

int m_blitPassIndex
 Index of the blit pass. More...
 
EffectRenderState m_blitRenderState
 Blit render state. More...
 
GlRenderState::HandleType m_boxStepHandle1
 Render state handle. More...
 
GlRenderState::HandleType m_boxStepHandle2
 Render state handle. More...
 
Vector4 m_cachedMask
 Input mask value from the effect. More...
 
bool m_cachedMaskInvert
 Input masking invert value from the effect. More...
 
float m_cachedMaskThreshold
 Input masking threshold value from the effect. More...
 
Vector2 m_cachedNodeSize
 The node size that Kanzi uses when it validates the effect passes. More...
 
ColorRGBA m_color
 Color of the outline. More...
 
GlRenderState::HandleType m_colorHandle
 Render state handle. More...
 
float m_contentColorScale
 Scale factor for the content color. More...
 
GlRenderState::HandleType m_contentColorScaleHandle
 Render state handle. More...
 
Vector2 m_contentGradient
 Content fade-out gradient. More...
 
GlRenderState::HandleType m_contentGradientHandle
 Render state handle. More...
 
Vector4 m_contentMask
 Content masking vector. More...
 
GlRenderState::HandleType m_contentMaskHandle1
 Render state handle. More...
 
float m_contentOffset
 Content offset value. More...
 
GlRenderState::HandleType m_contentOffsetHandle1
 Render state handle. More...
 
bool m_effectPassesDirty
 Dirty bits from parameters being modified. More...
 
GlRenderState::HandleType m_innerRadiusHandle1
 Render state handle. More...
 
GlRenderState::HandleType m_innerRadiusHandle2
 Render state handle. More...
 
unsigned int m_innerWidth
 Maximum outline thickness inside the content area. More...
 
OutlineEffect2D::OutlineMethod m_method
 Outline calculation method. More...
 
int m_nodeBlitPassIndex
 Index of the separated node blit pass. More...
 
EffectRenderState m_nodeBlitRenderState
 Separated node blit render state. More...
 
GlRenderState::HandleType m_outerRadiusHandle1
 Render state handle. More...
 
GlRenderState::HandleType m_outerRadiusHandle2
 Render state handle. More...
 
unsigned int m_outerWidth
 Maximum outline thickness outside the content area. More...
 
optional< int > m_outlineBlendMode
 Optional blend mode override for the outline. More...
 
TextureSharedPtr m_outlineTexture
 Outline texture. More...
 
GlRenderState::HandleType m_outlineTextureHandle
 Render state handle. More...
 
Vector2 m_outlineTextureSettings
 Texture settings. More...
 
GlRenderState::HandleType m_outlineTextureSettingsHandle
 Render state handle. More...
 
int m_passIndex1
 Index of the first pass. More...
 
int m_passIndex2
 Index of the second pass. More...
 
EffectRenderState m_passRenderState1
 First pass render state. More...
 
EffectRenderState m_passRenderState2
 Second pass render state (optional). More...
 
Vector2 m_softness
 Outline softness. More...
 
GlRenderState::HandleType m_softnessHandle
 Render state handle. More...
 

Additional Inherited Members

- Protected Types inherited from kanzi::NodeEffectRenderer2D
using EffectPassContainer = vector< EffectPass >
 Container for effect passes. More...
 
- Static Protected Attributes inherited from kanzi::NodeEffectRenderer2D
static constexpr int InitialEffectPassIndex
 Effect pass index for the initial pass. More...
 

Detailed Description

Outline effect renderer class.

See also
OutlineEffect2D, NodeEffect2D, NodeEffectPrefab2D, NodeEffectTemplate2D
Since
Kanzi 3.9.5

Constructor & Destructor Documentation

kanzi::OutlineEffectRenderer2D::OutlineEffectRenderer2D ( OutlineEffect2DSharedPtr  outlineEffect)
explicitprotected

Constructor.

Parameters
outlineEffectThe OutlineEffect2D instance on which this renderer is based.

Member Function Documentation

static OutlineEffectRenderer2DUniquePtr kanzi::OutlineEffectRenderer2D::create ( OutlineEffect2DSharedPtr  outlineEffect)
static

Creates instances of OutlineEffectRenderer2D.

Parameters
outlineEffectThe OutlineEffect2D instance on which this renderer is based.
Returns
OutlineEffectRenderer2D instance.
void kanzi::OutlineEffectRenderer2D::setColor ( ColorRGBA  color)

Sets the outline color at maximum intensity.

Parameters
colorColor of the outline.
ColorRGBA kanzi::OutlineEffectRenderer2D::getColor ( ) const
inline

Gets the outline color.

Returns
Color of the outline.
void kanzi::OutlineEffectRenderer2D::setContentGradient ( Vector2  value)

Sets the content gradient.

Parameters
valueContent gradient value.
Vector2 kanzi::OutlineEffectRenderer2D::getContentGradient ( ) const
inline

Gets the content gradient.

Returns
Content gradient value.
void kanzi::OutlineEffectRenderer2D::setInvertContentMask ( bool  invert)

Sets the content mask inverting parameters.

Parameters
invertWhether to invert the masking.
bool kanzi::OutlineEffectRenderer2D::getInvertContentMask ( ) const
inline

Indicates whether the content mask is inverted.

Returns
If the content mask is inverted, true, otherwise false.
void kanzi::OutlineEffectRenderer2D::setContentMaskParameters ( Vector4  mask,
float  threshold 
)

Sets the content masking parameters.

Parameters
maskContent masking vector.
thresholdContent masking threshold.
Vector4 kanzi::OutlineEffectRenderer2D::getContentMask ( ) const
inline

Gets the content mask.

Returns
Content mask value.
float kanzi::OutlineEffectRenderer2D::getContentOffset ( ) const
inline

Gets the content offset.

Returns
Content offset value.
void kanzi::OutlineEffectRenderer2D::setOutlineTexture ( TextureSharedPtr  texture)

Sets the outline texture.

Parameters
textureThe texture to apply to the outline.
TextureSharedPtr kanzi::OutlineEffectRenderer2D::getOutlineTexture ( ) const
inline

Gets the outline texture.

Returns
Texture used for coloring the outline.
void kanzi::OutlineEffectRenderer2D::setOutlineTextureSettings ( Vector2  settings)

Sets the texture settings.

Parameters
settingsTexture settings, offset and scale.
Vector2 kanzi::OutlineEffectRenderer2D::getOutlineTextureSettings ( ) const
inline

Gets the texture settings.

Returns
Texture settings packed into a Vector2, offset and scale.
void kanzi::OutlineEffectRenderer2D::setMethod ( OutlineEffect2D::OutlineMethod  method)

Sets the outline calculation method.

Parameters
methodMethod for calculation.
OutlineEffect2D::OutlineMethod kanzi::OutlineEffectRenderer2D::getMethod ( ) const
inline

Gets the outline calculation method.

Returns
Method for outline calculation.
void kanzi::OutlineEffectRenderer2D::setWidths ( unsigned int  outerWidth,
unsigned int  innerWidth 
)

Sets the maximum thickness of the outline.

Parameters
outerWidthThe maximum thickness of the outer outline in pixels.
innerWidthThe maximum thickness of the inner outline in pixels.
unsigned int kanzi::OutlineEffectRenderer2D::getOuterWidth ( ) const
inline

Gets the maximum thickness of the outline outside the content area.

Returns
Thickness of the outer outline in pixels.
unsigned int kanzi::OutlineEffectRenderer2D::getInnerWidth ( ) const
inline

Gets the maximum thickness of the outline inside the content area.

Returns
Thickness of the inner outline in pixels.
void kanzi::OutlineEffectRenderer2D::setSoftness ( Vector2  softness)

Sets the softness of the outline.

Parameters
softnessThe softness of the outline as a two-component vector: outer softness, inner softness.
Vector2 kanzi::OutlineEffectRenderer2D::getSoftness ( ) const
inline

Gets the outline softness.

Returns
The softness of the outline as a two-component vector: outer softness, inner softness.
void kanzi::OutlineEffectRenderer2D::setBlendMode ( optional< int >  blendMode)

Sets the blend mode override used for rendering the outline.

Parameters
blendModeBlend mode to use, or nullopt to use default blend mode.
Since
Kanzi 3.9.8
optional<int> kanzi::OutlineEffectRenderer2D::getBlendMode ( ) const
inline

Gets the blend mode override.

Returns
If blend mode override active, the blend mode, otherwise nullopt.
Since
Kanzi 3.9.8
bool kanzi::OutlineEffectRenderer2D::supportsBlitBlendMode ( int  blendMode)
overrideprotectedvirtual
void kanzi::OutlineEffectRenderer2D::beginEffectOverride ( Renderer3D renderer,
CompositionStack compositionStack,
CompositionManager compositionManager,
const Matrix3x3 worldTransform,
const CompositionContentRequirements requirements 
)
overrideprotectedvirtual
void kanzi::OutlineEffectRenderer2D::endEffectOverride ( Renderer3D renderer,
CompositionStack compositionStack,
CompositionManager compositionManager 
)
overrideprotectedvirtual
void kanzi::OutlineEffectRenderer2D::blitEffectOverride ( Renderer3D renderer,
CompositionStack compositionStack,
CompositionManager compositionManager,
const QuadDescription effectQuad,
const Matrix3x3 transform,
const Matrix4x4 perspectiveMatrix,
const Matrix4x4 projectionMatrix,
int  blendMode,
bool  needsClear 
)
overrideprotectedvirtual
void kanzi::OutlineEffectRenderer2D::restoreResourcesOverride ( )
overrideprotectedvirtual
void kanzi::OutlineEffectRenderer2D::createOutlineEffectPasses ( )
protected

Creates the effect passes.

Kanzi executes this function when the outline method changes. If only outline settings change but the method does not, use validateEffectPasses().

void kanzi::OutlineEffectRenderer2D::validateContentMaskParameters ( )
protected

Prepares the parameters for content masking.

void kanzi::OutlineEffectRenderer2D::validateEffectPasses ( Vector2  nodeSize)
protected

Prepares the effect passes.

Parameters
nodeSizeSize of the node.
void kanzi::OutlineEffectRenderer2D::validateRenderStates ( )
protected

Prepares the render states.

void kanzi::OutlineEffectRenderer2D::onRenderEffectOnlyChanged ( )
overrideprotectedvirtual
void kanzi::OutlineEffectRenderer2D::validateContentColorScale ( )
protected

Validates the content color scale.

Since
Kanzi 3.9.8

Member Data Documentation

OutlineEffect2D::OutlineMethod kanzi::OutlineEffectRenderer2D::m_method
protected

Outline calculation method.

EffectRenderState kanzi::OutlineEffectRenderer2D::m_passRenderState1
protected

First pass render state.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_boxStepHandle1
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_contentMaskHandle1
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_contentOffsetHandle1
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_innerRadiusHandle1
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_outerRadiusHandle1
protected

Render state handle.

EffectRenderState kanzi::OutlineEffectRenderer2D::m_passRenderState2
protected

Second pass render state (optional).

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_boxStepHandle2
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_innerRadiusHandle2
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_outerRadiusHandle2
protected

Render state handle.

EffectRenderState kanzi::OutlineEffectRenderer2D::m_blitRenderState
protected

Blit render state.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_contentGradientHandle
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_colorHandle
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_outlineTextureHandle
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_outlineTextureSettingsHandle
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_softnessHandle
protected

Render state handle.

GlRenderState::HandleType kanzi::OutlineEffectRenderer2D::m_contentColorScaleHandle
protected

Render state handle.

EffectRenderState kanzi::OutlineEffectRenderer2D::m_nodeBlitRenderState
protected

Separated node blit render state.

bool kanzi::OutlineEffectRenderer2D::m_cachedMaskInvert
protected

Input masking invert value from the effect.

Vector4 kanzi::OutlineEffectRenderer2D::m_cachedMask
protected

Input mask value from the effect.

float kanzi::OutlineEffectRenderer2D::m_cachedMaskThreshold
protected

Input masking threshold value from the effect.

TextureSharedPtr kanzi::OutlineEffectRenderer2D::m_outlineTexture
protected

Outline texture.

Kanzi applies this texture to the outline and modulates the color values in the texture with the outline color. If nullptr, the outline uses only color.

Vector2 kanzi::OutlineEffectRenderer2D::m_outlineTextureSettings
protected

Texture settings.

Defines the offset and scale of the outline texture.

ColorRGBA kanzi::OutlineEffectRenderer2D::m_color
protected

Color of the outline.

When the outline texture is set, this color modulates the color values in that texture.

unsigned int kanzi::OutlineEffectRenderer2D::m_outerWidth
protected

Maximum outline thickness outside the content area.

unsigned int kanzi::OutlineEffectRenderer2D::m_innerWidth
protected

Maximum outline thickness inside the content area.

Vector2 kanzi::OutlineEffectRenderer2D::m_softness
protected

Outline softness.

First component is outer softness, second component is inner softness.

float kanzi::OutlineEffectRenderer2D::m_contentColorScale
protected

Scale factor for the content color.

Vector2 kanzi::OutlineEffectRenderer2D::m_contentGradient
protected

Content fade-out gradient.

Components X and Y determine content falloff outside the border.

Vector4 kanzi::OutlineEffectRenderer2D::m_contentMask
protected

Content masking vector.

float kanzi::OutlineEffectRenderer2D::m_contentOffset
protected

Content offset value.

Vector2 kanzi::OutlineEffectRenderer2D::m_cachedNodeSize
protected

The node size that Kanzi uses when it validates the effect passes.

int kanzi::OutlineEffectRenderer2D::m_passIndex1
protected

Index of the first pass.

int kanzi::OutlineEffectRenderer2D::m_passIndex2
protected

Index of the second pass.

int kanzi::OutlineEffectRenderer2D::m_blitPassIndex
protected

Index of the blit pass.

int kanzi::OutlineEffectRenderer2D::m_nodeBlitPassIndex
protected

Index of the separated node blit pass.

bool kanzi::OutlineEffectRenderer2D::m_effectPassesDirty
protected

Dirty bits from parameters being modified.

optional<int> kanzi::OutlineEffectRenderer2D::m_outlineBlendMode
protected

Optional blend mode override for the outline.


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