Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::canvas::EffectChain Class Reference

Chains multiple effects in sequence. More...

#include <view_effect.hpp>

Public Member Functions

void add (std::shared_ptr< ViewEffect > effect)
void configure_layer (Canvas &canvas, float x, float y, float w, float h) override
 Push the compositing layer(s) this effect needs, configured with its opacity, image filters, blend mode, etc.
int layer_count () const override
 One layer per child, summed — a chain pushes as many layers as it has effects.
bool needs_layer () const override
 Whether this effect requires a compositing layer (most do).
void paint_overlay (Canvas &canvas, float x, float y, float w, float h) override
 Forward the overlay to every child (in order).
const std::vector< std::shared_ptr< ViewEffect > > & effects () const

Detailed Description

Chains multiple effects in sequence.

Member Function Documentation

◆ add()

void pulp::canvas::EffectChain::add ( std::shared_ptr< ViewEffect > effect)
inline

◆ configure_layer()

void pulp::canvas::EffectChain::configure_layer ( Canvas & canvas,
float x,
float y,
float w,
float h )
inlineoverridevirtual

Push the compositing layer(s) this effect needs, configured with its opacity, image filters, blend mode, etc.

The subtree paints into the layer(s); the caller pops them once the subtree is done.

An implementation MUST push exactly layer_count() layers. The caller (View::paint_all) pops that many, so an effect that saves a different number than it reports unbalances the canvas save stack for the rest of the frame.

Implements pulp::canvas::ViewEffect.

◆ effects()

const std::vector< std::shared_ptr< ViewEffect > > & pulp::canvas::EffectChain::effects ( ) const
inline

◆ layer_count()

int pulp::canvas::EffectChain::layer_count ( ) const
inlineoverridevirtual

One layer per child, summed — a chain pushes as many layers as it has effects.

Reporting 1 here (the base default) would leak every layer past the first on every paint.

Reimplemented from pulp::canvas::ViewEffect.

◆ needs_layer()

bool pulp::canvas::EffectChain::needs_layer ( ) const
inlineoverridevirtual

Whether this effect requires a compositing layer (most do).

Reimplemented from pulp::canvas::ViewEffect.

◆ paint_overlay()

void pulp::canvas::EffectChain::paint_overlay ( Canvas & canvas,
float x,
float y,
float w,
float h )
inlineoverridevirtual

Forward the overlay to every child (in order).

Non-overlay effects have an empty paint_overlay, so only the overlay-drawing ones (vignette) act.

Reimplemented from pulp::canvas::ViewEffect.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/canvas/include/pulp/canvas/view_effect.hpp