Example #1
0
        private static IGraphic CreateInterpolated(IList <PointF> dataPoints)
        {
            var curve = new SplinePrimitive();

            curve.Points.AddRange(dataPoints);
            return(curve);
        }
        public void DrawSpline()
        {
            var rectangle = new Rectangle(new Point(), SelectedPresentationImage.SceneSize);

            rectangle.Inflate(-10, -10);
            var spline = new SplinePrimitive {
                Points = { rectangle.Location, rectangle.Location + new Size(rectangle.Width / 2, 0), rectangle.Location + new Size(rectangle.Width, 0), rectangle.Location + rectangle.Size, rectangle.Location + new Size(0, rectangle.Height), rectangle.Location + new Size(0, rectangle.Height / 2) }
            };

            DrawGraphic(new VerticesControlGraphic(true, spline));
        }
Example #3
0
        /// <summary>
        /// Draws a spline 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="spline">The spline primitive to be drawn.</param>
        /// <param name="dpi">The intended output DPI.</param>
        public static void DrawSplinePrimitive(IGdiBuffer buffer, Pen pen, SplinePrimitive spline, float dpi = _nominalScreenDpi)
        {
            buffer.Graphics.Transform     = spline.SpatialTransform.CumulativeTransform;
            spline.CoordinateSystem       = CoordinateSystem.Source;
            buffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            try
            {
                // Draw drop shadow
                pen.Color = Color.Black;
                pen.Width = CalculateScaledPenWidth(spline, 1, dpi);

                SetDashStyle(pen, spline);

                var dropShadowOffset = GetDropShadowOffset(spline, dpi);
                var pathPoints       = GetCurvePoints(spline.Points, dropShadowOffset);

                if (spline.Points.IsClosed)
                {
                    buffer.Graphics.DrawClosedCurve(pen, pathPoints);
                }
                else
                {
                    buffer.Graphics.DrawCurve(pen, pathPoints);
                }

                // Draw line
                pen.Color  = spline.Color;
                pathPoints = GetCurvePoints(spline.Points, SizeF.Empty);

                if (spline.Points.IsClosed)
                {
                    buffer.Graphics.DrawClosedCurve(pen, pathPoints);
                }
                else
                {
                    buffer.Graphics.DrawCurve(pen, pathPoints);
                }
            }
            finally
            {
                buffer.Graphics.SmoothingMode = SmoothingMode.None;
                spline.ResetCoordinateSystem();
                buffer.Graphics.ResetTransform();
            }
        }
Example #4
0
 protected virtual void DrawSplinePrimitive(SplinePrimitive spline)
 {
     GdiRenderer.DrawSplinePrimitive(Surface.OverlayBuffer, _pen, spline, Dpi);
 }
 /// <summary>
 /// Draws a <see cref="SplinePrimitive"/>. Must be overridden and implemented.
 /// </summary>
 protected abstract void DrawSplinePrimitive(SplinePrimitive spline);
Example #6
0
 /// <summary>
 /// Draws a <see cref="SplinePrimitive"/>.
 /// </summary>
 protected override void DrawSplinePrimitive(SplinePrimitive spline)
 {
     DrawSplinePrimitive(Surface.FinalBuffer, _pen, spline, Dpi);
 }