Class AndroidDrawingContext
public class AndroidDrawingContext : IContext, IMeasureContext, IStateContext, IPenContext, IPathDrawingContext, IPathBuilder, IGlyphPathBuilder, IPathDrawing, IPathClipping, IRectDrawingContext, ITextDrawingContext, ITextMeasureContext, IImageDrawingContext, ITransformContext, IDisposable
- Inheritance
-
AndroidDrawingContext
- Implements
- Inherited Members
Constructors
AndroidDrawingContext()
public AndroidDrawingContext()
Properties
Canvas
public Canvas? Canvas { get; set; }
Property Value
- Canvas?
GlobalAlpha
Sets the global alpha value for all drawing operations. Range: 0.0 (fully transparent) to 1.0 (fully opaque).
public NFloat GlobalAlpha { set; }
Property Value
LineCap
Sets the style of line caps used for strokes.
public LineCap LineCap { set; }
Property Value
LineDashOffset
Sets the phase offset for the start of the dash pattern.
public NFloat LineDashOffset { get; set; }
Property Value
LineJoin
Sets the style of line joins between segments.
public LineJoin LineJoin { set; }
Property Value
LineWidth
Sets the width of stroked lines, in user space units.
public NFloat LineWidth { set; }
Property Value
MiterLimit
Sets the miter limit ratio for miter joins. If the ratio of miter length to line width exceeds this value, a bevel join is used instead.
public NFloat MiterLimit { set; }
Property Value
TextAlign
Sets the horizontal alignment of the text relative to the given position.
public TextAlign TextAlign { set; }
Property Value
TextBaseline
Sets the vertical alignment of the text relative to the given baseline.
public TextBaseline TextBaseline { set; }
Property Value
Methods
Arc(Point, NFloat, NFloat, NFloat, Winding)
Adds an arc to the path centered at the specified point.
public void Arc(Point center, NFloat radius, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)
Parameters
centerPointCenter of the arc.
radiusNFloatRadius of the arc.
startAngleNFloatStart angle in radians.
endAngleNFloatEnd angle in radians.
windingWindingDirection in which the arc is drawn.
ArcTo(Point, Point, NFloat)
Adds an arc to the path, connecting two tangents defined by control points.
public void ArcTo(Point cp1, Point cp2, NFloat radius)
Parameters
BeginPath()
Begins a new path by resetting the current path list.
public void BeginPath()
Clip()
Sets the current clipping region to the current path. Subsequent drawing operations are clipped to this region.
public void Clip()
ClosePath()
Closes the current path contour.
public void ClosePath()
CurveTo(Point, Point)
Draws a quadratic Bézier curve using a control point and end point.
public void CurveTo(Point cp1, Point to)
Parameters
CurveTo(Point, Point, Point)
Draws a cubic Bézier curve from the current point to the specified point, using two control points.
public void CurveTo(Point cp1, Point cp2, Point to)
Parameters
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Ellipse(Point, NFloat, NFloat, NFloat, NFloat, NFloat, Winding)
Adds an elliptical arc to the path.
public void Ellipse(Point center, NFloat radiusX, NFloat radiusY, NFloat rotation, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)
Parameters
centerPointCenter of the ellipse.
radiusXNFloatHorizontal radius.
radiusYNFloatVertical radius.
rotationNFloatRotation of the ellipse, in radians.
startAngleNFloatStart angle in radians.
endAngleNFloatEnd angle in radians.
windingWindingDirection in which the arc is drawn.
Fill(FillRule)
Fills the current path using the specified fill rule.
public void Fill(FillRule rule = FillRule.NonZero)
Parameters
ruleFillRuleThe fill rule to use (NonZero or EvenOdd).
FillRect(Rect)
Fills the specified rectangle using the current fill style.
public void FillRect(Rect rect)
Parameters
rectRectThe rectangle to fill.
FillText(string, Point)
Draws filled text at the specified position using the current fill style and font settings.
public void FillText(string text, Point pos)
Parameters
LineTo(Point)
Draws a straight line to the specified point.
public void LineTo(Point to)
Parameters
toPoint
MeasureText(string)
public Vector MeasureText(string text)
Parameters
textstring
Returns
MoveTo(Point)
Begins a new sub-path at the specified point.
public void MoveTo(Point to)
Parameters
toPoint
Rect(Rect)
Adds a rectangle path to the current path.
public void Rect(Rect rect)
Parameters
rectRectThe rectangle to add.
Restore()
Pops the top state off the state stack and restores it. Any modifications made since the last Save() are discarded.
public void Restore()
Rotate(NFloat)
Applies a clockwise rotation to the current transform.
public void Rotate(NFloat angle)
Parameters
angleNFloatThe rotation angle in radians.
RoundRect(Rect, NFloat)
Adds a rounded rectangle path with a uniform radius.
public void RoundRect(Rect rect, NFloat radius)
Parameters
RoundRect(Rect, CornerRadius)
Adds a rounded rectangle path with per-corner radii.
public void RoundRect(Rect rect, CornerRadius radius)
Parameters
rectRectThe rectangle to round.
radiusCornerRadiusCorner radius object defining each corner.
Save()
Pushes the current drawing state onto the state stack. This includes styles, transformations, clipping paths, etc.
public void Save()
Scale(Vector)
Applies a scaling transformation using the specified scaling factors.
public void Scale(Vector vector)
Parameters
vectorVectorThe scaling vector (sx, sy).
SetFill(Color)
Sets the fill style to a solid color.
public void SetFill(Color color)
Parameters
colorColorThe fill color.
SetFill(LinearGradient)
Sets the fill style to a linear gradient.
public void SetFill(LinearGradient linearGradient)
Parameters
linearGradientLinearGradientThe gradient to use for filling shapes.
SetFill(RadialGradient)
Sets the fill style to a radial gradient.
public void SetFill(RadialGradient radialGradient)
Parameters
radialGradientRadialGradientThe gradient to use for filling shapes.
SetFont(Font)
Sets the font used for all subsequent text drawing and measurement operations.
public void SetFont(Font font)
Parameters
fontFontThe font definition to apply.
SetLineDash(ReadOnlySpan<NFloat>)
Sets the dash pattern used for stroking lines. Each element in the span represents a dash or gap length, alternating.
public void SetLineDash(ReadOnlySpan<NFloat> segments)
Parameters
segmentsReadOnlySpan<NFloat>A sequence of dash and gap lengths.
SetStroke(Color)
Sets the stroke style to a solid color.
public void SetStroke(Color color)
Parameters
colorColorThe stroke color.
SetStroke(LinearGradient)
Sets the stroke style to a linear gradient.
public void SetStroke(LinearGradient linearGradient)
Parameters
linearGradientLinearGradientThe gradient to use for stroking paths.
SetStroke(RadialGradient)
Sets the stroke style to a radial gradient.
public void SetStroke(RadialGradient radialGradient)
Parameters
radialGradientRadialGradientThe gradient to use for stroking paths.
SetTransform(AffineTransform)
Resets the current transformation matrix to the identity matrix,
then replaces it with the specified transform.
Equivalent to ctx.setTransform(...) in HTML5 Canvas.
public void SetTransform(AffineTransform transform)
Parameters
transformAffineTransformThe new transformation matrix to apply.
Stroke()
Strokes the current path using the current stroke style.
public void Stroke()
StrokeRect(Rect)
Draws the outline of the specified rectangle using the current stroke style.
public void StrokeRect(Rect rect)
Parameters
rectRectThe rectangle to stroke.
Transform(AffineTransform)
Multiplies the current transformation matrix by the specified matrix. This is equivalent to applying an additional transformation on top of the existing one.
public void Transform(AffineTransform matrix)
Parameters
matrixAffineTransformThe matrix to multiply with the current transform.
Translate(Vector)
Applies a translation by the specified vector. This offsets all subsequent drawing operations by the given amount.
public void Translate(Vector vector)
Parameters
vectorVectorThe translation vector (dx, dy).