Table of Contents

Class Warp

Namespace
Egami.Operations
Assembly
Egami.dll

Makes warps from functions.

public static class Warp
Inheritance
Warp
Inherited Members

Examples

// Any mapping from output points back to source points; the sampler antialiases wherever it shrinks the image.
IWarp ripple = Warp.FromFunction(p => new Vector2(p.X + (6 * MathF.Sin(p.Y / 15)), p.Y));
using Raster rippled = photo.Derive(ops => ops.Warp(ripple, new SamplingOptions { Edges = EdgeMode.Mirror }), Ct);

// The same as an IWarp, mapping a whole row per call: no per-pixel delegate, so it is faster.
using Raster again = photo.Derive(ops => ops.Warp(new Ripple(6, 15), new SamplingOptions { Edges = EdgeMode.Mirror }), Ct);

Methods

FromFunction(Func<Vector2, Vector2>, Size?)

Returns a warp that calls map for each output pixel center. Simple for experiments; an IWarp that maps whole rows gives the same pixels faster.

public static IWarp FromFunction(Func<Vector2, Vector2> map, Size? outputSize = null)

Parameters

map Func<Vector2, Vector2>

Returns the source point for an output point; it may run on several threads at once.

outputSize Size?

The output size, or null (the default) to keep the input's.

Returns

IWarp

The warp.

Exceptions

ArgumentNullException

map is null.

ArgumentOutOfRangeException

outputSize is not at least 1 × 1.