Composition functionality for 2D nodes. More...
#include <kanzi/core.ui/node/node_compositor2d.hpp>
Classes | |
struct | ManagedCompositionTarget |
Managed composition target container. More... | |
struct | PerspectiveTransformParameters |
Perspective transform container. More... | |
Public Types | |
enum | ComposeChildrenBits { ChildrenCompositingBitCache, ChildrenCompositingBitRequest, ChildrenCompositingBitCount } |
Enum for children compositing bit flags. More... | |
enum | ComposeFinalBits { FinalCompositingBitCache, FinalCompositingBitForce, FinalCompositingBitOffscreen, FinalCompositingBitOpacity, FinalCompositingBitRequest, FinalCompositingBitCount } |
Enum for final result compositing bit flags. More... | |
enum | ComposeSelfBits { SelfCompositingBitCache, SelfCompositingBitRequest, SelfCompositingBitCount } |
Enum for self compositing bit flags. More... | |
Public Member Functions | |
NodeCompositor2D () | |
Constructor. More... | |
tuple< TextureSharedPtr, bool > | beginFinalComposition (CompositionStack &compositionStack, CompositionManager *compositionManager, Vector2 requiredSize, bool alphaRequired, bool depthRequired, bool stencilRequired) |
Begin final composition. More... | |
void | endFinalComposition (CompositionStack &compositionStack) |
End final composition. More... | |
void | blitFinalComposition (Renderer3D &renderer, CompositionStack &compositionStack, CompositionManager *compositionManager, TextureSharedPtr renderTargetTexture, QuadDescription &backgroundQuad, const Matrix3x3 &transform, Vector2 quadSize) |
Blit final composition. More... | |
tuple< TextureSharedPtr, bool > | beginSelfComposition (CompositionStack &compositionStack, Vector2 requiredSize) |
Begin self composition. More... | |
void | endSelfComposition (CompositionStack &compositionStack) |
void | blitSelfComposition (Renderer3D &renderer, CompositionStack &compositionStack, Texture &texture, QuadDescription &backgroundQuad, const Matrix3x3 &transform, Vector2 quadSize) |
Blit self composition. More... | |
tuple< TextureSharedPtr, bool > | beginChildrenComposition (CompositionStack &compositionStack, Vector2 requiredSize) |
Begin children composition. More... | |
void | endChildrenComposition (CompositionStack &compositionStack) |
void | blitChildrenComposition (Renderer3D &renderer, CompositionStack &compositionStack, Texture &texture, QuadDescription &backgroundQuad, const Matrix3x3 &transform, Vector2 quadSize) |
Blit self composition. More... | |
void | renderCompositionQuad (Renderer3D &renderer, BrushRenderer &brushRenderer, const Texture &texture, QuadDescription &backgroundQuad, const Matrix4x4 &transform, Vector2 quadSize) |
Render composition quad. More... | |
void | createCompositionBrushRenderer (Node &node, Brush &brush, TextureSharedPtr texture) |
Create composition brush renderer. More... | |
TextureSharedPtr | getCacheChildrenCompositionTarget () const |
Access cache composition target for Node2D's children. More... | |
TextureSharedPtr | getCacheSelfCompositionTarget () const |
Access cache composition target for Node2D itself. More... | |
TextureSharedPtr | getFinalCompositionTarget () const |
Access 'final' managed composition target. More... | |
void | resizeUserCompositionTarget (Vector2 desiredSize) |
Resize automatic sizes in user composition target if necessary. More... | |
void | onDetached () |
Run when node owning the compositor becomes detached. More... | |
void | restoreResources () |
Restore resources. More... | |
void | updateRender (Node2D &node, Vector2 actualSize, bool alphaRequired, bool depthRequired, bool stencilRequired, float opacity, bool opaquenessHint, bool translucencyHint) |
Update for rendering, recreating composition targets and brush renderers as needed. More... | |
BrushRenderer * | getCacheChildrenBrushRenderer () const |
Access cache children brush renderer. More... | |
BrushRenderer * | getCacheSelfBrushRenderer () const |
Access cache self brush renderer. More... | |
BrushRenderer * | getCompositionBrushRenderer () const |
Access composition brush renderer. More... | |
bool | hasCompositionBrushRenderer () const |
Tell if composition brush renderer has been created. More... | |
bool | hasManagedCompositionTargetFinal () const |
Tell if managed composition target has been created. More... | |
void | setUserCompositionBrush (BrushSharedPtr brush) |
Set user composition brush. More... | |
Vector2 | getUserCompositionTargetSize () const |
Get size of user composition target. More... | |
void | setUserCompositionTarget (TextureSharedPtr texture) |
Set user composition target. More... | |
bool | isCacheChildren () const |
Tell if cache children has been set. More... | |
void | setCacheChildren (bool enabled) |
Set cache children state. More... | |
bool | isCacheResult () const |
Tell if cache result has been set. More... | |
void | setCacheResult (bool enabled) |
Set cache result state. More... | |
bool | isCacheSelf () const |
Tell if cache self has been set. More... | |
void | setCacheSelf (bool enabled) |
Set cache self state. More... | |
void | invalidateCompositionBrush () |
Invalidate composition brush. More... | |
bool | isCacheChildrenValid () const |
Tell if children cache is valid. More... | |
void | setCacheChildrenValid (bool valid) |
Mark self cache as valid. More... | |
bool | isCacheFinalValid () const |
Tell if final cache is valid. More... | |
void | setCacheFinalValid (bool valid) |
Mark final cache as valid. More... | |
bool | isCacheSelfValid () const |
Tell if self cache is valid. More... | |
void | setCacheSelfValid (bool valid) |
Mark self cache as valid. More... | |
bool | isChildrenCompositionRequired () const |
Tell if compositing children is required. More... | |
bool | isFinalCompositionRequired () const |
Tell if compositing final result is required. More... | |
bool | isSelfCompositionRequired () const |
Tell if compositing self is required. More... | |
bool | isFinalCompositionRequested () const |
Is compositing requested from code? More... | |
void | setFinalCompositionRequested (bool enabled) |
Set compositing request. More... | |
bool | isForceComposition () const |
Is force composition on? More... | |
void | setForceComposition (bool enabled) |
Set force composition. More... | |
bool | isOffscreenRendering () const |
Is offscreen rendering on? More... | |
void | setOffscreenRendering (bool enabled) |
Set offscreen rendering flag. More... | |
bool | isOpacityCompositionRequest () const |
Is Opacity composition request flag on? More... | |
void | setOpacityCompositionRequested (bool enabled) |
Set opacity composition request flag. More... | |
void | resetManagedCompositionTargetCacheChildren () |
Reset cache children managed composition target. More... | |
void | resetManagedCompositionTargetCacheSelf () |
Reset cache self managed composition target. More... | |
void | resetManagedCompositionTargetFinal () |
Reset final managed composition target. More... | |
const Matrix4x4 * | getPerspectiveTransform () const |
Access perspective transform. More... | |
void | resetPerspectiveTransform () |
Reset perspective transform. More... | |
void | setPerspectiveTransform (const Matrix4x4 &transform) |
Set perspective transform. More... | |
const Vector4 * | getWorldPerspectiveOffset () const |
Access world perspective transform. More... | |
void | resetWorldPerspectiveOffset () |
Reset world perspective transform. More... | |
void | setWorldPerspectiveOffset (const Vector4 &offset) |
Set world perspective transform. More... | |
Protected Member Functions | |
bool | updatePersistentCompositionTarget (Node2D &node, ManagedCompositionTarget &managedCompositionTarget, Vector2 requiredSize, bool alphaRequired, bool depthRequired, bool stencilRequired) |
Update a managed composition target to match current requirements. More... | |
Protected Attributes | |
ManagedCompositionTarget | m_finalCompositionTarget |
Managed composition target for complete node composition. More... | |
ManagedCompositionTarget | m_cacheChildrenCompositionTarget |
Managed composition target for caching children. More... | |
ManagedCompositionTarget | m_cacheSelfCompositionTarget |
Managed composition target for caching node contents. More... | |
BrushSharedPtr | m_userCompositionBrush |
User-set composition brush. More... | |
TextureSharedPtr | m_userCompositionTarget |
User-set composition target. More... | |
CompositionBrushSharedPtr | m_cacheChildrenBrush |
Brush used to render cached children. More... | |
BrushRendererPtr | m_cacheChildrenBrushRenderer |
Cache children brush renderer. More... | |
CompositionBrushSharedPtr | m_cacheSelfBrush |
Brush used to render cached node itself. More... | |
BrushRendererPtr | m_cacheSelfBrushRenderer |
Cache self brush renderer. More... | |
CompositionBrushSharedPtr | m_managedCompositionBrush |
Composition brush managed by node. More... | |
BrushRendererPtr | m_compositionBrushRenderer |
Composition brush renderer. More... | |
unique_ptr< PerspectiveTransformParameters > | m_perspective |
Perspective components. More... | |
bitset< ChildrenCompositingBitCount > | m_childrenComposeMask |
Bit mask for states affecting whether or not the node should compose its children. More... | |
bitset< FinalCompositingBitCount > | m_finalComposeMask |
Bit mask for states affecting whether or not the node should compose itself and its children. More... | |
bitset< SelfCompositingBitCount > | m_selfComposeMask |
Bit mask for states affecting whether or not the node should compose itself. More... | |
Composition functionality for 2D nodes.
Enum for final result compositing bit flags.
|
inline |
Constructor.
|
protected |
Update a managed composition target to match current requirements.
If the composition target does not exist or the settings required from it have been changed, it is (re)created.
node | Node to attach to. |
managedCompositionTarget | Existing composition target container. |
requiredSize | Size required of the composition target. |
alphaRequired | Alpha requirement. |
depthRequired | Depth requirement. |
stencilRequired | Stencil requirement. |
tuple<TextureSharedPtr, bool> kanzi::NodeCompositor2D::beginFinalComposition | ( | CompositionStack & | compositionStack, |
CompositionManager * | compositionManager, | ||
Vector2 | requiredSize, | ||
bool | alphaRequired, | ||
bool | depthRequired, | ||
bool | stencilRequired | ||
) |
Begin final composition.
compositionStack | Composition stack to use. |
compositionManager | Composition manager to use. |
requiredSize | Size required of the composition target. |
alphaRequired | Alpha requirement. |
depthRequired | Depth requirement. |
stencilRequired | Stencil requirement. |
void kanzi::NodeCompositor2D::endFinalComposition | ( | CompositionStack & | compositionStack | ) |
End final composition.
compositionStack | Composition stack to use. |
void kanzi::NodeCompositor2D::blitFinalComposition | ( | Renderer3D & | renderer, |
CompositionStack & | compositionStack, | ||
CompositionManager * | compositionManager, | ||
TextureSharedPtr | renderTargetTexture, | ||
QuadDescription & | backgroundQuad, | ||
const Matrix3x3 & | transform, | ||
Vector2 | quadSize | ||
) |
Blit final composition.
renderer | Renderer to use. |
compositionStack | Composition stack to use. |
compositionManager | Composition manager to use. |
renderTargetTexture | Render target texture used. |
backgroundQuad | Clip quad for background area. |
transform | Transform used for rendering. |
quadSize | Rendered quad size. |
tuple<TextureSharedPtr, bool> kanzi::NodeCompositor2D::beginSelfComposition | ( | CompositionStack & | compositionStack, |
Vector2 | requiredSize | ||
) |
Begin self composition.
compositionStack | Composition stack to use. |
requiredSize | Size required of the composition target. |
void kanzi::NodeCompositor2D::endSelfComposition | ( | CompositionStack & | compositionStack | ) |
compositionStack | Composition stack to use. Begin self composition. |
void kanzi::NodeCompositor2D::blitSelfComposition | ( | Renderer3D & | renderer, |
CompositionStack & | compositionStack, | ||
Texture & | texture, | ||
QuadDescription & | backgroundQuad, | ||
const Matrix3x3 & | transform, | ||
Vector2 | quadSize | ||
) |
tuple<TextureSharedPtr, bool> kanzi::NodeCompositor2D::beginChildrenComposition | ( | CompositionStack & | compositionStack, |
Vector2 | requiredSize | ||
) |
Begin children composition.
compositionStack | Composition stack to use. |
requiredSize | Size required of the composition target. |
void kanzi::NodeCompositor2D::endChildrenComposition | ( | CompositionStack & | compositionStack | ) |
compositionStack | Composition stack to use. Begin self composition. |
void kanzi::NodeCompositor2D::blitChildrenComposition | ( | Renderer3D & | renderer, |
CompositionStack & | compositionStack, | ||
Texture & | texture, | ||
QuadDescription & | backgroundQuad, | ||
const Matrix3x3 & | transform, | ||
Vector2 | quadSize | ||
) |
void kanzi::NodeCompositor2D::renderCompositionQuad | ( | Renderer3D & | renderer, |
BrushRenderer & | brushRenderer, | ||
const Texture & | texture, | ||
QuadDescription & | backgroundQuad, | ||
const Matrix4x4 & | transform, | ||
Vector2 | quadSize | ||
) |
void kanzi::NodeCompositor2D::createCompositionBrushRenderer | ( | Node & | node, |
Brush & | brush, | ||
TextureSharedPtr | texture | ||
) |
TextureSharedPtr kanzi::NodeCompositor2D::getCacheChildrenCompositionTarget | ( | ) | const |
TextureSharedPtr kanzi::NodeCompositor2D::getCacheSelfCompositionTarget | ( | ) | const |
TextureSharedPtr kanzi::NodeCompositor2D::getFinalCompositionTarget | ( | ) | const |
Access 'final' managed composition target.
Will deploy the composition target if necessary.
void kanzi::NodeCompositor2D::resizeUserCompositionTarget | ( | Vector2 | desiredSize | ) |
Resize automatic sizes in user composition target if necessary.
desiredSize | Desired size to resize to. |
void kanzi::NodeCompositor2D::onDetached | ( | ) |
Run when node owning the compositor becomes detached.
void kanzi::NodeCompositor2D::restoreResources | ( | ) |
Restore resources.
void kanzi::NodeCompositor2D::updateRender | ( | Node2D & | node, |
Vector2 | actualSize, | ||
bool | alphaRequired, | ||
bool | depthRequired, | ||
bool | stencilRequired, | ||
float | opacity, | ||
bool | opaquenessHint, | ||
bool | translucencyHint | ||
) |
Update for rendering, recreating composition targets and brush renderers as needed.
node | Node to attach to. |
actualSize | Size required of the composition target. |
alphaRequired | Alpha requirement. |
depthRequired | Depth requirement. |
stencilRequired | Stencil requirement. |
opacity | Opacity value that should be used for rendering. |
opaquenessHint | Should opaque rendering especially be used? |
translucencyHint | Should translucent rendering especially be used? |
|
inline |
Access cache children brush renderer.
|
inline |
Access cache self brush renderer.
|
inline |
Access composition brush renderer.
|
inline |
Tell if composition brush renderer has been created.
|
inline |
Tell if managed composition target has been created.
|
inline |
Set user composition brush.
|
inline |
Get size of user composition target.
|
inline |
Set user composition target.
|
inline |
Tell if cache children has been set.
|
inline |
Set cache children state.
enabled | New cache children state. |
|
inline |
Tell if cache result has been set.
|
inline |
Set cache result state.
enabled | New cache result state. |
|
inline |
Tell if cache self has been set.
|
inline |
Set cache self state.
enabled | New cache children state. |
|
inline |
Invalidate composition brush.
|
inline |
Tell if children cache is valid.
|
inline |
Mark self cache as valid.
valid | New validity status. |
|
inline |
Tell if final cache is valid.
|
inline |
Mark final cache as valid.
valid | New validity status. |
|
inline |
Tell if self cache is valid.
|
inline |
Mark self cache as valid.
valid | New validity status. |
|
inline |
Tell if compositing children is required.
|
inline |
Tell if compositing final result is required.
|
inline |
Tell if compositing self is required.
|
inline |
Is compositing requested from code?
|
inline |
Set compositing request.
|
inline |
Is force composition on?
|
inline |
Set force composition.
|
inline |
Is offscreen rendering on?
|
inline |
Set offscreen rendering flag.
|
inline |
Is Opacity composition request flag on?
|
inline |
Set opacity composition request flag.
|
inline |
Reset cache children managed composition target.
|
inline |
Reset cache self managed composition target.
|
inline |
Reset final managed composition target.
|
inline |
Access perspective transform.
|
inline |
Reset perspective transform.
|
inline |
Set perspective transform.
transform | Perspective transform to use. |
|
inline |
Access world perspective transform.
|
inline |
Reset world perspective transform.
|
inline |
Set world perspective transform.
transform | World perspective transform to use. |
|
protected |
Managed composition target for complete node composition.
|
protected |
Managed composition target for caching children.
|
protected |
Managed composition target for caching node contents.
|
protected |
User-set composition brush.
|
protected |
User-set composition target.
|
protected |
Brush used to render cached children.
|
protected |
Cache children brush renderer.
|
protected |
Brush used to render cached node itself.
|
protected |
Cache self brush renderer.
|
protected |
Composition brush managed by node.
|
protected |
Composition brush renderer.
|
protected |
Perspective components.
|
protected |
Bit mask for states affecting whether or not the node should compose its children.
|
protected |
Bit mask for states affecting whether or not the node should compose itself and its children.
|
protected |
Bit mask for states affecting whether or not the node should compose itself.