Class TestPatternPixelSource
A sample IPixelSource implementation. Creates a test pattern of stair-stepped color or grey bars.
Inheritance
Namespace: PhotoSauce.MagicScaler
Assembly: PhotoSauce.MagicScaler.dll
Syntax
public sealed class TestPatternPixelSource : Object, IPixelSource
Remarks
This pixel source is useful when a simple recognizable pattern is desired. It produces output at memcpy
speed.
Constructors
TestPatternPixelSource(Int32, Int32, Guid)
Constructs a new TestPatternPixelSource using the specified settings.
Declaration
public TestPatternPixelSource(int width, int height, Guid pixelFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The image width in pixels. |
System.Int32 | height | The image height in pixels. |
System.Guid | pixelFormat | The pixel format of the image. Must be a member of PixelFormats. |
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. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
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. |