IsInsideStroke()
Syntax
Result = IsInsideStroke(x.d, y.d, Width.d [, Flags [, CoordinateSystem]])Description
Tests if the given coordinates are within an area that will be drawn to by a call to StrokePath().
Parameters
x.d, y.d Specifies the coordinates of the point to test. Width.d Specifies the line width to use for the test. Flags (optional) Possible flags for the line characteristics as described in the StrokePath() function. CoordinateSystem (optional) Specifies the coordinate system for the point to test. This can be one of the following values: #PB_Coordinate_Device: The coordinate system of the output device #PB_Coordinate_Output: The coordinate system as it was created with the drawing output function #PB_Coordinate_User : The coordinate system for points in the drawing path (default) #PB_Coordinate_Source: The coordinate system for the vector drawing source
Remarks
See the vectordrawing overview for an introduction to the different coordinate systems.
Return value
Returns non-zero if the point is within the stroke and zero if not.
Example
; This example uses the IsInsideStroke() function to color the figure in green ; while the mouse on its outline and blue otherwise ; Procedure Draw() x = GetGadgetAttribute(0, #PB_Canvas_MouseX) y = GetGadgetAttribute(0, #PB_Canvas_MouseY) If StartVectorDrawing(CanvasVectorOutput(0)) VectorSourceColor(RGBA(255, 255, 255, 255)) ; erase previous content FillVectorOutput() AddPathEllipse(200, 100, 150, 75) ; prepare path If IsInsideStroke(x, y, 20, #PB_Path_Default, #PB_Coordinate_Device) ; check if the mouse is inside VectorSourceColor(RGBA(0, 255, 0, 255)) Else VectorSourceColor(RGBA(0, 0, 255, 255)) EndIf StrokePath(20) ; stroke path StopVectorDrawing() EndIf EndProcedure If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) CanvasGadget(0, 0, 0, 400, 200) LoadFont(0, "Times New Roman", 20, #PB_Font_Bold) Draw() Repeat Event = WaitWindowEvent() If Event = #PB_Event_Gadget And EventGadget() = 0 And EventType() = #PB_EventType_MouseMove Draw() EndIf Until Event = #PB_Event_CloseWindow EndIf
See Also
IsInsidePath(), StrokePath(), ResetPath()
Supported OS
All