Package-level declarations

Types

Link copied to clipboard

Moves, rotates and scales the image around pivot: the image is scaled by scale, rotated by rotation degrees and moved by translation

Link copied to clipboard
sealed interface BlendLayer

The layer of a EffectStage.Blend

Link copied to clipboard
abstract class BlendPreset : Preset

A blend: a function vec4 blend(vec4 base, vec4 layer) that combines a layer color with a base color

Link copied to clipboard
class ChainColor(first: ColorPreset = Grade(), second: ColorPreset = Vignette()) : ColorPreset

Applies first, then second

Link copied to clipboard
class ChainWarp(first: WarpPreset = Ripple(), second: WarpPreset = Swirl()) : WarpPreset

Warps with first, then with second

Link copied to clipboard

A checkerboard of xCells by yCells cells in colors even and odd

Link copied to clipboard

Chromatic aberration: reads red amount pixels to the left and blue amount pixels to the right

Link copied to clipboard

Maps the luma of the colors to a colormap: the luma between minValue and maxValue, raised to curve, picks the color. amount mixes the mapped colors with the original ones.

Link copied to clipboard

the colormaps of Colormap

Link copied to clipboard
abstract class ColorPreset : Preset

A color operation: a function vec4 color(vec4 c, vec2 uv) that maps the color c at texture coordinate uv to a new color. The operations below change the rgb channels as they are stored and keep alpha.

Link copied to clipboard
data class ColorStop(val offset: Double, val color: ColorRGBa)

A color stop of a gradient: color at offset, from 0 to 1 along the gradient

Link copied to clipboard
class ConstantScalar(value: Double = 0.0) : ScalarPreset

The same value for every pixel

Link copied to clipboard
class ConstantVector2(value: Vector2 = Vector2.ZERO) : Vector2Preset

The same value for every pixel

Link copied to clipboard

Ordered dithering to levels levels per channel with a pattern from "arithmetic dither". The pattern is aligned to the pixels of the output.

Link copied to clipboard

the masks of Dither

Link copied to clipboard

Maps the luma of the colors from background to foreground, interpolated in OKLab when labInterpolation

Link copied to clipboard
class EffectChain(stages: List<EffectStage> = emptyList()) : Filter1to1

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.

Link copied to clipboard

Builds the stages of an EffectChain

Link copied to clipboard
sealed interface EffectStage

A stage of an EffectChain

Link copied to clipboard

Film grain, which changes rate times per second with the time of the context, fx_time(), see fxContextLibrary; strength and pitch set the strength and size of the grain, liftRatio mixes multiplied grain (0) with added grain (1). Colored grain is desaturated by colorLevel. The grain is aligned to the pixels of the output. Like every preset that reads the context, it is for effect chains, preset filters and shaders that set the context, see setFxContext.

Link copied to clipboard

Bulges the image (positive strength) or pinches it (negative strength) along axes turned by rotation degrees, then scales it by scale

Link copied to clipboard
class GlslContract(val returnType: String, vararg val argumentTypes: String)

The GLSL signature a preset slot accepts: a function returning returnType that takes argumentTypes, or, without argument types, a value of returnType such as a GLSL parameter or a texture parameter.

Link copied to clipboard

Color grading: exposure in stops, contrast around mid gray, saturation around the luma and gamma

Link copied to clipboard

the color space that the colors of a gradient are interpolated in

Link copied to clipboard

what a gradient does beyond its first and last stop

Link copied to clipboard

Inverts the colors, by amount

Link copied to clipboard
class InvertMask(mask: MaskPreset = RadialGradientMask()) : MaskPreset

1 minus mask

Link copied to clipboard

Mirrors the image into segments wedges around center, turned by rotation degrees

Link copied to clipboard
class Layer(source: SourcePreset = NoiseSource(), blend: BlendPreset = LayerBlend()) : ColorPreset

Blends the colors of source over the colors with blend

Link copied to clipboard
class LayerBlend(mode: LayerBlendMode = LayerBlendMode.NORMAL) : BlendPreset

Blends the rgb channels of the layer with those of the base by mode, weighted by the alpha of the layer and opacity. The alpha of the base is kept. Changing the mode does not compile another shader.

Link copied to clipboard

