Ejemplo n.º 1
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();
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Draws a <see cref="SplinePrimitive"/>.
		/// </summary>
		protected override void DrawSplinePrimitive(SplinePrimitive spline)
		{
			DrawSplinePrimitive(Surface.FinalBuffer, _pen, spline, Dpi);
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Draws a <see cref="SplinePrimitive"/>. Must be overridden and implemented.
		/// </summary>
		protected abstract void DrawSplinePrimitive(SplinePrimitive spline);
Ejemplo n.º 4
0
		/// <summary>
		/// Cloning constructor.
		/// </summary>
		protected SplinePrimitive(SplinePrimitive source, ICloningContext context)
		{
			context.CloneFields(source, this);
			_points = new PointsList(source._points, this);
		}
Ejemplo n.º 5
0
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 protected SplinePrimitive(SplinePrimitive source, ICloningContext context)
 {
     context.CloneFields(source, this);
     _points = new PointsList(source._points, this);
 }