Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="stylusShape"></param>
        /// <returns></returns>
        public bool HitTest(IEnumerable <Point> path, StylusShape stylusShape)
        {
            // Check the input parameters
            if (path == null)
            {
                throw new System.ArgumentNullException("path");
            }
            if (stylusShape == null)
            {
                throw new System.ArgumentNullException("stylusShape");
            }

            if (IEnumerablePointHelper.GetCount(path) == 0)
            {
                return(false);
            }

            ErasingStroke erasingStroke = new ErasingStroke(stylusShape);

            erasingStroke.MoveTo(path);

            Rect erasingBounds = erasingStroke.Bounds;

            if (erasingBounds.IsEmpty)
            {
                return(false);
            }

            if (erasingBounds.IntersectsWith(this.GetBounds()))
            {
                return(erasingStroke.HitTest(StrokeNodeIterator.GetIterator(this, this.DrawingAttributes)));
            }

            return(false);
        }
Example #2
0
        public TextContext GetErasingStroke(Point[] pointList)
        {
            var erasingStroke = new ErasingStroke(new RectangleStylusShape(10, 10));

            erasingStroke.MoveTo(pointList);

            var strokeNodeIterator = StrokeNodeIterator.GetIterator(new StylusPointCollection(pointList.Select(temp => new Point(temp.X, temp.Y))),
                                                                    new DrawingAttributes()
            {
                Width  = 5,
                Height = 5
            });

            return(new TextContext(strokeNodeIterator, erasingStroke, new List <StrokeIntersection>(4096), this));
        }