Bitmap Class

Summary

Holds a bitmap image.
Namespace
Avalonia.Media.Imaging
Interfaces
Base Types
  • object
Derived Types
graph BT Type-->Base0["object"] Type-.->Interface0["IBitmap"] click Interface0 "/api/Avalonia.Media.Imaging/IBitmap" Type-.->Interface1["IImage"] click Interface1 "/api/Avalonia.Media/IImage" Type-.->Interface2["IDisposable"] Type["Bitmap"] class Type type-node Derived0["RenderTargetBitmap"]-->Type click Derived0 "/api/Avalonia.Media.Imaging/RenderTargetBitmap" Derived1["WriteableBitmap"]-->Type click Derived1 "/api/Avalonia.Media.Imaging/WriteableBitmap"

Syntax

public class Bitmap : IBitmap, IImage, IDisposable

Constructors

Name Summary
Bitmap(IBitmapImpl) Initializes a new instance of the Bitmap class.
Bitmap(IRef<IBitmapImpl>) Initializes a new instance of the Bitmap class.
Bitmap(PixelFormat, AlphaFormat, IntPtr, PixelSize, Vector, int) Initializes a new instance of the Bitmap class.
Bitmap(PixelFormat, IntPtr, PixelSize, Vector, int) Initializes a new instance of the Bitmap class.
Bitmap(Stream) Initializes a new instance of the Bitmap class.
Bitmap(string) Initializes a new instance of the Bitmap class.

Properties

Name Value Summary
Dpi Vector
Gets the dots per inch (DPI) of the image.
PixelSize PixelSize
Gets the size of the bitmap, in device pixels.
PlatformImpl IRef<IBitmapImpl>
Gets the platform-specific bitmap implementation.
Size Size
Gets the size of the image, in device independent pixels.

Methods

Name Value Summary
CreateScaledBitmap(PixelSize, BitmapInterpolationMode) Bitmap
Creates a Bitmap scaled to a specified size from the current bitmap.
DecodeToHeight(Stream, int, BitmapInterpolationMode) Bitmap
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.
static
DecodeToWidth(Stream, int, BitmapInterpolationMode) Bitmap
Loads a Bitmap from a stream and decodes at the desired width. Aspect ratio is maintained. This is more efficient than loading and then resizing.
static
Dispose() void
Save(Stream) void
Saves the bitmap to a stream.
Save(string) void
Saves the bitmap to a file.