Table of Contents

Namespace Egami.Operations

Classes

AnimationOverlayOptions

Options for DrawAnimation(Raster, Point, AnimationOverlayOptions?).

ColorFilter

A function of one pixel's color, as a value: build one from a matrix, curves, a 3D table or a tone step, chain filters with Then(ColorFilter), mix two with Lerp(ColorFilter, ColorFilter, float), run one with ApplyFilter(ColorFilter) or on your own pixels with Apply<TPixel>(Span<TPixel>), and save it as a .cube file through ToLut3D(int). Like Skia's SkColorFilter, a filter sees only the pixel's own straight RGBA: no neighbours, position or image statistics, so any chain of filters runs as one pass.

Compositor

Blends rows of pixels with a BlendMode, for code that composites outside an operation chain: a custom IRasterOperation, a rasterizer filling spans, a layer merge. It runs the kernels DrawImage runs, so Blend<TPixel>(BlendMode, ReadOnlySpan<TPixel>, Span<TPixel>, float, ColorSpace) on a row gives the pixels DrawImage gives there. Every method works for every pixel type, allocates nothing once warm, and is safe to call from many threads at once.

ConvolutionKernel

A convolution kernel: an odd width and height of weights, applied as laid out (the weight at column 0, row 0 multiplies the pixel up and to the left of the center). The sum is divided by Divisor and Offset is added to the color channels.

CubeFile

Reads and writes .cube LUT files: the Adobe Cube LUT Specification 1.0 (a 1D or a 3D table, with TITLE, DOMAIN_MIN and DOMAIN_MAX), and DaVinci Resolve's variant with a 1D shaper before the 3D table (LUT_1D_INPUT_RANGE and LUT_3D_INPUT_RANGE).

DistantLight

A light infinitely far away, shining from one direction on every pixel, as SVG's feDistantLight. The direction toward the light is (cos Azimuth · cos Elevation, sin Azimuth · cos Elevation, sin Elevation) in the raster's coordinates (y down), which is the vector Skia's DistantLit factories take.

DropShadowOptions

The less common settings of DropShadow(float, float, float, Rgba8, DropShadowOptions?): a different vertical blur, whether the canvas grows, whether only the shadow is kept, and how the blur is computed.

LensBlurOptions

The aperture and highlights of LensBlur(float, LensBlurOptions?). The defaults give a round aperture in linear light with no highlight boost.

Light

A light for Lighting(Light, LightingModel, LightingOptions?): DistantLight, PointLight or SpotLight, the three light sources of the SVG 1.1 lighting filters (feDistantLight, fePointLight and feSpotLight), with Skia's parameters. Positions are in pixels of the raster, x to the right, y down and z up out of the image; a pixel's center is at (x + 0.5, y + 0.5), as in Skia.

LightingOptions

The surface and output settings of Lighting(Light, LightingModel, LightingOptions?).

Lut3D

