WriteableBitmap Class
Definition
Holds a writeable bitmap image.
public class WriteableBitmap
Constructors
| Name | Description |
|---|---|
| WriteableBitmap (2 overloads) | No summary available. |
WriteableBitmap overloads
WriteableBitmap Constructor
public WriteableBitmap(Avalonia.PixelSize size, Avalonia.Vector dpi, Nullable<Avalonia.Platform.PixelFormat> format, Nullable<Avalonia.Platform.AlphaFormat> alphaFormat)
Parameters
size Avalonia.PixelSize
dpi Avalonia.Vector
format Nullable<Avalonia.Platform.PixelFormat>
alphaFormat Nullable<Avalonia.Platform.AlphaFormat>
WriteableBitmap Constructor
Initializes a new instance of the Avalonia.Media.Imaging.WriteableBitmap class with existing pixel data The data is copied to the bitmap
public WriteableBitmap(Avalonia.Platform.PixelFormat format, Avalonia.Platform.AlphaFormat alphaFormat, IntPtr data, Avalonia.PixelSize size, Avalonia.Vector dpi, int stride)
Parameters
format Avalonia.Platform.PixelFormat
The pixel format.
alphaFormat Avalonia.Platform.AlphaFormat
The alpha format.
data IntPtr
The pointer to the source bytes.
size Avalonia.PixelSize
The size of the bitmap in device pixels.
dpi Avalonia.Vector
The DPI of the bitmap.
stride int
The number of bytes per row.
Methods
| Name | Description |
|---|---|
| CopyPixels | No summary available. |
| Decode | No summary available. |
| DecodeToHeight | Loads a Bitmap from a stream and decodes at the desired height. Aspect ratio is maintained. This is more efficient than loading and then resizing. |
| DecodeToWidth | Loads a WriteableBitmap from a stream and decodes at the desired width. Aspect ratio is maintained. This is more efficient than loading and then resizing. |
| Lock | No summary available. |
| CopyPixels | Copies pixels to the target buffer and transcodes the pixel and alpha format if needed. Inherited from Bitmap. |
| CreateScaledBitmap | Creates a Bitmap scaled to a specified size from the current bitmap. Inherited from Bitmap. |
| Dispose | Inherited from Bitmap. |
| Save (2 overloads) | Inherited from Bitmap. |
CopyPixels Method
public void CopyPixels(Avalonia.PixelRect sourceRect, IntPtr buffer, int bufferSize, int stride)
Parameters
sourceRect Avalonia.PixelRect
buffer IntPtr
bufferSize int
stride int
Decode Method
public Avalonia.Media.Imaging.WriteableBitmap Decode(System.IO.Stream stream)
Parameters
stream System.IO.Stream
Returns
DecodeToHeight Method
Loads a Bitmap from a stream and decodes at the desired height. Aspect ratio is maintained. This is more efficient than loading and then resizing.
public Avalonia.Media.Imaging.WriteableBitmap DecodeToHeight(System.IO.Stream stream, int height, Avalonia.Media.Imaging.BitmapInterpolationMode interpolationMode)
Parameters
stream System.IO.Stream
The stream to read the bitmap from. This can be any supported image format.
height int
The desired height of the resulting bitmap.
interpolationMode Avalonia.Media.Imaging.BitmapInterpolationMode
The Avalonia.Media.Imaging.BitmapInterpolationMode to use should any scaling be required.
Returns
Avalonia.Media.Imaging.WriteableBitmap
An instance of the Avalonia.Media.Imaging.WriteableBitmap class.
DecodeToWidth Method
Loads a WriteableBitmap from a stream and decodes at the desired width. Aspect ratio is maintained. This is more efficient than loading and then resizing.
public Avalonia.Media.Imaging.WriteableBitmap DecodeToWidth(System.IO.Stream stream, int width, Avalonia.Media.Imaging.BitmapInterpolationMode interpolationMode)
Parameters
stream System.IO.Stream
The stream to read the bitmap from. This can be any supported image format.
width int
The desired width of the resulting bitmap.
interpolationMode Avalonia.Media.Imaging.BitmapInterpolationMode
The Avalonia.Media.Imaging.BitmapInterpolationMode to use should any scaling be required.
Returns
Avalonia.Media.Imaging.WriteableBitmap
An instance of the Avalonia.Media.Imaging.WriteableBitmap class.
Lock Method
public Avalonia.Platform.ILockedFramebuffer Lock()
Returns
Properties
| Name | Description |
|---|---|
| Format | No summary available. |
| AlphaFormat | Inherited from Bitmap. |
| Dpi | Inherited from Bitmap. |
| PixelSize | Inherited from Bitmap. |
| Size | Gets the size of the image, in device independent pixels. Inherited from Bitmap. |
Format Property
public Nullable<Avalonia.Platform.PixelFormat> Format { get; set; }