API Documentation
Public Member Functions | Static Public Member Functions | List of all members
nkAstraeus::BlurComplexEffect Class Referencefinal

A blurring effect. More...

Inheritance diagram for nkAstraeus::BlurComplexEffect:
nkAstraeus::ComplexEffect

Public Member Functions

 BlurComplexEffect (System *system) noexcept
 
virtual ~BlurComplexEffect ()
 
nkGraphics::TexturegetSourceTexture () const
 
nkGraphics::TexturegetOutputTexture () const
 
unsigned int getKernelRadius () const
 
bool getAlphaEncodesBlurPlanes () const
 
bool getPreserveAlpha () const
 
void setSourceTexture (nkGraphics::Texture *value)
 
void setKernelRadius (unsigned int value)
 
void setAlphaEncodesBlurPlanes (bool value)
 
void setPreserveAlpha (bool value)
 
virtual bool load () override
 
virtual void unload () override
 
- Public Member Functions inherited from nkAstraeus::ComplexEffect
 ComplexEffect (COMPLEX_EFFECT_TYPE type) noexcept
 
virtual ~ComplexEffect ()
 
nkMemory::StringView getName () const
 
nkGraphics::CompositorNodegetCompositorNode () const
 
COMPLEX_EFFECT_TYPE getType () const
 
void setName (nkMemory::StringView value)
 
void setCompositorNode (nkGraphics::CompositorNode *value)
 

Static Public Member Functions

static nkMemory::UniquePtr< BlurComplexEffectcreate (System *system=nullptr)
 

Detailed Description

A blurring effect.

This effect will blur the source texture, given provided parameters.

Constructor & Destructor Documentation

◆ BlurComplexEffect()

nkAstraeus::BlurComplexEffect::BlurComplexEffect ( System system)
noexcept

Default constructor. Alternatively, see BlurComplexEffect::create(), or ComplexEffectManager::createOrRetrieve().

Parameters
systemThe system in which the resource should live.

◆ ~BlurComplexEffect()

virtual nkAstraeus::BlurComplexEffect::~BlurComplexEffect ( )
virtual

Default destructor.

Member Function Documentation

◆ getSourceTexture()

nkGraphics::Texture* nkAstraeus::BlurComplexEffect::getSourceTexture ( ) const
Returns
The source texture used by the effect.

◆ getOutputTexture()

nkGraphics::Texture* nkAstraeus::BlurComplexEffect::getOutputTexture ( ) const
Returns
The texture the effect will finally output to.
Remarks
This texture is tied to the lifetime of the ComplexEffect it is linked to. It will be usable as long as the effect is alive and won't change even after loading operations.

◆ getKernelRadius()

unsigned int nkAstraeus::BlurComplexEffect::getKernelRadius ( ) const
Returns
The kernel radius used.

◆ getAlphaEncodesBlurPlanes()

bool nkAstraeus::BlurComplexEffect::getAlphaEncodesBlurPlanes ( ) const
Returns
Whether the effect considers alpha as encoding blur planes (true) or not (false).

◆ getPreserveAlpha()

bool nkAstraeus::BlurComplexEffect::getPreserveAlpha ( ) const
Returns
Whether the effect will preserve the alpha and blur it like any other channel (true), or not (false).

◆ setSourceTexture()

void nkAstraeus::BlurComplexEffect::setSourceTexture ( nkGraphics::Texture value)

Sets the texture to use as input to the effect.

Parameters
valueThe texture to use as input.
Remarks
This parameter can be updated on an already loaded effect.

◆ setKernelRadius()

void nkAstraeus::BlurComplexEffect::setKernelRadius ( unsigned int  value)

Sets the kernel radius for the blurring operation. Defaults to 5.

Parameters
valueThe radius, in pixel, for the blurring operation. For instance, a radius of 1 will blur using 1 pixel around the reference pixel.
Remarks
This parameter requires an effect reload if updated on an already loaded one.

◆ setAlphaEncodesBlurPlanes()

void nkAstraeus::BlurComplexEffect::setAlphaEncodesBlurPlanes ( bool  value)

Sets whether the effect should consider alpha as encoding blurring planes. Blurring planes can be used to isolate and blur sub-parts of an image, independently. For instance, having a part of an image with an alpha of 0.2, and another one of 0.3, will blur together the pixels with alpha 0.2, excluding the 0.3 pixels, and vice versa. Defaults to false.

Parameters
valueWhether the alpha encodes blurring planes (true) or not (false).
Remarks
This parameter needs the effect to be reloaded if updated on a loaded effect.

◆ setPreserveAlpha()

void nkAstraeus::BlurComplexEffect::setPreserveAlpha ( bool  value)

Sets whether the alpha channel should be preserved while blurring, or not. A preserved alpha channel will either get blurred like any other color channel if not encoding a plane, either keep the plane information after blurring. Defaults to false. If not preserved, the effect will overwrite any alpha information with 1 in the output texture.

Parameters
valueWhether the alpha should be preserved (true) or not (false).
Remarks
This parameters needs the effect to be reloaded if updated on a loaded effect.

◆ load()

virtual bool nkAstraeus::BlurComplexEffect::load ( )
overridevirtual

Loads the effect and make it ready for rendering. After a successful call, this means the compositor node will be populated with the relevant data.

Returns
Whether the loading went well (true) or not (false).

Implements nkAstraeus::ComplexEffect.

◆ unload()

virtual void nkAstraeus::BlurComplexEffect::unload ( )
overridevirtual

Unloads the effect and its internal memory. After that, the effect is unusable for rendering. The compositor node specified will be cleaned from all linked operations.

Implements nkAstraeus::ComplexEffect.

◆ create()

static nkMemory::UniquePtr<BlurComplexEffect> nkAstraeus::BlurComplexEffect::create ( System system = nullptr)
static

Creates an instance of the class, and returns ownership over it.

Parameters
systemThe system the resource should live in. If left to nullptr, will seek the singleton instance of the system.
Returns
Ownership over the created instance of the class.
Remarks
The instance is not part of any manager if instantiated this way. If the resource's lifetime should be managed within the manager, then calling ComplexEffectManager::createOrRetrieve() might be a better option. Alternatively, registering it afterwards through ComplexEffectManager::record() is another option.

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