Instruction set reference
HIPE_OP_CANVAS_QUERY
Asks a question of the canvas that was selected with HIPE_OP_USE_CANVAS. It covers the methods of the HTML Canvas 2D Context that return a value. The display server replies with HIPE_OP_CANVAS_QUERY_RETURN.
- location: not used. The instruction applies to the selected canvas.
- arg[0]: the query: "isPointInPath", "isPointInStroke" or "measureText".
- arg[1]: the query's parameters, separated by commas and written as for HIPE_OP_CANVAS_ACTION.
| Query | Parameters | Reply |
|---|---|---|
| isPointInPath | pathId, x, y, and optionally the winding rule: "nonzero" (the default) or "evenodd" | true or false |
| isPointInStroke | pathId, x, y | true or false |
| measureText | the text | Its width in pixels, in the canvas's current font |
Notes
pathId is always given. It is the id of a path made with createPath2D (see HIPE_OP_CANVAS_ACTION), or empty to test the canvas's own current path, as in ",10,20".
measureText measures in the font set on the canvas with HIPE_OP_CANVAS_SET_PROPERTY. To measure text in the font of an element of the document, use HIPE_OP_MEASURE_TEXT.
