コード例 #1
0
        public void ProcessPath(Path path, Matrix transform)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            Geometry geom   = path.Data;
            bool     fill   = path.Fill != null;
            bool     stroke = path.Stroke != null;

            if ((geom == null) || (!fill && !stroke))
            {
                return;
            }

            Transform transPath = path.RenderTransform;

            if (transPath != null)
            {
                transform *= transPath.Value;
            }

            // When filling, we may be able to determine from bounding box only
            if (fill && _ProcessFilledRect(transform, geom.Bounds))
            {
                fill = false;

                if (!stroke)
                {
                    return;
                }
            }

            StreamGeometry sgeo = geom as StreamGeometry;

            // Avoiding convert to PathGeometry if it's StreamGeometry, which can be walked

            if (sgeo != null)
            {
                if (_geometryWalker == null)
                {
                    _geometryWalker = new GeometryWalker(this);
                }

                _geometryWalker.FindLines(sgeo, stroke, fill, transform);
            }
            else
            {
                PathGeometry pathGeom = PathGeometry.CreateFromGeometry(geom);

                if (pathGeom != null)
                {
                    if (fill)
                    {
                        _ProcessSolidPath(transform, pathGeom);
                    }

                    if (stroke)
                    {
                        _ProcessOutlinePath(transform, pathGeom);
                    }
                }
            }
        }
コード例 #2
0
        public void ProcessPath(Path path, Matrix transform)
        { 
            if (path == null) 
            {
                throw new ArgumentNullException("path"); 
            }

            Geometry geom   = path.Data;
            bool     fill   = path.Fill != null; 
            bool     stroke = path.Stroke != null;
 
            if ((geom == null) || (! fill && ! stroke)) 
            {
                return; 
            }

            Transform transPath = path.RenderTransform;
 
            if (transPath != null)
            { 
                transform *= transPath.Value; 
            }
 
            // When filling, we may be able to determine from bounding box only
            if (fill && _ProcessFilledRect(transform, geom.Bounds))
            {
                fill = false; 

                if (! stroke) 
                { 
                    return;
                } 
            }

            StreamGeometry sgeo = geom as StreamGeometry;
 
            // Avoiding convert to PathGeometry if it's StreamGeometry, which can be walked
 
            if (sgeo != null) 
            {
                if (_geometryWalker == null) 
                {
                    _geometryWalker = new GeometryWalker(this);
                }
 
                _geometryWalker.FindLines(sgeo, stroke, fill, transform);
            } 
            else 
            {
                PathGeometry pathGeom = PathGeometry.CreateFromGeometry(geom); 

                if (pathGeom != null)
                {
                    if (fill) 
                    {
                        _ProcessSolidPath(transform, pathGeom); 
                    } 

                    if (stroke) 
                    {
                        _ProcessOutlinePath(transform, pathGeom);
                    }
                } 
            }
        }