DrawingContext Class
Definition
public class DrawingContext
Methods
| Name | Description |
|---|---|
| Custom | Draws a custom drawing operation |
| Dispose | No summary available. |
| DrawEllipse (2 overloads) | Draws an ellipse with the specified Brush and Pen. |
| DrawGeometry (2 overloads) | Draws a geometry. |
| DrawGlyphRun | Draws a glyph run. |
| DrawImage (2 overloads) | Draws an image. |
| DrawLine | Draws a line. |
| DrawRectangle (3 overloads) | Draws a rectangle with the specified Brush and Pen. |
| DrawText | Draws text. |
| FillRectangle | Draws a filled rectangle. |
| PushClip (2 overloads) | Pushes a clip rectangle. |
| PushGeometryClip | Pushes a clip geometry. |
| PushOpacity | Pushes an opacity value. |
| PushOpacityMask | Pushes an opacity mask. |
| PushRenderOptions | Pushes render options. |
| PushTextOptions | Pushes text options for the drawing context. |
| PushTransform | Pushes a matrix transformation. |
Custom Method
Draws a custom drawing operation
public void Custom(Avalonia.Rendering.SceneGraph.ICustomDrawOperation custom)
Parameters
custom Avalonia.Rendering.SceneGraph.ICustomDrawOperation
custom operation
Dispose Method
public void Dispose()
DrawEllipse overloads
DrawEllipse Method
Draws an ellipse with the specified Brush and Pen.
public void DrawEllipse(Avalonia.Media.IBrush brush, Avalonia.Media.IPen pen, Avalonia.Point center, double radiusX, double radiusY)
Parameters
brush Avalonia.Media.IBrush
The brush used to fill the ellipse, or null for no fill.
The pen used to stroke the ellipse, or null for no stroke.
center Avalonia.Point
The location of the center of the ellipse.
radiusX double
The horizontal radius of the ellipse.
radiusY double
The vertical radius of the ellipse.
Remarks
The brush and the pen can both be null. If the brush is null, then no fill is performed. If the pen is null, then no stoke is performed. If both the pen and the brush are null, then the drawing is not visible.
DrawEllipse Method
Draws an ellipse with the specified Brush and Pen.
public void DrawEllipse(Avalonia.Media.IBrush brush, Avalonia.Media.IPen pen, Avalonia.Rect rect)
Parameters
brush Avalonia.Media.IBrush
The brush used to fill the ellipse, or null for no fill.
The pen used to stroke the ellipse, or null for no stroke.
rect Avalonia.Rect
The bounding rect.
Remarks
The brush and the pen can both be null. If the brush is null, then no fill is performed. If the pen is null, then no stoke is performed. If both the pen and the brush are null, then the drawing is not visible.
DrawGeometry overloads
DrawGeometry Method
Draws a geometry.
public void DrawGeometry(Avalonia.Media.IBrush brush, Avalonia.Media.IPen pen, Avalonia.Media.Geometry geometry)
Parameters
brush Avalonia.Media.IBrush
The fill brush.
The stroke pen.
geometry Avalonia.Media.Geometry
The geometry.
DrawGeometry Method
Draws a geometry.
public void DrawGeometry(Avalonia.Media.IBrush brush, Avalonia.Media.IPen pen, Avalonia.Platform.IGeometryImpl geometry)
Parameters
brush Avalonia.Media.IBrush
The fill brush.
The stroke pen.
geometry Avalonia.Platform.IGeometryImpl
The geometry.
DrawGlyphRun Method
Draws a glyph run.
public void DrawGlyphRun(Avalonia.Media.IBrush foreground, Avalonia.Media.GlyphRun glyphRun)
Parameters
foreground Avalonia.Media.IBrush
The foreground brush.
glyphRun Avalonia.Media.GlyphRun
The glyph run.
DrawImage overloads
DrawImage Method
Draws an image.
public void DrawImage(Avalonia.Media.IImage source, Avalonia.Rect rect)
Parameters
source Avalonia.Media.IImage
The image.
rect Avalonia.Rect
The rect in the output to draw to.
DrawImage Method
Draws an image.
public void DrawImage(Avalonia.Media.IImage source, Avalonia.Rect sourceRect, Avalonia.Rect destRect)
Parameters
source Avalonia.Media.IImage
The image.
sourceRect Avalonia.Rect
The rect in the image to draw.
destRect Avalonia.Rect
The rect in the output to draw to.
DrawLine Method
Draws a line.
public void DrawLine(Avalonia.Media.IPen pen, Avalonia.Point p1, Avalonia.Point p2)
Parameters
The stroke pen.
The first point of the line.
The second point of the line.
DrawRectangle overloads
DrawRectangle Method
Draws a rectangle with the specified Brush and Pen.
public void DrawRectangle(Avalonia.Media.IBrush brush, Avalonia.Media.IPen pen, Avalonia.Rect rect, double radiusX, double radiusY, Avalonia.Media.BoxShadows boxShadows)
Parameters
brush Avalonia.Media.IBrush
The brush used to fill the rectangle, or null for no fill.
The pen used to stroke the rectangle, or null for no stroke.
rect Avalonia.Rect
The rectangle bounds.
radiusX double
The radius in the X dimension of the rounded corners. This value will be clamped to the range of 0 to Width/2
radiusY double
The radius in the Y dimension of the rounded corners. This value will be clamped to the range of 0 to Height/2
boxShadows Avalonia.Media.BoxShadows
Box shadow effect parameters
Remarks
The brush and the pen can both be null. If the brush is null, then no fill is performed. If the pen is null, then no stroke is performed. If both the pen and the brush are null, then the drawing is not visible.
DrawRectangle Method
Draws a rectangle with the specified Brush and Pen.
public void DrawRectangle(Avalonia.Media.IBrush brush, Avalonia.Media.IPen pen, Avalonia.RoundedRect rrect, Avalonia.Media.BoxShadows boxShadows)