Class ImmediateDrawingContext
public sealed class ImmediateDrawingContext : IDisposable, IOptionalFeatureProvider
- Inheritance
-
ImmediateDrawingContext
- Implements
- Inherited Members
- Extension Methods
Properties
CurrentTransform
Gets the current transform of the drawing context.
public Matrix CurrentTransform { get; }
Property Value
PlatformImpl
public IDrawingContextImpl PlatformImpl { get; }
Property Value
Methods
Dispose()
Disposes of any resources held by the DrawingContext.
public void Dispose()
DrawBitmap(Bitmap, Rect)
Draws an bitmap.
public void DrawBitmap(Bitmap source, Rect rect)
Parameters
DrawBitmap(Bitmap, Rect, Rect)
Draws an image.
public void DrawBitmap(Bitmap source, Rect sourceRect, Rect destRect)
Parameters
source
BitmapThe bitmap.
sourceRect
RectThe rect in the image to draw.
destRect
RectThe rect in the output to draw to.
DrawEllipse(IImmutableBrush?, ImmutablePen?, Point, double, double)
Draws an ellipse with the specified Brush and Pen.
public void DrawEllipse(IImmutableBrush? brush, ImmutablePen? pen, Point center, double radiusX, double radiusY)
Parameters
brush
IImmutableBrushThe brush used to fill the ellipse, or
null
for no fill.pen
ImmutablePenThe 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.
DrawGlyphRun(IImmutableBrush, IImmutableGlyphRunReference)
Draws a glyph run.
public void DrawGlyphRun(IImmutableBrush foreground, IImmutableGlyphRunReference glyphRun)
Parameters
foreground
IImmutableBrushThe foreground brush.
glyphRun
IImmutableGlyphRunReferenceThe glyph run.
DrawLine(ImmutablePen, Point, Point)
Draws a line.
public void DrawLine(ImmutablePen pen, Point p1, Point p2)
Parameters
pen
ImmutablePenThe stroke pen.
p1
PointThe first point of the line.
p2
PointThe second point of the line.
DrawRectangle(IImmutableBrush?, ImmutablePen?, Rect, double, double, BoxShadows)
Draws a rectangle with the specified Brush and Pen.
public void DrawRectangle(IImmutableBrush? brush, ImmutablePen? pen, Rect rect, double radiusX = 0, double radiusY = 0, BoxShadows boxShadows = default)
Parameters
brush
IImmutableBrushThe brush used to fill the rectangle, or
null
for no fill.pen
ImmutablePenThe 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 stoke is performed. If both the pen and the brush are null, then the drawing is not visible.
DrawRectangle(ImmutablePen, Rect, float)
Draws the outline of a rectangle.
public void DrawRectangle(ImmutablePen pen, Rect rect, float cornerRadius = 0)
Parameters
pen
ImmutablePenThe pen.
rect
RectThe rectangle bounds.
cornerRadius
floatThe corner radius.
FillRectangle(IImmutableBrush, Rect, float)
Draws a filled rectangle.
public void FillRectangle(IImmutableBrush brush, Rect rect, float cornerRadius = 0)
Parameters
brush
IImmutableBrushThe brush.
rect
RectThe rectangle bounds.
cornerRadius
floatThe corner radius.
PushClip(Rect)
Pushes a clip rectangle.
public ImmediateDrawingContext.PushedState PushClip(Rect clip)
Parameters
clip
RectThe clip rectangle.
Returns
- ImmediateDrawingContext.PushedState
A disposable used to undo the clip rectangle.
PushClip(RoundedRect)
public ImmediateDrawingContext.PushedState PushClip(RoundedRect clip)
Parameters
clip
RoundedRect
Returns
PushOpacity(double, Rect)
Pushes an opacity value.
public ImmediateDrawingContext.PushedState PushOpacity(double opacity, Rect bounds)
Parameters
Returns
- ImmediateDrawingContext.PushedState
A disposable used to undo the opacity.
PushOpacityMask(IImmutableBrush, Rect)
Pushes an opacity mask.
public ImmediateDrawingContext.PushedState PushOpacityMask(IImmutableBrush mask, Rect bounds)
Parameters
mask
IImmutableBrushThe opacity mask.
bounds
RectThe size of the brush's target area. TODO: Are we sure this is needed?
Returns
- ImmediateDrawingContext.PushedState
A disposable to undo the opacity mask.
PushPostTransform(Matrix)
Pushes a matrix post-transformation.
public ImmediateDrawingContext.PushedState PushPostTransform(Matrix matrix)
Parameters
matrix
MatrixThe matrix
Returns
- ImmediateDrawingContext.PushedState
A disposable used to undo the transformation.
PushPreTransform(Matrix)
Pushes a matrix pre-transformation.
public ImmediateDrawingContext.PushedState PushPreTransform(Matrix matrix)
Parameters
matrix
MatrixThe matrix
Returns
- ImmediateDrawingContext.PushedState
A disposable used to undo the transformation.
PushSetTransform(Matrix)
Sets the current matrix transformation.
public ImmediateDrawingContext.PushedState PushSetTransform(Matrix matrix)
Parameters
matrix
MatrixThe matrix
Returns
- ImmediateDrawingContext.PushedState
A disposable used to undo the transformation.
PushTransformContainer()
Pushes a new transform context.
public ImmediateDrawingContext.PushedState PushTransformContainer()
Returns
- ImmediateDrawingContext.PushedState
A disposable used to undo the transformation.
TryGetFeature(Type)
Queries for an optional feature.
public object? TryGetFeature(Type type)
Parameters
type
Type