Struct OperationReach
- Namespace
- Egami.Operations
- Assembly
- Egami.dll
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.
public readonly record struct OperationReach : IEquatable<OperationReach>
- Implements
- Inherited Members
Examples
// How far a chain reads around each pixel: run it on a part of a picture padded by this much, and the part comes out as it
// would in the whole picture.
OperationReach? reach = RasterOps.Reach(ops => ops.Blur(3).Glow(4, Rgba8.White));
if (reach is OperationReach r)
{
Console.WriteLine($"pad by {r.X} × {r.Y}");
}
// A resize reads the whole image: its reach is unknown.
Assert.Null(RasterOps.Reach(ops => ops.Resize(100, 100)));
Constructors
OperationReach(int, int)
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.
public OperationReach(int X, int Y)
Parameters
Examples
// How far a chain reads around each pixel: run it on a part of a picture padded by this much, and the part comes out as it
// would in the whole picture.
OperationReach? reach = RasterOps.Reach(ops => ops.Blur(3).Glow(4, Rgba8.White));
if (reach is OperationReach r)
{
Console.WriteLine($"pad by {r.X} × {r.Y}");
}
// A resize reads the whole image: its reach is unknown.
Assert.Null(RasterOps.Reach(ops => ops.Resize(100, 100)));
Properties
X
The reach across, in pixels.
public int X { get; init; }
Property Value
Y
The reach down, in pixels.
public int Y { get; init; }