kanzi::BrushRenderer Class Referenceabstract

Brush renderer class. More...

#include <kanzi/core.ui/platform/graphics_backend/gl/brush_renderer.hpp>

Inheritance diagram for kanzi::BrushRenderer:
kanzi::GlBrushRenderer kanzi::ColorBrushRenderer kanzi::ContentBrushRenderer kanzi::MaterialBrushRenderer kanzi::TextureBrushRenderer kanzi::CompositionBrushRenderer

Public Types

enum  RenderMode {
  RenderModeNone, RenderModeInvalid, RenderModeOpaqueNoContent, RenderModeTranslucentNoContent,
  RenderModeOpaque, RenderModeTranslucent
}
 Enum signifying currently selected render mode. More...
 

Public Member Functions

virtual ~BrushRenderer ()
 Destructor. More...
 
void updateRender (bool forceOpaque, bool translucencyHint)
 Called from Node2D::updateRender(), prepare brush for rendering. More...
 
void updateRender (bool forceOpaque)
 Default parameter override for updateRender(). More...
 
void updateRender ()
 Default parameter override for updateRender(). More...
 
void bind (Renderer3D &renderer)
 Bind brush renderer for rendering. More...
 
void draw (Renderer3D &renderer, const Geometry &quad, const Matrix4x4 &transform) const
 Draw a brush using given quad. More...
 
void draw (Renderer3D &renderer, const Geometry &quad, const Matrix3x3 &transform) const
 Overload for draw a brush using given quad. More...
 
void restoreResources ()
 Restore resources after sleep. More...
 
BrushgetBrush () const
 Access brush. More...
 
unsigned int getPropertyChangeCounter () const
 Access property change counter. More...
 
float getRenderOpacity () const
 Access opacity. More...
 
void setRenderOpacity (float opacity)
 Set opacity to use for next attach. More...
 
TextureSharedPtr getContentTexture () const
 Access content texture. More...
 
void setContentTexture (TextureSharedPtr texture)
 Set a content texture. More...
 
NodegetNode () const
 Access node. More...
 
RenderMode getRenderMode () const
 Get currently selected render mode. More...
 
bool hasRenderMode () const
 Tell if any (valid) render mode selection has been made. More...
 
bool hasOpaqueRenderMode () const
 Tell if selected render mode is opaque. More...
 

Protected Member Functions

 BrushRenderer (Brush *brush, Node *node)
 Constructor. More...
 
virtual void drawOverride (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform) const =0
 Draw a clip quad. More...
 
virtual void bindOverride (Renderer3D &renderer)=0
 BrushRenderer-specific bind implementation. More...
 
virtual void updateRenderOverride (bool forceOpaque, bool translucencyHint)=0
 BrushRenderer-specific opacity override implementation. More...
 
virtual void restoreResourcesOverride ()=0
 BrushRenderer-specific restore resources implementation. More...
 
void setRenderMode (RenderMode selection)
 Set render mode. More...
 
bool isChangeCounterSame () const
 Check if property change counter matches that of the brush. More...
 
void updateChangeCounter ()
 Update property change counter to match brush. More...
 

Detailed Description

Brush renderer class.

Just an interface, actual rendering will be implemented by specialized brush renderers.

Member Enumeration Documentation

Enum signifying currently selected render mode.

Enumerator
RenderModeNone 

No selection.

RenderModeInvalid 

Invalid render mode - selection has been done but suitable render mode could not be selected.

RenderModeOpaqueNoContent 

Opaque without content.

RenderModeTranslucentNoContent 

Translucent without content.

RenderModeOpaque 

Opaque with content.

RenderModeTranslucent 

Translucent with content.

Constructor & Destructor Documentation

virtual kanzi::BrushRenderer::~BrushRenderer ( )
inlinevirtual

Destructor.

kanzi::BrushRenderer::BrushRenderer ( Brush brush,
Node node 
)
inlineexplicitprotected

Constructor.

Parameters
nodeNode to attach to.
brushBrush to attach to.

Member Function Documentation

void kanzi::BrushRenderer::updateRender ( bool  forceOpaque,
bool  translucencyHint 
)

Called from Node2D::updateRender(), prepare brush for rendering.

updateRender() should be called when brush material or attached nodes have been changed. Unlike bind(), updateRender() does not need to be called every frame before draw().