the blend modes of LayerBlend

Link copied to clipboard

Levels: maps inBlack..inWhite to 0..1, applies gamma, then maps 0..1 to outBlack..outWhite

Link copied to clipboard
Link copied to clipboard
class LinearGradientPaint(start: Vector2 = Vector2(0.0, 0.0), end: Vector2 = Vector2(1.0, 0.0), stops: List<ColorStop> = listOf(ColorStop(0.0, ColorRGBa.BLACK), ColorStop(1.0, ColorRGBa.WHITE)), spread: GradientSpread = GradientSpread.PAD) : StopsGradientPaint

A linear gradient from start (offset 0) to end (offset 1), like SVG's linearGradient

Link copied to clipboard

0 at start to 1 at end, in texture coordinates

Link copied to clipboard

from at start to to at end, in texture coordinates

Link copied to clipboard

A halftone of the luma: black where the luma times a pattern of cosine lines is below threshold, white elsewhere, or the other way around when invert. The pattern, lines at freq0 with a cosine wobble of freq1 and gain1, turned by rotation degrees, is antialiased by sampling it 7 by 7 times per pixel.

Link copied to clipboard

foreground where the luma is at least threshold, background elsewhere

Link copied to clipboard
class Masked(color: ColorPreset = Grade(), mask: MaskPreset = RadialGradientMask()) : ColorPreset

Applies color where mask is 1, keeps the colors where it is 0, and mixes in between

Link copied to clipboard
abstract class MaskPreset : Preset

A mask: a function float mask(vec2 uv) from 0 to 1 of a texture coordinate. Unlike a ScalarPreset, which is read at the pixel itself, a mask is read at the coordinate it is given, so warps before it move it.

Link copied to clipboard
abstract class MultiPassPresetFilter(passStyles: List<ShadeStyle>) : Filter1to1, PresetFilter

A filter of several passes, each a shade style, with preset slots that every pass reads: like a separable blur, of which both passes read the radius. Make the slots with slot, apply the passes with applyPass, and keep the images between passes in intermediates. The fragment transforms of the passes end with FX_CONTEXT_USE, so that the presets in the slots can read fxContextLibrary.

Link copied to clipboard

Fractal simplex noise, from 0 where the noise is below threshold to 1 over softness, of coordinates scaled by scale and moved by offset, with octaves octaves

Link copied to clipboard

Fractal simplex noise in 0..1, of texture coordinates scaled by scale and moved by offset, with octaves octaves

Link copied to clipboard

Fractal simplex noise from from to to, of texture coordinates scaled by scale and moved by offset, with octaves octaves

Link copied to clipboard

Displaces coordinates by fractal simplex noise, with octaves octaves that each scale by lacunarity and are weighted by decay. The noise is sampled on a circle of radius in the third dimension, phase moves along it, which loops for phases that differ by 2.

Link copied to clipboard

Adjusts colors in OKLCh: adds lightness, scales the chroma by chroma and turns the hue by hue degrees. The colors are read and written as sRGB.

Link copied to clipboard
enum class PaintFit : Enum<PaintFit>

how a paint in PaintUnits.BOUNDS units fits bounds that are not square

Link copied to clipboard
class PaintLayer(val source: SourcePreset, val units: PaintUnits = PaintUnits.BOUNDS, val transform: Matrix44 = Matrix44.IDENTITY, val fit: PaintFit = PaintFit.STRETCH)

A paint of a PaintStyle: source read at coordinates in units, transformed by the inverse of transform. In PaintUnits.BOUNDS units fit keeps the aspect ratio of the paint in bounds that are not square, before the transform; for other units it does nothing, put it in the transform.

Link copied to clipboard
class PaintStyle(val fill: PaintLayer?, val stroke: PaintLayer?) : ShadeStyle

A shade style that paints the fills and strokes of shapes with sources, such as gradients: the color of the source replaces the color of the fill or stroke, their alpha multiplies. A fill or stroke without a paint keeps its color. All PaintUnits work for shapes, contours, circles and rectangles, also drawn in batches.

Link copied to clipboard
Link copied to clipboard
enum class PaintUnits : Enum<PaintUnits>

the coordinates that a paint is read at

Link copied to clipboard

