Stroke.GetRectangleIntersections Method
Returns an array of Point structures that indicate where a Stroke object intersects a given Rectangle.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public Function GetRectangleIntersections ( _
intersectRectangle As Rectangle _
) As StrokeIntersection()
'Usage
Dim instance As Stroke
Dim intersectRectangle As Rectangle
Dim returnValue As StrokeIntersection()
returnValue = instance.GetRectangleIntersections(intersectRectangle)
public StrokeIntersection[] GetRectangleIntersections (
Rectangle intersectRectangle
)
public:
array<StrokeIntersection>^ GetRectangleIntersections (
Rectangle intersectRectangle
)
public StrokeIntersection[] GetRectangleIntersections (
Rectangle intersectRectangle
)
public function GetRectangleIntersections (
intersectRectangle : Rectangle
) : StrokeIntersection[]
Not applicable.
Parameters
- intersectRectangle
The Rectangle structure, in ink space coordinates, that describes the hit test area.
Return Value
Returns an array of Point structures that indicate where a Stroke object intersects the intersectRectangle parameter.
Remarks
This method returns at least one set of indices that represent the beginning and the end of the segments of the stroke that intersect the rectangle. If a stroke passes straight through a rectangle, interecting the boundary in two places, the set of indices are made of the floating point index values for each intersection. If a stroke intersects a rectangle more than two times, the number of indices is increased by the number of intersections.
If the stroke begins within the test rectangle, the BeginIndex property of the first StrokeIntersection element is set to -1. If the stroke ends within the test rectangle, the EndIndex property of the last StrokeIntersection element is set to -1. If the stroke is wholly outside the test rectangle, an empty StrokeIntersection array is returned. For example, if a stroke begins inside the test rectangle, leaves the boundaries of the rectangle, returns inside, and leaves again, then the GetRectangleIntersections method might return {{-1, 1.4}, {5.5, 10.1}} to describe the two segments of the stroke falling within the rectangle.
This method returns an array of floating point index values that indicate the locations where the intersections occur. A floating point index is a float value that represents a location somewhere between two points in the Stroke object. As examples, if 0.0 is the first point in the stroke and 1.0 is the second point in the stroke, 0.5 is halfway between the first and second points. Similarly, a floating point index value of 37.25 represents a location that is 25 percent along the line between points 37 and 38 of the stroke.
Example
This C# example gets the array of beginning and end points of the sections of the Stroke object, theStroke
, that is intersected by the Rectangle structure, theRectangle
. The points in the array are floating point index values that are stored in a StrokeIntersection structure.
StrokeIntersection[] theSegments = theStroke.GetRectangleIntersections(theRectangle);
This Microsoft® Visual Basic® .NET example gets the array of beginning and end points of the sections of the Stroke object, theStroke
, that is intersected by the Rectangle structure, theRectangle
. The points in the array are floating point index values that are stored in a StrokeIntersection structure.
Dim theSegments() As StrokeIntersection
theSegments = theStroke.GetRectangleIntersections(theRectangle)
Platforms
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Framework
Supported in: 3.0
See Also
Reference
Stroke Class
Stroke Members
Microsoft.Ink Namespace
Stroke.FindIntersections
StrokeIntersection