Table of Contents

Class CroppedBitmap

Namespace
Avalonia.Media.Imaging
Assembly
Avalonia.Base.dll

Crops a Bitmap.

public class CroppedBitmap : AvaloniaObject, INotifyPropertyChanged, IImage, IDisposable
Inheritance
CroppedBitmap
Implements
Inherited Members
Extension Methods

Constructors

CroppedBitmap()

public CroppedBitmap()

CroppedBitmap(IImage, PixelRect)

public CroppedBitmap(IImage source, PixelRect sourceRect)

Parameters

source IImage
sourceRect PixelRect

Fields

SourceProperty

Defines the Source property.

public static readonly StyledProperty<IImage?> SourceProperty

Field Value

StyledProperty<IImage>

SourceRectProperty

Defines the SourceRect property.

public static readonly StyledProperty<PixelRect> SourceRectProperty

Field Value

StyledProperty<PixelRect>

Properties

Size

Gets the size of the image, in device independent pixels.

public Size Size { get; }

Property Value

Size

Source

Gets or sets the source for the bitmap.

public IImage? Source { get; set; }

Property Value

IImage

SourceRect

Gets or sets the rectangular area that the bitmap is cropped to.

public PixelRect SourceRect { get; set; }

Property Value

PixelRect

Methods

Dispose()

public virtual void Dispose()

Draw(DrawingContext, Rect, Rect)

Draws the image to a DrawingContext.

public void Draw(DrawingContext context, Rect sourceRect, Rect destRect)

Parameters

context DrawingContext

The drawing context.

sourceRect Rect

The rect in the image to draw.

destRect Rect

The rect in the output to draw to.

Events

Invalidated

Raised when the resource changes visually.

public event EventHandler? Invalidated

Event Type

EventHandler