Reads every pixel at the center of its cell in a grid of xCells by yCells cells

Link copied to clipboard

Reduces every channel to levels levels

Link copied to clipboard
interface Preset : DynamicParameterSource

A preset: an object with annotated properties that provides a DynamicParameter for a slot with contract. Presets are assigned to the slots of filters, shade styles and other presets, see presetSlot.

Link copied to clipboard
interface PresetFilter

A filter with preset slots: presets that vary what it does per pixel, like the radius of a blur. A graph or an EffectChain treats it as a pass of its own, or several, sets its slots, and sets the values of fxContextLibrary before applying it.

Link copied to clipboard
class PresetSlot<P : Preset>(targets: List<StyleParameters>, val name: String, val contract: GlslContract, initial: P) : ReadWriteProperty<Any?, P>

A property that holds a preset and sets it as the parameter name of every one of targets: shade styles, the passes of a filter, or the function of another preset. Assigned presets must have contract.

Link copied to clipboard

1 within radius from center, to 0 over softness

Link copied to clipboard
class RadialGradientPaint(center: Vector2 = Vector2(0.5, 0.5), radius: Double = 0.5, focal: Vector2 = center, focalRadius: Double = 0.0, stops: List<ColorStop> = listOf(ColorStop(0.0, ColorRGBa.WHITE), ColorStop(1.0, ColorRGBa.BLACK)), spread: GradientSpread = GradientSpread.PAD) : StopsGradientPaint

A radial gradient, like SVG's radialGradient: offset 0 is the circle at focal with radius focalRadius, offset 1 the circle at center with radius, the circles in between are interpolated

Link copied to clipboard

1 at center to 0 at radius from it, in texture coordinates

Link copied to clipboard

from at center to to at radius from it, in texture coordinates

Link copied to clipboard

Displaces coordinates along sines: x by the sine of y and y by the sine of x

Link copied to clipboard
abstract class SamplerPreset : Preset

A sampler: a function vec4 sample(sampler2D image, vec2 uv) that reads an image at and around a texture coordinate. In an EffectChain a sampler reads the image as it is after the stages before it, which takes a pass of its own.

Link copied to clipboard
abstract class ScalarPreset : Preset

A float that can vary per pixel, for slots that read it as p_<name>

Link copied to clipboard

Sepia toning, by amount

Link copied to clipboard
class SolidSource(color: ColorRGBa = ColorRGBa.WHITE) : SourcePreset

The same color everywhere

Link copied to clipboard
abstract class SourcePreset : Preset

A source: a function vec4 source(vec2 uv) that generates the color at texture coordinate uv. In an EffectChain a source replaces the image, in a Layer it is blended over the image.

Link copied to clipboard
abstract class StopsGradientPaint(stops: List<ColorStop>) : SourcePreset

The base of gradients with color stops: the gradient function t of a coordinate picks a color from the stops. The code of the gradient depends on the number of stops, a gradient with another number of stops compiles another shader.

Link copied to clipboard

Rotates coordinates around center by angle radians, less further from the center, as set by falloff

Link copied to clipboard
class TextureMask(texture: ColorBuffer) : MaskPreset

The red channel of texture

Link copied to clipboard
class TexturePaint(texture: ColorBuffer) : SourcePreset

The colors of texture, read at texture coordinates: 0..1 covers the texture once, the wrap mode of the texture decides what lies beyond, set it to repeat to tile the texture. The texture holds premultiplied colors, as render targets that are drawn to do, the colors are read without the premultiplication. Replacing the texture does not compile another shader.

Link copied to clipboard
class TextureScalar(var texture: ColorBuffer, var coordinate: String = TextureParameter.DEFAULT_COORDINATE) : ScalarPreset

The red channel of texture at coordinate, which by default covers what is drawn, or the input of a filter

Link copied to clipboard
class TextureVector2(var texture: ColorBuffer, var coordinate: String = TextureParameter.DEFAULT_COORDINATE) : Vector2Preset

The red and green channels of texture at coordinate, which by default covers what is drawn, or the input of a filter

Link copied to clipboard

Multiplies the colors by color, by amount

Link copied to clipboard
abstract class Vector2Preset : Preset

A vec2 that can vary per pixel, for slots that read it as p_<name>

