Class ZonePlatePixelSource
A sample IPixelSource implementation. Creates a test pattern that resembles an inverted Fresnel zone plate.
Inheritance
Implements
Namespace: PhotoSauce.MagicScaler
Assembly: PhotoSauce.MagicScaler.dll
Syntax
public sealed class ZonePlatePixelSource : Object, IPixelSource
Remarks
This pixel source produces a complex pattern that is useful for detecting subtle errors in processing. It is minimally optimized in order to emulate an expensive decoder.
Constructors
ZonePlatePixelSource(Int32, Int32, Guid, Double)
Constructs a new ZonePlatePixelSource using the specified settings.
Declaration
public ZonePlatePixelSource(int width, int height, Guid pixelFormat, double scale = 1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The image width in pixels. This value should be odd to allow the pattern to be perfectly centered. |
System.Int32 | height | The image height in pixels. This value should be odd to allow the pattern to be perfectly centered. |
System.Guid | pixelFormat | The pixel format of the image. Must be a member of PixelFormats. |
System.Double | scale | Determines the diameter of the pattern. A value of 1.0 scales the pattern to fill to the edges of the image's smaller dimension. |
Remarks
width
and height
values up to 65535 are allowed, although not all encoders support imgages of that size.
Properties
Format
The binary representation of the pixel data. Must be one of the values from PixelFormats.
Declaration
public Guid Format { get; }
Property Value
Type | Description |
---|---|
System.Guid |
Height
The height of the image in pixels
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Width
The width of the image in pixels
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
CopyPixels(Rectangle, Int32, Span<Byte>)
Copies the image pixels bounded by sourceArea
to the provided buffer
.
Declaration
public void CopyPixels(Rectangle sourceArea, int cbStride, Span<byte> buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | sourceArea | A System.Drawing.Rectangle that bounds the area of interest. |
System.Int32 | cbStride | The number of bytes between pixels in the same image column within the buffer. |
System.Span<System.Byte> | buffer | A target memory buffer that will receive the pixel data. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents the current object. |