예제 #1
0
        public void Render(Graphics graphics, Matrix4 mtx, GeometryProcessor transformer)
        {
            for (int i = 0; i < m_attr_storage.Count; i++)
            {
                SVGPathAttributes attr = m_attr_storage[i];
                m_transform = attr.Transform;
                m_transform.Multiply(mtx, MatrixOrder.Append);
                UpdateMatrixRelations();

                double scl = m_transform.Get2DScale();
                m_curved.ApproximationScale = scl;
                m_curved.AngleTolerance     = 0.0;

                if (attr.FillFlag)
                {
                    //TEMP  graphics.FillingRule(attr.EvenOddFlag ? FillEvenOdd : FillNonZero);

                    Color color = attr.FillColor;

                    if (System.Math.Abs(m_curved_trans_contour.Width) < 0.0001)
                    {
                        Geometry geometry = new IndexedPathGeometry(m_curved_trans, attr.index);
                        if (transformer == null)
                        {
                            graphics.FillGeometry(color, geometry);
                        }
                        else
                        {
                            transformer.Geometry = geometry;
                            graphics.FillGeometry(color, transformer);
                        }
                    }
                    else
                    {
                        m_curved_trans_contour.MiterLimit = attr.MiterLimit;

                        Geometry geometry = new IndexedPathGeometry(m_curved_trans_contour, attr.index);
                        if (transformer == null)
                        {
                            graphics.FillGeometry(color, geometry);
                        }
                        else
                        {
                            transformer.Geometry = geometry;
                            graphics.FillGeometry(color, transformer);
                        }
                    }
                }

                if (attr.StrokeFlag)
                {
                    m_curved_stroked.Width              = attr.StrokeWidth;
                    m_curved_stroked.LineJoin           = attr.LineJoin;
                    m_curved_stroked.LineCap            = attr.LineCap;
                    m_curved_stroked.MiterLimit         = attr.MiterLimit;
                    m_curved_stroked.InnerJoin          = Sketch.LineJoin.Round;
                    m_curved_stroked.ApproximationScale = scl;

                    // If the *visual* line width is considerable we
                    // turn on processing of curve cusps.
                    //---------------------
                    if (attr.StrokeWidth * scl > 1.0)
                    {
                        m_curved.AngleTolerance = 0.2;
                    }

                    Color color = attr.StrokeColor;

                    //TEMP  graphics.FillingRule(FillNonZero);

                    Geometry geometry = new IndexedPathGeometry(m_curved_stroked_trans, attr.index);
                    if (transformer == null)
                    {
                        graphics.FillGeometry(color, geometry);
                    }
                    else
                    {
                        transformer.Geometry = geometry;
                        graphics.FillGeometry(color, transformer);
                    }
                }
            }
        }
예제 #2
0
 public void Render(Graphics graphics, GeometryProcessor transformer)
 {
     Render(graphics, Matrix4.Identity, transformer);
 }