/// <summary> /// Draws the given rounded rectangle with the given brush. /// </summary> public void DrawRoundedRectangle(RectangleF rectangle, float radiusX, float radiusY, BrushResource brush, float strokeWidth = 1f) { if (_renderTarget == null) { return; } rectangle.EnsureNotEmpty(nameof(rectangle)); brush.EnsureNotNull(nameof(brush)); radiusX.EnsurePositiveOrZero(nameof(radiusX)); radiusY.EnsurePositiveOrZero(nameof(radiusY)); strokeWidth.EnsurePositiveOrZero(nameof(strokeWidth)); var roundedRect = new D2D.RoundedRectangle { Rect = rectangle, RadiusX = radiusX, RadiusY = radiusY }; _renderTarget.DrawRoundedRectangle( roundedRect, brush.GetBrush(this.Device), strokeWidth); }
/// <summary> /// Draws the outline of the specified rounded rectangle. /// </summary> /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in device-independent pixels. </param> /// <param name="brush">The <see cref="ID2D1Brush"/> 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. The default value is 1.0f. </param> public void DrawRoundedRectangle(RoundedRectangle roundedRect, ID2D1Brush brush, float strokeWidth) { DrawRoundedRectangle(ref roundedRect, brush, strokeWidth, null); }
/// <summary> /// Draws the outline of the specified rounded rectangle using the specified stroke style. /// </summary> /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in device-independent 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. The default value is 1.0f.</param> /// <param name="strokeStyle">The style of the rounded rectangle's stroke, or NULL to paint a solid stroke. The default value is NULL. </param> public void DrawRoundedRectangle(RoundedRectangle roundedRect, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle) { DrawRoundedRectangle(ref roundedRect, brush, strokeWidth, strokeStyle); }
/// <summary> /// Draws the outline of the specified rounded rectangle. /// </summary> /// <param name="roundedRect">The dimensions of the rounded rectangle to draw, in device-independent pixels. </param> /// <param name="brush">The <see cref="ID2D1Brush"/> used to paint the rounded rectangle's outline. </param> public void DrawRoundedRectangle(RoundedRectangle roundedRect, ID2D1Brush brush) { DrawRoundedRectangle(ref roundedRect, brush, 1.0f, null); }