/// <summary> /// Draws a <see cref="PointPrimitive"/>. /// </summary> protected override void DrawPointPrimitive(PointPrimitive pointPrimitive) { Surface.FinalBuffer.Graphics.Transform = pointPrimitive.SpatialTransform.CumulativeTransform; pointPrimitive.CoordinateSystem = CoordinateSystem.Source; SizeF dropShadowOffset = GetDropShadowOffset(pointPrimitive, Dpi); var width = CalculateScaledPenWidth(pointPrimitive, 1, Dpi); // Draw drop shadow _brush.Color = Color.Black; Surface.FinalBuffer.Graphics.FillRectangle( _brush, pointPrimitive.Point.X + dropShadowOffset.Width, pointPrimitive.Point.Y + dropShadowOffset.Height, width, width); // Draw point _brush.Color = pointPrimitive.Color; Surface.FinalBuffer.Graphics.FillRectangle( _brush, pointPrimitive.Point.X, pointPrimitive.Point.Y, width, width); pointPrimitive.ResetCoordinateSystem(); Surface.FinalBuffer.Graphics.ResetTransform(); }
/// <summary> /// Draws a point primitive to the specified destination buffer. /// </summary> /// <param name="buffer">The destination buffer.</param> /// <param name="brush">A GDI brush to use for drawing.</param> /// <param name="point">The point primitive to be drawn.</param> /// <param name="dpi">The intended output DPI.</param> public static void DrawPointPrimitive(IGdiBuffer buffer, SolidBrush brush, PointPrimitive point, float dpi = _nominalScreenDpi) { buffer.Graphics.Transform = point.SpatialTransform.CumulativeTransform; point.CoordinateSystem = CoordinateSystem.Source; try { var dropShadowOffset = GetDropShadowOffset(point, dpi); var width = CalculateScaledPenWidth(point, 1, dpi); // Draw drop shadow brush.Color = Color.Black; buffer.Graphics.FillRectangle( brush, point.Point.X + dropShadowOffset.Width, point.Point.Y + dropShadowOffset.Height, width, width); // Draw point brush.Color = point.Color; buffer.Graphics.FillRectangle( brush, point.Point.X, point.Point.Y, width, width); } finally { point.ResetCoordinateSystem(); buffer.Graphics.ResetTransform(); } }