void DrawingPanel_Paint(object sender, PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; Matrix4 mtx = Matrix4.CreateTranslation(-m_SVGPathBounds.Center.X, -m_SVGPathBounds.Center.Y); mtx.Scale(m_Scale, m_Scale, MatrixOrder.Append); mtx.Translate(m_x, m_y, MatrixOrder.Append); ITransform transform = null; if (rbBilinear.IsChecked) { Bilinear tr = new Bilinear( m_SVGPathScaledBounds.Left, m_SVGPathScaledBounds.Top, m_SVGPathScaledBounds.Right, m_SVGPathScaledBounds.Bottom, m_PolygonElement.Polygon); if (tr.IsValid) { transform = tr; } } else { Perspective tr = new Perspective( m_SVGPathScaledBounds.Left, m_SVGPathScaledBounds.Top, m_SVGPathScaledBounds.Right, m_SVGPathScaledBounds.Bottom, m_PolygonElement.Polygon); if (tr.IsValid() && Perspective.IsConvex(m_PolygonElement.Polygon)) { transform = tr; } } // GeometryTransformer transformer = null; if (transform != null) { transformer = new GeometryTransformer(transform); } // Render transformed SVG m_SVGPath.Render(e.Graphics, mtx, transformer); // Render transformed ellipse Point center = m_SVGPathScaledBounds.Center; EllipseGeometry FilledEllipse = new EllipseGeometry(center.X, center.Y, m_SVGPathScaledBounds.Width / 2, m_SVGPathScaledBounds.Height / 2, 200); GeometryStroke EllipseOutline = new GeometryStroke(FilledEllipse); EllipseOutline.Width = 3.0; Geometry TransformedFilledEllipse = FilledEllipse; Geometry TransformedEllipesOutline = EllipseOutline; if (transform != null) { TransformedFilledEllipse = new GeometryTransformer(FilledEllipse, transform); TransformedEllipesOutline = new GeometryTransformer(EllipseOutline, transform); } SmoothingMode saveSmoothingMode = e.Graphics.SmoothingMode; e.Graphics.SmoothingMode = SmoothingMode.None; { e.Graphics.FillGeometry(m_EllipseBrush, TransformedFilledEllipse); } e.Graphics.SmoothingMode = saveSmoothingMode; e.Graphics.FillGeometry(m_EllipsePen.Color, TransformedEllipesOutline); }