Stroke.GetEraseResult Method

Definition

Returns the segments of the current Stroke after part of the Stroke is erased.

Overloads

GetEraseResult(IEnumerable<Point>)

Returns segments of the current Stroke that are outside the specified bounds.

GetEraseResult(Rect)

Returns segments of the current Stroke that are outside the specified rectangle.

GetEraseResult(IEnumerable<Point>, StylusShape)

Returns the segments of the current Stroke after it is dissected by the designated path using the specified StylusShape.

GetEraseResult(IEnumerable<Point>)

Returns segments of the current Stroke that are outside the specified bounds.

public:
 System::Windows::Ink::StrokeCollection ^ GetEraseResult(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ lassoPoints);
public System.Windows.Ink.StrokeCollection GetEraseResult (System.Collections.Generic.IEnumerable<System.Windows.Point> lassoPoints);
member this.GetEraseResult : seq<System.Windows.Point> -> System.Windows.Ink.StrokeCollection
Public Function GetEraseResult (lassoPoints As IEnumerable(Of Point)) As StrokeCollection

Parameters

lassoPoints
IEnumerable<Point>

An array of type Point that specifies the area to erase.

Returns

A StrokeCollection that contains the segments of the current Stroke that are outside the specified bounds.

Examples

The following example removes the ink that is within the specified bounds.

Point[] myPoints = new Point[] {
    new Point(100, 100),
    new Point(200, 100),
    new Point(200, 200),
    new Point(100, 200)};

StrokeCollection eraseResults = aStroke.GetEraseResult(myPoints);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(eraseResults);
Dim myPoints() As System.Windows.Point = _
              {New System.Windows.Point(100, 100), _
               New System.Windows.Point(200, 100), _
               New System.Windows.Point(200, 200), _
               New System.Windows.Point(100, 200)}

Dim eraseResults As StrokeCollection = aStroke.GetEraseResult(myPoints)

' inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke)
inkCanvas1.Strokes.Add(eraseResults)

Remarks

The GetEraseResult method returns a StrokeCollection that contains strokes that represent the segments of the Stroke that are outside of lassoPoints. GetEraseResult does not change the original Stroke.

The GetClipResult method connects the first and last points in lassoPoints to create the lasso.

GetEraseResult(Rect)

Returns segments of the current Stroke that are outside the specified rectangle.

public:
 System::Windows::Ink::StrokeCollection ^ GetEraseResult(System::Windows::Rect bounds);
public System.Windows.Ink.StrokeCollection GetEraseResult (System.Windows.Rect bounds);
member this.GetEraseResult : System.Windows.Rect -> System.Windows.Ink.StrokeCollection
Public Function GetEraseResult (bounds As Rect) As StrokeCollection

Parameters

bounds
Rect

A Rect that specifies the area to erase.

Returns

A StrokeCollection that contains the segments of the current Stroke that are outside the bounds of the specified Rect.

Examples

The following example removes the ink that is within the specified bounds.

Rect myRect = new Rect(100, 100, 100, 100);

StrokeCollection eraseResults = aStroke.GetEraseResult(myRect);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(eraseResults);
Dim myRect As New Rect(100, 100, 100, 100)

Dim eraseResults As StrokeCollection = aStroke.GetEraseResult(myRect)

' inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke)
inkCanvas1.Strokes.Add(eraseResults)

Remarks

The GetEraseResult method returns a StrokeCollection that contains strokes that represent the segments of the Stroke that are outside of bounds. GetEraseResult does not change the original Stroke.

GetEraseResult(IEnumerable<Point>, StylusShape)

Returns the segments of the current Stroke after it is dissected by the designated path using the specified StylusShape.

public:
 System::Windows::Ink::StrokeCollection ^ GetEraseResult(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ eraserPath, System::Windows::Ink::StylusShape ^ eraserShape);
public System.Windows.Ink.StrokeCollection GetEraseResult (System.Collections.Generic.IEnumerable<System.Windows.Point> eraserPath, System.Windows.Ink.StylusShape eraserShape);
member this.GetEraseResult : seq<System.Windows.Point> * System.Windows.Ink.StylusShape -> System.Windows.Ink.StrokeCollection
Public Function GetEraseResult (eraserPath As IEnumerable(Of Point), eraserShape As StylusShape) As StrokeCollection

Parameters

eraserPath
IEnumerable<Point>

An array of type Point that specifies the path that dissects the Stroke.

eraserShape
StylusShape

A StylusShape that specifies the shape of the eraser.

Returns

A StrokeCollection that contains copies of the segments of the current Stroke after it is dissected by the specified path.

Examples

The following example demonstrates how to erase the ink that intersects a specified path.

Point[] myPoints = new Point[] {
    new Point(100, 100),
    new	Point(200, 100),
    new	Point(200, 200),
    new	Point(100, 200)};

EllipseStylusShape myStylus = new EllipseStylusShape(5.0, 5.0, 0.0);

StrokeCollection eraseResults = aStroke.GetEraseResult(myPoints, myStylus);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(eraseResults);
Dim myPoints() As System.Windows.Point = _
                      {New System.Windows.Point(100, 100), _
                       New System.Windows.Point(200, 100), _
                       New System.Windows.Point(200, 200), _
                       New System.Windows.Point(100, 200)}

Dim myStylus As New EllipseStylusShape(5.0, 5.0, 0.0)

Dim eraseResults As StrokeCollection = aStroke.GetEraseResult(myPoints, myStylus)

' inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke)
inkCanvas1.Strokes.Add(eraseResults)

Remarks

The GetEraseResult method uses eraserShape to hit test the stroke along eraserPath and returns a StrokeCollection that represent dissected segments. GetEraseResult does not change the original Stroke.

Applies to