EffectChain

class EffectChain(stages: List<EffectStage> = emptyList()) : Filter1to1(source)

A filter that applies stages in order. Consecutive warp, color, source and blend stages are fused into a single pass that reads the input once, filter stages run as passes of their own. A blend stage with the input of the chain as its layer reads the input in whatever pass it is fused into. A source stage replaces the image, the stages before it have no effect. A sample stage reads the image as it is after the stages before it, it starts a pass that reads the input with the sampler. The result is that of applying the stages one after another, without resampling between fused stages.

Changing the properties of the presets and filters of the stages takes effect on the next apply, assigning stages builds the passes again; shaders are shared by chains with the same kinds and classes of stages. Every apply sets the values of fxContextLibrary: time, frame and the size of the image, also for PresetFilter stages.

val chain = effectChain {
warp(Ripple())
color(Grade())
filter(HashBlur())
color(Vignette())
}
chain.apply(image, result)

Constructors

Link copied to clipboard
constructor(stages: List<EffectStage> = emptyList())

Properties

Link copied to clipboard
var depthBufferOut: DepthBuffer?
Link copied to clipboard
var frame: Int

the number of the frame, for presets that read fx_frame(), see fxContextLibrary

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

the number of passes the stages are applied in

Link copied to clipboard

the stages, in the order in which they are applied

Link copied to clipboard

the time in seconds, for presets that read fx_time(), see fxContextLibrary

Functions

Link copied to clipboard
fun apply(source: Array<ColorBuffer>, target: ColorBuffer, clip: Rectangle?)
fun apply(source: Array<ColorBuffer>, target: RenderTarget, clip: Rectangle?)
fun apply(source: ColorBuffer, target: Array<ColorBuffer>, clip: Rectangle?)
fun apply(source: ColorBuffer, target: ColorBuffer, clip: Rectangle?)
open override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?)
Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun destroy()

destroys the intermediate buffers, the filters of the stages are not destroyed

Link copied to clipboard
fun untrack()