public override void VisitPath( Primitives.Path path ) { if( !InClip( path ) ) { return; } Types.Rectangle bounds = path.GetBounds( _renderer ); Pen[] pens = _renderer.CreatePens( path.Pen ); BrushStage[] brushes = _renderer.CreateBrushes( _graphics, bounds, path.Brush ); GraphicsPath gp = _renderer.CreateGraphicsPath( path ); foreach( BrushStage brush in brushes ) { _graphics.FillPath( brush.GetBrush(), gp ); brush.Dispose(); } foreach( Pen pen in pens ) { _graphics.DrawPath( pen, gp ); pen.Dispose(); } }
private bool InClip( Primitives.VisualItem item ) { if( _clip == null ) { return true; } PointF tl = new PointF( (float) _clip.Left, (float) _clip.Top ); PointF br = new PointF( (float) _clip.Right, (float) _clip.Bottom ); PointF[] pts = new PointF[] { tl, br }; _graphics.TransformPoints( CoordinateSpace.World, CoordinateSpace.Device, pts ); Types.Rectangle clip = new Types.Rectangle( pts[0].X, pts[0].Y, pts[1].X - pts[0].X, pts[1].Y - pts[0].Y ); return Types.Rectangle.Overlap( item.GetBounds( _renderer ), clip ); }