Class BitmapPixelSource
A base IPixelSource implementation for wrapping a fully-decoded image bitmap in memory.
Inheritance
Namespace: PhotoSauce.MagicScaler
Assembly: PhotoSauce.MagicScaler.dll
Syntax
public abstract class BitmapPixelSource : Object, IPixelSource
Constructors
BitmapPixelSource(Guid, Int32, Int32, Int32)
Sets base properties of the BitmapPixelSource implementation.
Declaration
protected BitmapPixelSource(Guid format, int width, int height, int stride)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | format | The format of the bitmap pixels. |
System.Int32 | width | The bitmap width, in pixels. |
System.Int32 | height | The bitmap height, in pixels. |
System.Int32 | stride | The number of bytes between pixels in adjacent bitmap rows. |
Properties
Format
The binary representation of the pixel data. Must be one of the values from PixelFormats.
Declaration
public virtual Guid Format { get; }
Property Value
Type | Description |
---|---|
System.Guid |
Height
The height of the image in pixels
Declaration
public virtual int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Span
Exposes the pixel data in the backing bitmap.
Declaration
protected abstract ReadOnlySpan<byte> Span { get; }
Property Value
Type | Description |
---|---|
System.ReadOnlySpan<System.Byte> | A System.ReadOnlySpan<> instance that exposes the pixel data in memory. |
Stride
The number of bytes between pixels in adjacent bitmap rows.
Declaration
protected virtual int Stride { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Width
The width of the image in pixels
Declaration
public virtual 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 virtual 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()
Dispose(Boolean)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | True if the method is being invoked from a call to System.IDisposable.Dispose, false if it is invoked from a finalizer. |