public GeometryAuxWeight(Geometry geometry) { m_mtx_zoom_in_y = Matrix4.CreateScaling(1, 100); m_mtx_zoom_out_y = Matrix4.CreateScaling(1, 1.0 / 100.0); m_trans_zoom_in_y = GeometryMatrix4Transformer.CreateOptimizedTransformer(geometry, m_mtx_zoom_in_y); m_contour = new GeometryContour(m_trans_zoom_in_y); m_trans_zoom_out = GeometryMatrix4Transformer.CreateOptimizedTransformer(m_contour, m_mtx_zoom_out_y); m_contour.AutoDetectOrientation = false; Geometry = m_trans_zoom_out; }
public SVGPath() { m_storage = new GraphicsPath(); m_attr_storage = new List <SVGPathAttributes>(); m_attr_stack = new List <SVGPathAttributes>(); m_transform = Matrix4.Identity; m_curved = new FlattenCurveGeometry(m_storage); m_curved_stroked = new GeometryStroke(m_curved); m_curved_stroked_trans = new GeometryMatrix4Transformer(m_curved_stroked, m_transform); m_curved_trans = new GeometryMatrix4Transformer(m_curved, m_transform); m_curved_trans_contour = new GeometryContour(m_curved_trans); m_curved_trans_contour.AutoDetectOrientation = false; }
protected override void OnPaint(GUI.PaintEventArgs e) { base.OnPaint(e); Graphics graphics = e.Graphics; graphics.TextRenderingHint = TextRenderingHint.AntiAlias; graphics.SmoothingMode = SmoothingMode.AntiAlias; Geometry outlinePath = GeometryMatrix4Transformer. CreateOptimizedTransformer(Common.GraphicsPath_AltSketch, Matrix4.CreateScaling(0.9 * ClientWidth / Common.GraphicsPath_AltSketch_Bounds.Width)); Rect outlinePathBounds = outlinePath.Bounds; Point textOffset = ((ClientSize - outlinePathBounds.Size) / 2).ToPoint(); graphics.TranslateTransform(textOffset.X, textOffset.Y - outlinePathBounds.Top); GeometryVertexCommandAndFlags flag = GeometryVertexCommandAndFlags.None; if (rbCloseCW.IsChecked) { flag = GeometryVertexCommandAndFlags.FlagCW; } else if (rbCloseCCW.IsChecked) { flag = GeometryVertexCommandAndFlags.FlagCCW; } SpecialContourGeometry specialContourGeometry = new SpecialContourGeometry(outlinePath, flag); FlattenCurveGeometry curve = new FlattenCurveGeometry(specialContourGeometry); GeometryContour contour = new GeometryContour(curve); contour.Width = m_WidthSlider.Value; contour.AutoDetectOrientation = m_AutoDetectCheckBox.IsChecked; graphics.FillGeometry(m_FillBrush, contour); graphics.DrawGeometry(m_ContourPen, contour); }