GetRectangleIntersections Method

GetRectangleIntersections Method

Finds the points where a IInkStrokeDisp object intersects a given rectangle.

Declaration

[C++]

HRESULT GetRectangleIntersections (
    [in] IInkRectangle *rectangle,
    [out, retval] VARIANT *Intersections
);

[Microsoft® Visual Basic® 6.0]

Public Function GetRectangleIntersections( _
    rectangle As InkRectangle _
) As Variant

Parameters

rectangle

[in] The rectangle in ink space coordinates, that describes the hit test area.

Intersections

[out, retval] Returns a VARIANT array that indicates where the stroke intersects intersectRectangle. The beginning floating point indices are stored in the even indices. The ending floating point indices are stored in the odd indices. The first pair of indices represents the first intersection.

For more information about the VARIANT structure, see Using the Automation Library.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_OUTOFMEMORY Cannot allocate Stroke handler helper object.
E_UNEXPECTED Unexpected parameter or property type.
E_INK_EXCEPTION An exception occurred inside the method.

Remarks

This method returns an array that indicates where the stroke intersects the specified rectangle. Each segment of the stroke that intersects the rectangle is one pair of indices, alternating with a beginning index followed by an ending index.

If the stroke begins within the test rectangle, the first index is set to -1. If the stroke ends within the test rectangle, the last index is set to -1. If the stroke is wholly outside the test rectangle, an empty 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.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example gets the array of beginning and end points of the sections of the IInkStrokeDisp, theStroke that was intersected by the InkRectangle, theRectangle, as floating point index values that are stored in each element of theSegments.

Dim theSegments() As Single
theSegments = theStroke.GetRectangleIntersections(theRectangle)

Applies To