Link copied to clipboard

Darkens toward the edges: by amount outside radius from center, over a band of softness

Link copied to clipboard
abstract class WarpPreset : Preset

A warp: a function vec2 warp(vec2 uv) that maps a coordinate to the coordinate to read from

Link copied to clipboard

Displaces x by a cosine of y, or y by a cosine of x when vertical. phase is in half periods, segments quantizes the wave into steps when it is larger than 0.

Properties

Link copied to clipboard
val aDitherLibrary: GlslLibrary

GLSL library with the ordered dither masks of orx-fx: float a_dither(int pattern, int levels, float l, ivec2 p, int c) quantizes l to levels levels with the mask pattern (0 to 3) at pixel p for channel c

Link copied to clipboard
val bump3yLibrary: GlslLibrary

GLSL library with vec3 bump3y(vec3 x, vec3 yoffset), used by spectralZucconi6Library

Link copied to clipboard
val filmGrainLibrary: GlslLibrary

GLSL library with the film grain of orx-fx: float film_grain_source(vec3 x, float strength, float pitch)

Link copied to clipboard

A GLSL statement for the end of a fragment transform that reads the values of fxContextLibrary without changing the result, so that they are in the shader and can be set when none of its presets read them.

Link copied to clipboard
val fxContextLibrary: GlslLibrary

The context of the image an effect makes, for presets that change over time or depend on the size of the image:

Link copied to clipboard
val gradientSpacesLibrary: GlslLibrary

GLSL library that converts linear RGB colors to and from the interpolation spaces of GradientInterpolation

Link copied to clipboard
val oklabLibrary: GlslLibrary

GLSL library with conversions between sRGB and OKLab: oklab_srgb_to_linear, oklab_linear_to_srgb, oklab_from_linear and oklab_to_linear, all vec3 f(vec3 c)

Link copied to clipboard
val snoise3Library: GlslLibrary

GLSL library with 3D simplex noise, float snoise3(vec3 v), which returns values in -1, 1

Link copied to clipboard
val spectralZucconi6Library: GlslLibrary

GLSL library with Alan Zucconi's spectral colormap, vec3 spectral_zucconi6(float x)

Link copied to clipboard
val straightColorLibrary: GlslLibrary

vec4 straight(vec4 c): the straight color of c, a premultiplied color as images hold them; filters that read images and write their colors to x_fill need straight colors, the filter premultiplies them when it writes them

Link copied to clipboard
val turboColormapLibrary: GlslLibrary

GLSL library with the Turbo colormap, vec3 turbo_colormap(float x)

Functions

Link copied to clipboard
fun boundsTransform(bounds: Rectangle): Matrix44

The transform that maps 0..1 to bounds, which turns a paint in PaintUnits.BOUNDS units into one in PaintUnits.OBJECT units: boundsTransform(shape.bounds) * paintTransform

Link copied to clipboard

An EffectChain with the stages that builder adds

Link copied to clipboard

A shade style that paints fills and strokes with sources, such as gradients:

Link copied to clipboard
fun <P : Preset> StyleParameters.presetSlot(name: String, contract: GlslContract, initial: P): PresetSlot<P>

A slot for presets with contract, set as parameter name. Annotate the property with @NestedParameter to show the parameters of the preset in user interfaces:

Link copied to clipboard
fun DynamicParameter.readsFxContext(): Boolean

true when the code of this parameter can read the values of fxContextLibrary: through its libraries, or through those of the dynamic parameters it has as parameters, like the presets in the slots of a preset, at any depth. The presets as they are now: assigning another preset to a slot can change it.

fun GlslLibrary.readsFxContext(): Boolean

true when this library is fxContextLibrary or depends on it, directly or through other libraries

true when this preset can read the values of fxContextLibrary, also through the presets in its slots, so that it changes over time even when nothing else does, see DynamicParameter.readsFxContext

true when a preset in one of the slots of this filter can read the values of fxContextLibrary

Link copied to clipboard
fun StyleParameters.setFxContext(time: Double, frame: Int, resolution: Vector2)

Sets the values of fxContextLibrary: the time in seconds, the number of the frame and the resolution of the image in pixels. For a shade style or a filter whose shader reads them or includes FX_CONTEXT_USE.