Parameters
forceOpaqueShould opaque render mode be selected no matter what?
translucencyHintAdditional hint to use translucent rendering.
void kanzi::BrushRenderer::updateRender ( bool  forceOpaque)
inline

Default parameter override for updateRender().

Allows forcing opacity, in this situation translucency hint does not matter.

Parameters
forceOpaqueShould opaque render mode be selected no matter what?
void kanzi::BrushRenderer::updateRender ( )
inline

Default parameter override for updateRender().

Opaqueness force and translucency hint are off.

void kanzi::BrushRenderer::bind ( Renderer3D renderer)

Bind brush renderer for rendering.

Must be called before calling draw().

Parameters
rendererRenderer to use.
void kanzi::BrushRenderer::draw ( Renderer3D renderer,
const Geometry quad,
const Matrix4x4 transform 
) const

Draw a brush using given quad.

Parameters
rendererRenderer to use.
quadQuad to draw.
transformTransform (4X4) to use.
void kanzi::BrushRenderer::draw ( Renderer3D renderer,
const Geometry quad,
const Matrix3x3 transform 
) const
inline

Overload for draw a brush using given quad.

Parameters
rendererRenderer to use.
quadQuad to draw.
transformTransform (3X3) to use.
void kanzi::BrushRenderer::restoreResources ( )

Restore resources after sleep.

Brush* kanzi::BrushRenderer::getBrush ( ) const
inline

Access brush.

Returns
Brush pointer.
unsigned int kanzi::BrushRenderer::getPropertyChangeCounter ( ) const
inline

Access property change counter.

float kanzi::BrushRenderer::getRenderOpacity ( ) const
inline

Access opacity.

Returns
Current render opacity.
void kanzi::BrushRenderer::setRenderOpacity ( float  opacity)
inline

Set opacity to use for next attach.

Parameters
opacityNew render opacity.
TextureSharedPtr kanzi::BrushRenderer::getContentTexture ( ) const
inline

Access content texture.

Returns
Current content texture.
void kanzi::BrushRenderer::setContentTexture ( TextureSharedPtr  texture)
inline

Set a content texture.

Parameters
textureNew render texture.
Node* kanzi::BrushRenderer::getNode ( ) const
inline

Access node.

Returns
Node pointer.
RenderMode kanzi::BrushRenderer::getRenderMode ( ) const
inline

Get currently selected render mode.

Returns
Current render mode.
bool kanzi::BrushRenderer::hasRenderMode ( ) const
inline

Tell if any (valid) render mode selection has been made.

bool kanzi::BrushRenderer::hasOpaqueRenderMode ( ) const
inline

Tell if selected render mode is opaque.

virtual void kanzi::BrushRenderer::drawOverride ( Renderer3D renderer,
const Geometry geometry,
const Matrix4x4 transform 
) const
protectedpure virtual

Draw a clip quad.

To be implemented by specific brush implementations.

Parameters
rendererRenderer to use.
geometryQuad to draw.
transformTransform to use.

Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::MaterialBrushRenderer, and kanzi::ContentBrushRenderer.

virtual void kanzi::BrushRenderer::bindOverride ( Renderer3D renderer)
protectedpure virtual

BrushRenderer-specific bind implementation.

Implemented in kanzi::MaterialBrushRenderer, kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, and kanzi::ContentBrushRenderer.

virtual void kanzi::BrushRenderer::updateRenderOverride ( bool  forceOpaque,
bool  translucencyHint 
)
protectedpure virtual

BrushRenderer-specific opacity override implementation.

Parameters
forceOpaqueShould opaque render mode be selected no matter what?
translucencyHintAdditional hint to use translucent rendering.

Implemented in kanzi::MaterialBrushRenderer, kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, and kanzi::ContentBrushRenderer.

virtual void kanzi::BrushRenderer::restoreResourcesOverride ( )
protectedpure virtual

BrushRenderer-specific restore resources implementation.

Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::MaterialBrushRenderer, and kanzi::ContentBrushRenderer.

void kanzi::BrushRenderer::setRenderMode ( RenderMode  selection)
inlineprotected

Set render mode.

Parameters
selectionNew render mode selection.
bool kanzi::BrushRenderer::isChangeCounterSame ( ) const
inlineprotected

Check if property change counter matches that of the brush.

Returns
True if matches and no update is necessary, false otherwise.
void kanzi::BrushRenderer::updateChangeCounter ( )
inlineprotected

Update property change counter to match brush.


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