/// <summary> /// Draws a line between the specified points</summary> /// <param name="pt1">The start point of the line, in pixels</param> /// <param name="pt2">The end point of the line, in pixels</param> /// <param name="brush">The brush used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or NULL to paint a solid line</param> public void DrawLine(PointF pt1, PointF pt2, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_renderTarget.DrawLine( new DrawingPointF(pt1.X, pt1.Y), new DrawingPointF(pt2.X, pt2.Y), brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws the outline of the specified ellipse using the specified stroke style</summary> /// <param name="ellipse">Position and radius of the ellipse to draw in pixels</param> /// <param name="brush">The brush used to paint the ellipse's outline</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the ellipse's outline or null to draw a solid line</param> public void DrawEllipse(D2dEllipse ellipse, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_renderTarget.DrawEllipse(ellipse.ToSharpDX(), brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws the outline of the specified rounded rectangle</summary> /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in pixels</param> /// <param name="brush">The brush used to paint the rounded rectangle's outline</param> /// <param name="strokeWidth">The width of the rounded rectangle's stroke. The stroke is centered on the /// rounded rectangle's outline.</param> /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or null to paint a solid stroke</param> public void DrawRoundedRectangle(D2dRoundedRect roundedRect, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_renderTarget.DrawRoundedRectangle(roundedRect.ToSharpDX(), brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws a path defined by an enumeration of EdgeStyleData structures</summary> /// <param name="path">The enumeration of drawing primitives that describes the contents of the path</param> /// <param name="brush">The brush used to paint the path's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <remarks>Assume the end point of one primitive be coincident with the start point of the following primitive in a path</remarks> /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or null to paint a solid stroke</param> public void DrawPath(IEnumerable<EdgeStyleData> path, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { using (var geom = new PathGeometry(D2dFactory.NativeFactory)) { var sink = geom.Open(); var firstPoint = true; foreach (var edge in path) { if (edge.ShapeType == EdgeStyleData.EdgeShape.Line) { var line = edge.EdgeData.As<PointF[]>(); if (firstPoint) { sink.BeginFigure(line[0].ToSharpDX(), FigureBegin.Hollow); firstPoint = false; } for (var i = 1; i < line.Length; ++i) sink.AddLine(line[i].ToSharpDX()); } else if (edge.ShapeType == EdgeStyleData.EdgeShape.Bezier) { var curve = edge.EdgeData.As<BezierCurve2F>(); if (firstPoint) { sink.BeginFigure(curve.P1.ToSharpDX(), FigureBegin.Hollow); firstPoint = false; } var seg = new BezierSegment { Point1 = curve.P2.ToSharpDX(), Point2 = curve.P3.ToSharpDX(), Point3 = curve.P4.ToSharpDX() }; sink.AddBezier(seg); } } sink.EndFigure(FigureEnd.Open); sink.Close(); sink.Dispose(); m_renderTarget.DrawGeometry(geom, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); } }
/// <summary> /// Draws a line between the specified points</summary> /// <param name="pt1">The start point of the line, in pixels</param> /// <param name="pt2">The end point of the line, in pixels</param> /// <param name="color">The color used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or NULL to paint a solid line</param> public void DrawLine(PointF pt1, PointF pt2, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawLine(pt1, pt2, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws a polygon defined by an array of PointF structures</summary> /// <param name="points">Array of System.Drawing.PointF structures /// that represent the vertices of the polygon</param> /// <param name="brush">The brush used to paint the polygon's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or NULL to paint a solid line</param> public void DrawPolygon(IEnumerable<PointF> points, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { var iter = points.GetEnumerator(); if (!iter.MoveNext()) return; using (var geom = new PathGeometry(D2dFactory.NativeFactory)) { var sink = geom.Open(); var pt1 = iter.Current; sink.BeginFigure(pt1.ToSharpDX(), FigureBegin.Hollow); while (iter.MoveNext()) { sink.AddLine(iter.Current.ToSharpDX()); } sink.EndFigure(FigureEnd.Closed); sink.Close(); sink.Dispose(); m_renderTarget.DrawGeometry(geom, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); } }
/// <summary> /// Draws a geometry previosly defined</summary> /// <param name="geometry">The geometry to draw</param> /// <param name="color">The color used to paint the geometry's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of the geometry's stroke, or null to paint a solid stroke</param> public void DrawGeometry(D2dGeometry geometry, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawGeometry(geometry, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws a line between the specified points</summary> /// <param name="pt1X">The starting x-coordinate of the line, in pixels</param> /// <param name="pt1Y">The starting y-coordinate of the line, in pixels</param> /// <param name="pt2X">The ending x-coordinate of the line, in pixels</param> /// <param name="pt2Y">The ending y-coordinate of the line, in pixels</param> /// <param name="color">The color used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or null to paint a solid line</param> public void DrawLine(float pt1X, float pt1Y, float pt2X, float pt2Y, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawLine(pt1X, pt1Y, pt2X, pt2Y, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws a path defined by an enumeration of EdgeStyleData structures</summary> /// <param name="path">The enumeration of drawing primitives that describes the contents of the path</param> /// <param name="color">The color used to paint the path's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <remarks>Assume the end point of one primitive be coincident with the start point of the following primitive in a path</remarks> /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or null to paint a solid stroke</param> public void DrawPath(IEnumerable<EdgeStyleData> path, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawPath(path, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws a geometry previosly defined</summary> /// <param name="geometry">The geometry to draw</param> /// <param name="brush">The brush used to paint the geometry's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of the geometry's stroke, or null to paint a solid stroke</param> public void DrawGeometry(D2dGeometry geometry, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_renderTarget.DrawGeometry(geometry.NativeGeometry, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness and style.</summary> /// <param name="point">Specified point</param> /// <param name="strokeWidth">Stroke width</param> /// <param name="strokeStyle">D2dStrokeStyle</param> /// <returns>True iff geometry's stroke contains specified point</returns> public bool StrokeContainsPoint(PointF point, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { return m_geometry.StrokeContainsPoint(point.ToSharpDX(), strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws the outline of the specified rounded rectangle</summary> /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in pixels</param> /// <param name="brush">The brush used to paint the rounded rectangle's outline</param> /// <param name="strokeWidth">The width of the rounded rectangle's stroke. The stroke is centered on the /// rounded rectangle's outline.</param> /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or null to paint a solid stroke</param> public void DrawRoundedRectangle(D2dRoundedRect roundedRect, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { var roundrect = new RoundedRectangle(); roundrect.RadiusX = roundedRect.RadiusX; roundrect.RadiusY = roundedRect.RadiusY; roundrect.Rect.Top = roundedRect.Rect.Top; roundrect.Rect.Left = roundedRect.Rect.Left; roundrect.Rect.Right = roundedRect.Rect.Right; roundrect.Rect.Bottom = roundedRect.Rect.Bottom; m_renderTarget.DrawRoundedRectangle(roundrect, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws the outline of a rectangle that has the specified dimensions and stroke style</summary> /// <param name="rect">The dimensions of the rectangle to draw, in pixels</param> /// <param name="brush">The brush used to paint the rectangle's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width /// of the rectangle's stroke. The stroke is centered on the rectangle's outline.</param> /// <param name="strokeStyle">The style of stroke to paint or null to draw a solid line</param> public void DrawRectangle(RectangleF rect, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { var r = new SharpDX.RectangleF(rect.Left, rect.Top, rect.Right, rect.Bottom); m_renderTarget.DrawRectangle(r, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws the outline of the specified ellipse</summary> /// <param name="ellipse">Position and radius of the ellipse to draw in pixels</param> /// <param name="color">The color used to paint the ellipse's outline</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the ellipse's outline or null to draw a solid line</param> public void DrawEllipse(D2dEllipse ellipse, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawEllipse(ellipse, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws an arc representing a portion of an ellipse specified by a D2dEllipse</summary> /// <param name="ellipse">Ellipse to draw</param> /// <param name="brush">The brush used to paint the arc's outline</param> /// <param name="startAngle">Starting angle in degrees measured clockwise from the x-axis /// to the starting point of the arc</param> /// <param name="sweepAngle">Sweep angle in degrees measured clockwise from the startAngle /// parameter to ending point of the arc</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered /// on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the arc's outline or null to draw a solid line</param> public void DrawArc(D2dEllipse ellipse, D2dBrush brush, float startAngle, float sweepAngle, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { // compute steps float step = Tessellation / m_scale.X; float angle1 = startAngle * ToRadian; float angle2 = (startAngle + sweepAngle) * ToRadian; if (angle1 > angle2) { float temp = angle1; angle1 = angle2; angle2 = temp; } float cx = ellipse.Center.X; float cy = ellipse.Center.Y; var v1 = new Vec2F(); v1.X = ellipse.RadiusX * (float)Math.Cos(angle1); v1.Y = ellipse.RadiusY * (float)Math.Sin(angle1); var v2 = new Vec2F(); v2.X = ellipse.RadiusX * (float)Math.Cos(angle2); v2.Y = ellipse.RadiusY * (float)Math.Sin(angle2); float arcLen = (v2 - v1).Length; // approx arc len. float numSegs = arcLen / step; float dtheta = (angle2 - angle1) / numSegs; m_tempPoints.Clear(); for (float theta = angle1; theta < angle2; theta += dtheta) { var pt = new PointF(); pt.X = cx + ellipse.RadiusX * (float)Math.Cos(theta); pt.Y = cy + ellipse.RadiusY * (float)Math.Sin(theta); m_tempPoints.Add(pt); } DrawLines(m_tempPoints, brush, strokeWidth, strokeStyle); }
/// <summary> /// Draws a line between the specified points</summary> /// <param name="pt1X">The starting x-coordinate of the line, in pixels</param> /// <param name="pt1Y">The starting y-coordinate of the line, in pixels</param> /// <param name="pt2X">The ending x-coordinate of the line, in pixels</param> /// <param name="pt2Y">The ending y-coordinate of the line, in pixels</param> /// <param name="brush">The brush used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or null to paint a solid line</param> public void DrawLine(float pt1X, float pt1Y, float pt2X, float pt2Y, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_renderTarget.DrawLine( new Vector2(pt1X, pt1Y), new Vector2(pt2X, pt2Y), brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws an arc representing a portion of an ellipse specified by a D2dEllipse</summary> /// <param name="ellipse">Ellipse to draw</param> /// <param name="color">The color used to paint the arc's outline</param> /// <param name="startAngle">Starting angle in degrees measured clockwise from the x-axis /// to the starting point of the arc</param> /// <param name="sweepAngle">Sweep angle in degrees measured clockwise from the startAngle /// parameter to ending point of the arc</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered /// on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the arc's outline or null to draw a solid line</param> public void DrawArc(D2dEllipse ellipse, Color color, float startAngle, float sweepAngle, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawArc(ellipse, m_solidColorBrush, startAngle, sweepAngle, strokeWidth, strokeStyle); }
/// <summary> /// Draws a line between the specified points</summary> /// <param name="pt1">The start point of the line, in pixels</param> /// <param name="pt2">The end point of the line, in pixels</param> /// <param name="brush">The brush used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or NULL to paint a solid line</param> public void DrawLine(PointF pt1, PointF pt2, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_renderTarget.DrawLine(pt1.ToSharpDX(), pt2.ToSharpDX(), brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws a Bézier spline defined by four System.Drawing.PointF structures</summary> /// <param name="pt1">Represents the starting point of the curve</param> /// <param name="pt2">Represents the first control point for the curve</param> /// <param name="pt3">Represents the second control point for the curve</param> /// <param name="pt4">Represents the ending point of the curve</param> /// <param name="brush">The brush used to paint the curve's stroke</param> /// <param name="strokeWidth">The thickness of the geometry's stroke. The stroke is centered on the geometry's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the geometry's outline or null to draw a solid line</param> public void DrawBezier(PointF pt1, PointF pt2, PointF pt3, PointF pt4, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { using (var geom = new PathGeometry(D2dFactory.NativeFactory)) { var sink = geom.Open(); sink.BeginFigure(pt1.ToSharpDX(), FigureBegin.Hollow); var seg = new BezierSegment { Point1 = pt2.ToSharpDX(), Point2 = pt3.ToSharpDX(), Point3 = pt4.ToSharpDX() }; sink.AddBezier(seg); sink.EndFigure(FigureEnd.Open); sink.Close(); sink.Dispose(); var stroke = strokeStyle == null ? null : strokeStyle.NativeStrokeStyle; m_renderTarget.DrawGeometry(geom, brush.NativeBrush, strokeWidth, stroke); } }
/// <summary> /// Draws a series of line segments that connect an array of System.Drawing.PointF</summary> /// <param name="points">Array of PointF that represent the points to connect</param> /// <param name="brush">The brush used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or NULL to paint a solid line</param> public void DrawLines(IEnumerable<PointF> points, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { var iter = points.GetEnumerator(); if (!iter.MoveNext()) return; var transparent = brush.Opacity < 1.0f; if (!transparent) { var sbrush = brush as D2dSolidColorBrush; if (sbrush != null) transparent = sbrush.Color.A < 255; } var nstroke = (strokeStyle ?? s_strokeStyle).NativeStrokeStyle; if (transparent) { using (var geom = new PathGeometry(D2dFactory.NativeFactory)) { var sink = geom.Open(); var pt1 = iter.Current; sink.BeginFigure(pt1.ToSharpDX(), FigureBegin.Hollow); while (iter.MoveNext()) { sink.AddLine(iter.Current.ToSharpDX()); } sink.EndFigure(FigureEnd.Open); sink.Close(); sink.Dispose(); m_renderTarget.DrawGeometry(geom, brush.NativeBrush, strokeWidth, nstroke); } } else { var nbrush = brush.NativeBrush; var pt1 = iter.Current; while (iter.MoveNext()) { var pt2 = iter.Current; m_renderTarget.DrawLine(pt1.ToSharpDX(), pt2.ToSharpDX(), nbrush, strokeWidth, nstroke); pt1 = pt2; } } }
/// <summary> /// Draws a Bézier spline defined by four System.Drawing.PointF structures</summary> /// <param name="pt1">Represents the starting point of the curve</param> /// <param name="pt2">Represents the first control point for the curve</param> /// <param name="pt3">Represents the second control point for the curve</param> /// <param name="pt4">Represents the ending point of the curve</param> /// <param name="color">The color used to paint the curve's stroke</param> /// <param name="strokeWidth">The thickness of the geometry's stroke. The stroke is centered on the geometry's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the geometry's outline or null to draw a solid line</param> public void DrawBezier(PointF pt1, PointF pt2, PointF pt3, PointF pt4, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawBezier(pt1, pt2, pt3, pt4, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws a polygon defined by an array of PointF structures</summary> /// <param name="points">Array of System.Drawing.PointF structures /// that represent the vertices of the polygon</param> /// <param name="color">The color used to paint the line's stroke</param> /// <param name="strokeWidth">A value greater than or equal to 0.0f that specifies the width of the stroke</param> /// <param name="strokeStyle">The style of stroke to paint, or NULL to paint a solid line</param> public void DrawPolygon(IEnumerable<PointF> points, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawPolygon(points, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws the outline of the specified ellipse</summary> /// <param name="rect">The rectangle, in pixels, that encloses the ellipse to paint</param> /// <param name="brush">The brush used to paint the ellipse's outline</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the ellipse's outline or null to draw a solid line</param> public void DrawEllipse(RectangleF rect, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { var tmpEllipse = new Ellipse(); tmpEllipse.RadiusX = rect.Width * 0.5f; tmpEllipse.RadiusY = rect.Height * 0.5f; tmpEllipse.Point = new Vector2(rect.X + tmpEllipse.RadiusX, rect.Y + tmpEllipse.RadiusY); m_renderTarget.DrawEllipse(tmpEllipse, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }
/// <summary> /// Draws the outline of the specified rounded rectangle</summary> /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in pixels</param> /// <param name="color">The color used to paint the rounded rectangle's stroke</param> /// <param name="strokeWidth">The width of the rounded rectangle's stroke. The stroke is centered on the /// rounded rectangle's outline.</param> /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or null to paint a solid stroke</param> public void DrawRoundedRectangle(D2dRoundedRect roundedRect, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawRoundedRectangle(roundedRect, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Draws the outline of the specified ellipse</summary> /// <param name="rect">The rectangle, in pixels, that encloses the ellipse to paint</param> /// <param name="color">The color used to paint the ellipse's outline</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the ellipse's outline or null to draw a solid line</param> public void DrawEllipse(RectangleF rect, Color color, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { m_solidColorBrush.Color = color; DrawEllipse(rect, m_solidColorBrush, strokeWidth, strokeStyle); }
/// <summary> /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness and style.</summary> /// <param name="point">Specified point</param> /// <param name="strokeWidth">Stroke width</param> /// <param name="strokeStyle">D2dStrokeStyle</param> /// <returns>True iff geometry's stroke contains specified point</returns> public bool StrokeContainsPoint(PointF point, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { return(m_geometry.StrokeContainsPoint(point.ToSharpDX(), strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null)); }
/// <summary> /// Draws the outline of the specified ellipse using the specified stroke style</summary> /// <param name="ellipse">Position and radius of the ellipse to draw in pixels</param> /// <param name="brush">The brush used to paint the ellipse's outline</param> /// <param name="strokeWidth">The thickness of the ellipse's stroke. The stroke is centered on the ellipse's outline.</param> /// <param name="strokeStyle">The style of stroke to apply to the ellipse's outline or null to draw a solid line</param> public void DrawEllipse(D2dEllipse ellipse, D2dBrush brush, float strokeWidth = 1.0f, D2dStrokeStyle strokeStyle = null) { var tmpEllipse = new Ellipse(); tmpEllipse.Point = new DrawingPointF(ellipse.Center.X, ellipse.Center.Y); tmpEllipse.RadiusX = ellipse.RadiusX; tmpEllipse.RadiusY = ellipse.RadiusY; m_renderTarget.DrawEllipse(tmpEllipse, brush.NativeBrush, strokeWidth, strokeStyle != null ? strokeStyle.NativeStrokeStyle : null); }