Class TransformOptions
- Namespace
- Egami.Operations
- Assembly
- Egami.dll
How a transform samples the source and how large its result is: SamplingOptions plus a viewport.
public sealed record TransformOptions : SamplingOptions, IEquatable<SamplingOptions>, IEquatable<TransformOptions>
- Inheritance
-
TransformOptions
- Implements
- Inherited Members
Examples
// Keep the input's size (and the matrix's translation), fill the uncovered corners with white, blend in linear light.
TransformOptions keep = new()
{
Viewport = new Rect(0, 0, photo.Width, photo.Height),
Background = Rgba8.White,
ColorSpace = ColorSpace.Linear,
};
photo.Apply(ops => ops.Transform(Matrix3x2.CreateRotation(0.2f, new Vector2(photo.Width / 2f, photo.Height / 2f)), keep), Ct);
// Wrap extends the image as a tiling, so a turned copy fills the whole canvas.
using Raster<Rgba8> pattern = photo.Derive(ops => ops.Transform(Matrix3x2.CreateRotation(0.5f), new TransformOptions
{
Viewport = new Rect(0, 0, 800, 600),
Edges = EdgeMode.Wrap,
Filter = ResampleFilter.Lanczos3,
}), Ct);
Properties
Viewport
Gets the rectangle of the transformed plane to keep, in destination coordinates, or null (the default) for
the bounding box of the transformed image, rounded to whole pixels and centered on it, where the matrix's translation only
moves the image within the box. new Rect(0, 0, width, height) with the input's size keeps the size and the
translation, as ImageMagick's -distort does, and lets the transform run inside Within.
public Rect? Viewport { get; init; }
Property Value
- Rect?