Class DrawingContext
public abstract class DrawingContext : IDisposable
- Inheritance
-
DrawingContext
- Implements
- Inherited Members
Methods
Custom(ICustomDrawOperation)
Draws a custom drawing operation
public abstract void Custom(ICustomDrawOperation custom)
Parameters
custom
ICustomDrawOperationcustom operation
Dispose()
public void Dispose()
DisposeCore()
protected abstract void DisposeCore()
DrawEllipse(IBrush?, IPen?, Point, double, double)
Draws an ellipse with the specified Brush and Pen.
public void DrawEllipse(IBrush? brush, IPen? pen, Point center, double radiusX, double radiusY)
Parameters
brush
IBrushThe brush used to fill the ellipse, or
null
for no fill.pen
IPenThe pen used to stroke the ellipse, or
null
for no stroke.center
PointThe location of the center of the ellipse.
radiusX
doubleThe horizontal radius of the ellipse.
radiusY
doubleThe 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(IBrush?, IPen?, Rect)
Draws an ellipse with the specified Brush and Pen.
public void DrawEllipse(IBrush? brush, IPen? pen, Rect rect)
Parameters
brush
IBrushThe brush used to fill the ellipse, or
null
for no fill.pen
IPenThe pen used to stroke the ellipse, or
null
for no stroke.rect
RectThe 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.
DrawEllipseCore(IBrush?, IPen?, Rect)
protected abstract void DrawEllipseCore(IBrush? brush, IPen? pen, Rect rect)
Parameters
DrawGeometry(IBrush?, IPen?, Geometry)
Draws a geometry.
public void DrawGeometry(IBrush? brush, IPen? pen, Geometry geometry)
Parameters
DrawGeometry(IBrush?, IPen?, IGeometryImpl)
Draws a geometry.
public void DrawGeometry(IBrush? brush, IPen? pen, IGeometryImpl geometry)
Parameters
brush
IBrushThe fill brush.
pen
IPenThe stroke pen.
geometry
IGeometryImplThe geometry.
DrawGeometryCore(IBrush?, IPen?, IGeometryImpl)
protected abstract void DrawGeometryCore(IBrush? brush, IPen? pen, IGeometryImpl geometry)
Parameters
brush
IBrushpen
IPengeometry
IGeometryImpl
DrawGlyphRun(IBrush?, GlyphRun)
Draws a glyph run.
public abstract void DrawGlyphRun(IBrush? foreground, GlyphRun glyphRun)
Parameters
DrawImage(IImage, Rect)
Draws an image.
public virtual void DrawImage(IImage source, Rect rect)
Parameters
DrawImage(IImage, Rect, Rect)
Draws an image.
public virtual void DrawImage(IImage source, Rect sourceRect, Rect destRect)
Parameters
source
IImageThe image.
sourceRect
RectThe rect in the image to draw.
destRect
RectThe rect in the output to draw to.
DrawLine(IPen, Point, Point)
Draws a line.
public void DrawLine(IPen pen, Point p1, Point p2)
Parameters
pen
IPenThe stroke pen.
p1
PointThe first point of the line.
p2
PointThe second point of the line.
DrawLineCore(IPen, Point, Point)
protected abstract void DrawLineCore(IPen pen, Point p1, Point p2)
Parameters
DrawRectangle(IBrush?, IPen?, Rect, double, double, BoxShadows)
Draws a rectangle with the specified Brush and Pen.
public void DrawRectangle(IBrush? brush, IPen? pen, Rect rect, double radiusX = 0, double radiusY = 0, BoxShadows boxShadows = default)
Parameters
brush
IBrushThe brush used to fill the rectangle, or
null
for no fill.pen
IPenThe pen used to stroke the rectangle, or
null
for no stroke.rect
RectThe rectangle bounds.
radiusX
doubleThe radius in the X dimension of the rounded corners. This value will be clamped to the range of 0 to Width/2
radiusY
doubleThe radius in the Y dimension of the rounded corners. This value will be clamped to the range of 0 to Height/2
boxShadows
BoxShadowsBox 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(IBrush?, IPen?, RoundedRect, BoxShadows)
Draws a rectangle with the specified Brush and Pen.
public void DrawRectangle(IBrush? brush, IPen? pen, RoundedRect rrect, BoxShadows boxShadows = default)
Parameters
brush
IBrushThe brush used to fill the rectangle, or
null
for no fill.pen
IPenThe pen used to stroke the rectangle, or
null
for no stroke.rrect
RoundedRectThe rectangle bounds.
boxShadows
BoxShadowsBox 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 stoke is performed. If both the pen and the brush are null, then the drawing is not visible.
DrawRectangle(IPen, Rect, float)
Draws the outline of a rectangle.
public void DrawRectangle(IPen pen, Rect rect, float cornerRadius = 0)
Parameters
DrawRectangleCore(IBrush?, IPen?, RoundedRect, BoxShadows)
protected abstract void DrawRectangleCore(IBrush? brush, IPen? pen, RoundedRect rrect, BoxShadows boxShadows = default)
Parameters
brush
IBrushpen
IPenrrect
RoundedRectboxShadows
BoxShadows
DrawText(FormattedText, Point)
Draws text.
public virtual void DrawText(FormattedText text, Point origin)
Parameters
text
FormattedTextThe text.
origin
PointThe upper-left corner of the text.
FillRectangle(IBrush, Rect, float)
Draws a filled rectangle.
public void FillRectangle(IBrush brush, Rect rect, float cornerRadius = 0)
Parameters
PopClipCore()
protected abstract void PopClipCore()
PopGeometryClipCore()
protected abstract void PopGeometryClipCore()
PopOpacityCore()
protected abstract void PopOpacityCore()
PopOpacityMaskCore()
protected abstract void PopOpacityMaskCore()
PopRenderOptionsCore()
protected abstract void PopRenderOptionsCore()
PopTransformCore()
protected abstract void PopTransformCore()
PushClip(Rect)
Pushes a clip rectangle.
public DrawingContext.PushedState PushClip(Rect clip)
Parameters
clip
RectThe clip rectangle.
Returns
- DrawingContext.PushedState
A disposable used to undo the clip rectangle.
PushClip(RoundedRect)
Pushes a clip rectangle.
public DrawingContext.PushedState PushClip(RoundedRect clip)
Parameters
clip
RoundedRectThe clip rectangle.
Returns
- DrawingContext.PushedState
A disposable used to undo the clip rectangle.
PushClipCore(Rect)
protected abstract void PushClipCore(Rect rect)
Parameters
rect
Rect
PushClipCore(RoundedRect)
protected abstract void PushClipCore(RoundedRect rect)
Parameters
rect
RoundedRect
PushGeometryClip(Geometry)
Pushes a clip geometry.
public DrawingContext.PushedState PushGeometryClip(Geometry clip)
Parameters
clip
GeometryThe clip geometry.
Returns
- DrawingContext.PushedState
A disposable used to undo the clip geometry.
PushGeometryClipCore(Geometry)
protected abstract void PushGeometryClipCore(Geometry clip)
Parameters
clip
Geometry
PushOpacity(double)
Pushes an opacity value.
public DrawingContext.PushedState PushOpacity(double opacity)
Parameters
opacity
doubleThe opacity.
Returns
- DrawingContext.PushedState
A disposable used to undo the opacity.
PushOpacityCore(double)
protected abstract void PushOpacityCore(double opacity)
Parameters
opacity
double
PushOpacityMask(IBrush, Rect)
Pushes an opacity mask.
public DrawingContext.PushedState PushOpacityMask(IBrush mask, Rect bounds)
Parameters
mask
IBrushThe opacity mask.
bounds
RectThe size of the brush's target area. TODO: Are we sure this is needed?
Returns
- DrawingContext.PushedState
A disposable to undo the opacity mask.
PushOpacityMaskCore(IBrush, Rect)
protected abstract void PushOpacityMaskCore(IBrush mask, Rect bounds)
Parameters
PushRenderOptions(RenderOptions)
Pushes render options.
public DrawingContext.PushedState PushRenderOptions(RenderOptions renderOptions)
Parameters
renderOptions
RenderOptionsThe render options.
Returns
- DrawingContext.PushedState
A disposable to undo the render options.
PushRenderOptionsCore(RenderOptions)
protected abstract void PushRenderOptionsCore(RenderOptions renderOptions)
Parameters
renderOptions
RenderOptions
PushTransform(Matrix)
Pushes a matrix transformation.
public DrawingContext.PushedState PushTransform(Matrix matrix)
Parameters
matrix
MatrixThe matrix
Returns
- DrawingContext.PushedState
A disposable used to undo the transformation.
PushTransformCore(Matrix)
protected abstract void PushTransformCore(Matrix matrix)
Parameters
matrix
Matrix