/// <summary> /// Draws an arc primitive to the specified destination buffer. /// </summary> /// <param name="buffer">The destination buffer.</param> /// <param name="pen">A GDI pen to use for drawing.</param> /// <param name="arc">The arc primitive to be drawn.</param> /// <param name="dpi">The intended output DPI.</param> public static void DrawArcPrimitive(IGdiBuffer buffer, Pen pen, IArcGraphic arc, float dpi = _nominalScreenDpi) { buffer.Graphics.Transform = arc.SpatialTransform.CumulativeTransform; arc.CoordinateSystem = CoordinateSystem.Source; buffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias; try { var rectangle = new RectangleF(arc.TopLeft.X, arc.TopLeft.Y, arc.Width, arc.Height); rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle); var dropShadowOffset = GetDropShadowOffset(arc, dpi); // Draw drop shadow pen.Color = Color.Black; pen.Width = CalculateScaledPenWidth(arc, 1, dpi); SetDashStyle(pen, arc); buffer.Graphics.DrawArc( pen, rectangle.Left + dropShadowOffset.Width, rectangle.Top + dropShadowOffset.Height, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); // Draw rectangle pen.Color = arc.Color; buffer.Graphics.DrawArc( pen, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); } finally { buffer.Graphics.SmoothingMode = SmoothingMode.None; arc.ResetCoordinateSystem(); buffer.Graphics.ResetTransform(); } }
/// <summary> /// Draws a <see cref="ArcPrimitive"/>. /// </summary> protected override void DrawArcPrimitive(IArcGraphic arc) { Surface.FinalBuffer.Graphics.Transform = arc.SpatialTransform.CumulativeTransform; arc.CoordinateSystem = CoordinateSystem.Source; Surface.FinalBuffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias; RectangleF rectangle = new RectangleF(arc.TopLeft.X, arc.TopLeft.Y, arc.Width, arc.Height); rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle); SizeF dropShadowOffset = GetDropShadowOffset(arc, Dpi); // Draw drop shadow _pen.Color = Color.Black; _pen.Width = CalculateScaledPenWidth(arc, 1, Dpi); SetDashStyle(arc); Surface.FinalBuffer.Graphics.DrawArc( _pen, rectangle.Left + dropShadowOffset.Width, rectangle.Top + dropShadowOffset.Height, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); // Draw rectangle _pen.Color = arc.Color; Surface.FinalBuffer.Graphics.DrawArc( _pen, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); arc.ResetCoordinateSystem(); Surface.FinalBuffer.Graphics.ResetTransform(); }
/// <summary> /// Draws a <see cref="ArcPrimitive"/>. /// </summary> protected override void DrawArcPrimitive(IArcGraphic arc) { Surface.FinalBuffer.Graphics.Transform = arc.SpatialTransform.CumulativeTransform; arc.CoordinateSystem = CoordinateSystem.Source; Surface.FinalBuffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias; RectangleF rectangle = new RectangleF(arc.TopLeft.X, arc.TopLeft.Y, arc.Width, arc.Height); rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle); SizeF dropShadowOffset = GetDropShadowOffset(arc, Dpi); // Draw drop shadow _pen.Color = Color.Black; _pen.Width = CalculateScaledPenWidth(arc, 1, Dpi); SetDashStyle(arc); Surface.FinalBuffer.Graphics.DrawArc( _pen, rectangle.Left + dropShadowOffset.Width, rectangle.Top + dropShadowOffset.Height, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); // Draw rectangle _pen.Color = arc.Color; Surface.FinalBuffer.Graphics.DrawArc( _pen, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); arc.ResetCoordinateSystem(); Surface.FinalBuffer.Graphics.ResetTransform(); }
/// <summary> /// Draws an arc primitive to the specified destination buffer. /// </summary> /// <param name="buffer">The destination buffer.</param> /// <param name="pen">A GDI pen to use for drawing.</param> /// <param name="arc">The arc primitive to be drawn.</param> /// <param name="dpi">The intended output DPI.</param> public static void DrawArcPrimitive(IGdiBuffer buffer, Pen pen, IArcGraphic arc, float dpi = _nominalScreenDpi) { buffer.Graphics.Transform = arc.SpatialTransform.CumulativeTransform; arc.CoordinateSystem = CoordinateSystem.Source; buffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias; try { var rectangle = new RectangleF(arc.TopLeft.X, arc.TopLeft.Y, arc.Width, arc.Height); rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle); var dropShadowOffset = GetDropShadowOffset(arc, dpi); // Draw drop shadow pen.Color = Color.Black; pen.Width = CalculateScaledPenWidth(arc, 1, dpi); SetDashStyle(pen, arc); buffer.Graphics.DrawArc( pen, rectangle.Left + dropShadowOffset.Width, rectangle.Top + dropShadowOffset.Height, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); // Draw rectangle pen.Color = arc.Color; buffer.Graphics.DrawArc( pen, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, arc.StartAngle, arc.SweepAngle); } finally { buffer.Graphics.SmoothingMode = SmoothingMode.None; arc.ResetCoordinateSystem(); buffer.Graphics.ResetTransform(); } }