Skip to main content

Bitmap Class

Holds a bitmap image.

Definition​

Namespace: Avalonia.Media.Imaging
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public class Bitmap : IImage, IDisposable, 
IImageBrushSource
View Source
InheritanceObject → Bitmap
DerivedAvalonia.Media.Imaging.RenderTargetBitmap
Avalonia.Media.Imaging.WriteableBitmap
ImplementsIImage, IImageBrushSource, IDisposable

Constructors​

Bitmap(Stream)Initializes a new instance of the Bitmap class.
Bitmap(String)Initializes a new instance of the Bitmap class.
Bitmap(PixelFormat, AlphaFormat, IntPtr, PixelSize, Vector, Int32)Initializes a new instance of the Bitmap class.

Properties​

AlphaFormat 
Dpi 
Format 
PixelSize 
SizeGets the size of the image, in device independent pixels.

Methods​

CopyPixels(ILockedFramebuffer, AlphaFormat)Copies pixels to the target buffer and transcodes the pixel and alpha format if needed.
CopyPixels(PixelRect, IntPtr, Int32, Int32) 
CreateScaledBitmap(PixelSize, BitmapInterpolationMode)Creates a Bitmap scaled to a specified size from the current bitmap.
DecodeToHeight(Stream, Int32, BitmapInterpolationMode)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(Stream, Int32, BitmapInterpolationMode)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.
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize()Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode()Serves as the default hash function.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
MemberwiseClone()Creates a shallow copy of the current Object.
(Inherited from Object)
Save(Stream, Nullable(Int32))Saves the bitmap to a stream.
Save(String, Nullable(Int32))Saves the bitmap to a file.
ToString()Returns a string that represents the current object.
(Inherited from Object)

See Also​

Reference​

Avalonia.Media.Imaging Namespace