A 3D color lookup table: an N × N × N grid of output RGB values over the input cube, with red varying fastest, as .cube files and Hald images store it, and an optional 1D shaper per channel read before the grid (DaVinci Resolve's 1D-plus-3D .cube). Read one with Read(string, EgamiContext?) or FromHald(Raster), and apply it with FromLut(Lut3D, LutInterpolation).

OperationInput<TPixel>

Everything an operation gets for one frame.

PointLight

A light at one point, shining in every direction, as SVG's fePointLight and Skia's PointLit factories.

RasterOps

Animation steps: they work on the frames of the whole animation rather than on each frame, so they run in Apply, Derive and Transcode (which then decodes the whole animation first) but not inside Within. Frames in memory are already full pictures of what is on screen, so there is no Coalesce, and the writers find each frame's changed area themselves, so there is no Optimize.

SamplingOptions

How a transform or warp samples the source: the filter, the color space it blends in, what samples outside the source read, and the background color.

SpotLight

A light at one point that shines toward a target, as SVG's feSpotLight and Skia's SpotLit factories. Light falls off away from the axis as cos(angle)^Exponent and stops at ConeAngle, with Skia's soft cone edge.

ToneCurve

A curve from 0..1 to 0..1 for one channel, as a photo editor's curves dialog draws it: inputs outside 0..1 are clamped first and results are clamped to 0..1. Use one in Curves(ToneCurve); the tone steps (Level, Gamma and the rest) are curves too, evaluated exactly.

TransformOptions

How a transform samples the source and how large its result is: SamplingOptions plus a viewport.

Warp

Makes warps from functions.

Warps

The built-in warps for Warp(IWarp, SamplingOptions?): lens correction, polar and depolar, arc, swirl, wave and implode with ImageMagick's parameter meanings, so its documentation describes them and its results are their reference, and Skia's magnifier. Positions are in pixels with pixel centers at +0.5.

Structs

ColorMatrix

A 4 × 5 color matrix applied to straight (not premultiplied) RGBA scaled to 0..1: each output channel is m[row, 0] × R + m[row, 1] × G + m[row, 2] × B + m[row, 3] × A + m[row, 4], rows in R, G, B, A order, and results are clamped to 0..1. The factories follow the W3C Filter Effects definitions.

Homography

A 3 × 3 projective matrix in double precision, for perspective transforms. It follows Matrix3x2's conventions: points are row vectors, so [x, y, 1] × H = [X, Y, W] and the point lands at (X / W, Y / W); A * B applies A first, then B. Coordinates are in pixels with the origin at the top-left corner of the top-left pixel, so pixel centers sit at +0.5.

LightingModel

How a surface reflects light in Lighting(Light, LightingModel, LightingOptions?): Diffuse(float) (SVG's feDiffuseLighting, Lambert's N·L) or Specular(float, float) (feSpecularLighting, Phong–Blinn's (N·H)^shininess), with SVG's and Skia's constants.

Mask

A raster read as coverage, 0 (none) to full, placed on the image being edited: where an operation inside Within(Mask, Action<RasterOps>) applies and how strongly. The raster may have any size and pixel type; outside it coverage is 0, or full when Inverted. Its first frame is used for every frame. It must stay undisposed until the chain has run.

OperationReach

How far an operation chain reads past each output pixel, in whole pixels across and down: a pixel of the result can depend on input pixels up to X columns and Y rows away. A blur of σ reaches about 3σ; a color matrix reaches nothing. Reach(Action<RasterOps>) measures a chain, so code that runs one on part of a larger picture, such as a canvas layer, can include the pixels around it that the chain will read.

StructuringElement

The shape Morphology(MorphologyOp, StructuringElement, int) takes its maximum or minimum over: a set of cells around an origin, which sits on the pixel being computed. The factories make the shapes ImageMagick's -morphology kernels of the same names make (its Plus is Cross(int) here). The default value is the origin alone, which changes nothing.

Interfaces

IRasterOperation

One step of an operation chain. Built-in operations implement it, and so can callers: add one to a chain with Add(IRasterOperation).

IWarp

A general warp: a mapping from each output pixel back to the source point it shows. Egami samples the points with the same sampler as Transform(Homography, TransformOptions?), so every warp gets antialiasing where it shrinks the image, and edge modes. Positions are in pixels with the origin at the top-left corner of the top-left pixel, so pixel centers sit at +0.5.

Enums

Anchor

Where an image sits inside a larger area, or which part of it is kept when it is cut down.

AnimationTiming

How DrawAnimation(Raster, Point, AnimationOverlayOptions?) pairs the overlay's frames with the base's.

BlendMode

How a source color is combined with the destination under it: the twelve Porter–Duff operators, Plus and Modulate, and the separable and non-separable blend modes of the W3C Compositing and Blending specification, plus Add and Subtract. Blend modes (Multiply to Luminosity) blend the colors where both are present, then composite source-over. The values are fixed: they never change between releases.

BlurMethod

How Blur(float, ColorSpace, BlurMethod) computes a Gaussian blur.

ChannelSource

Where an output channel of ShuffleChannels(ChannelSource, ChannelSource, ChannelSource, ChannelSource) takes its value from.

ColorChannel

One channel of a raster's working RGBA, or its luminance, for ExtractChannel(ColorChannel).

ColorChannels

A set of a raster's working RGBA channels, for OnChannels(ColorChannels, Action<RasterOps>).

ColorSpace

The color space in which resizing, blurs and grayscale blend colors: the stored sRGB-encoded values, or linear light.

ColorVisionDeficiency

A color vision deficiency to simulate.

Connectivity

Which neighbours a flood fill spreads to.

ContrastInvert

How HighContrast(bool, ContrastInvert, float) inverts, as Skia's high-contrast filter does.

DespillColor

The screen color whose spill Despill(DespillColor, float, float) removes.

EdgeMode

How a convolution reads taps that fall past the image border.

EdgeOperator

The kernels Edges(EdgeOperator, bool) finds edges with. Every operator is scaled so a full black-to-white step gives 1 at its strongest pixel; stronger responses (corners, single bright pixels) clamp to 1.

EqualizeMode

What Equalize(EqualizeMode, bool) equalizes.

HeightSource

Which channel Lighting(Light, LightingModel, LightingOptions?) reads as the surface's height.

LumaWeights

The luma weights a grayscale conversion uses.

LutInterpolation

How a Lut3D reads between its grid points.

MaskChannel

Which values of a raster a Mask reads as coverage.

MorphologyOp

The operations of Morphology(MorphologyOp, StructuringElement, int), all flat (gray-level) and per channel.

NoiseKind

The noise AddNoise(NoiseKind, float, bool, ulong) adds: ImageMagick's +noise kinds, with values on 0..1 and the amount as ImageMagick's -attenuate. At amount 1 the formulas are ImageMagick's Q16 ones.

PixelMath

An arithmetic operation with a constant, for Arithmetic(PixelMath, float, ColorChannels): ImageMagick's -evaluate operators.

ResampleFilter

The kernel a resize or rotation uses to blend source pixels.

StackMode

How Stack(IReadOnlyList<Raster>, StackMode) combines the same channel of the same pixel across rasters.

ThresholdMethod

How AutoThreshold(ThresholdMethod, ThresholdMode, Rgba8?, Rgba8?, bool) and FindThreshold(ThresholdMethod, ThresholdMode) choose a level from the histogram.

ThresholdMode

What a threshold compares with its level.

WhiteBalanceMethod

How AutoWhiteBalance(WhiteBalanceMethod, bool) finds the cast to remove.

Delegates

RowBandAction

Processes a band of rows: rows start (inclusive) to end (exclusive).