Hipe : HTML Interface Pipe
How Hipe Works  |  Installation  |  Running hiped  |  Hipe API

The Hipe API
Including libhipe
libhipe functions
C++ extensions
Multithreading considerations
Hipe instructions
Interprocess communication
Tags, attributes and styles
Locations
HIPE_OP_ADD_FONT
HIPE_OP_ADD_STYLE_RULE
HIPE_OP_ADD_STYLE_RULE_SRC
HIPE_OP_APPEND_TAG
HIPE_OP_APPEND_TEXT
HIPE_OP_ATTRIBUTE_RETURN
HIPE_OP_AUDIOVIDEO_STATE
HIPE_OP_CANVAS_ACTION
HIPE_OP_CANVAS_QUERY
HIPE_OP_CANVAS_QUERY_RETURN
HIPE_OP_CANVAS_SET_PROPERTY
HIPE_OP_CARAT_POSITION
HIPE_OP_CLEAR
HIPE_OP_CONTAINER_GRANT
HIPE_OP_CONTENT_RETURN
HIPE_OP_DELETE
HIPE_OP_DIALOG
HIPE_OP_DIALOG_INPUT
HIPE_OP_DIALOG_RETURN
HIPE_OP_EDIT_ACTION
HIPE_OP_EDIT_CONTEXT_REQUEST
HIPE_OP_EDIT_STATUS
HIPE_OP_EVENT
HIPE_OP_EVENT_CANCEL
HIPE_OP_EVENT_REQUEST
HIPE_OP_FIFO_ADD_ABILITY
HIPE_OP_FIFO_CLOSE
HIPE_OP_FIFO_DROP_PEER
HIPE_OP_FIFO_GET_PEER
HIPE_OP_FIFO_INFO
HIPE_OP_FIFO_OPEN
HIPE_OP_FIFO_REMOVE_ABILITY
HIPE_OP_FIFO_RESPONSE
HIPE_OP_FILE_RETURN
HIPE_OP_FIND_RESULT
HIPE_OP_FIND_TEXT
HIPE_OP_FRAME_CLOSE
HIPE_OP_FRAME_EVENT
HIPE_OP_FREE_LOCATION
HIPE_OP_GEOMETRY_RETURN
HIPE_OP_GET_ATTRIBUTE
HIPE_OP_GET_AUDIOVIDEO_STATE
HIPE_OP_GET_BY_ID
HIPE_OP_GET_CARAT_POSITION
HIPE_OP_GET_CONTENT
HIPE_OP_GET_FIRST_CHILD
HIPE_OP_GET_FRAME_KEY
HIPE_OP_GET_GEOMETRY
HIPE_OP_GET_LAST_CHILD
HIPE_OP_GET_NEXT_SIBLING
HIPE_OP_GET_PREV_SIBLING
HIPE_OP_GET_RANGE_GEOMETRY
HIPE_OP_GET_SCROLL_GEOMETRY
HIPE_OP_GET_SELECTION
HIPE_OP_GET_STYLE
HIPE_OP_INSERT_TAG
HIPE_OP_GET_X11_XID
HIPE_OP_INSERT_TAG
HIPE_OP_KEY_RETURN
HIPE_OP_LOCATION_RETURN
HIPE_OP_MEASURE_TEXT
HIPE_OP_MESSAGE
HIPE_OP_OPEN_LINK
HIPE_OP_RANGE_GEOMETRY
HIPE_OP_REMOVE_ATTRIBUTE
HIPE_OP_REQUEST_CONTAINER
HIPE_OP_SCROLL_BY
HIPE_OP_SCROLL_TO
HIPE_OP_SERVER_DENIED
HIPE_OP_SERVER_NOTICE
HIPE_OP_SET_ATTRIBUTE
HIPE_OP_SET_CURSOR
HIPE_OP_SET_FOCUS
HIPE_OP_SET_ICON
HIPE_OP_SET_SRC
HIPE_OP_SET_STYLE
HIPE_OP_SET_STYLE_SRC
HIPE_OP_SET_TEXT
HIPE_OP_SET_TITLE
HIPE_OP_SRC_RETURN
HIPE_OP_STYLE_RETURN
HIPE_OP_TAKE_SNAPSHOT
HIPE_OP_TEXT_METRICS
HIPE_OP_TOGGLE_CLASS
HIPE_OP_USE_CANVAS
HIPE_OP_X11_XID_RETURN

Instruction set reference

HIPE_OP_CANVAS_ACTION

Calls a drawing method on the canvas that was selected with HIPE_OP_USE_CANVAS. The methods are those of the HTML Canvas 2D Context.

An unknown method name, the wrong number of parameters, or a parameter that can't be used (such as text where a number is expected) causes the instruction to be ignored. No error is reported.

The methods are those listed below. Most are methods of the HTML Canvas 2D Context; those dealing with ids, and setSrcRegion, are Hipe's own.

Writing the parameters

Methods

MethodArguments
save—
restore—
scalesx, sy
rotateangle (radians)
translatetx, ty
transformm11, m12, m21, m22, dx, dy
setTransformm11, m12, m21, m22, dx, dy
beginPath—
closePath—
moveTox, y
lineTox, y
quadraticCurveTocpx, cpy, x, y
bezierCurveTocp1x, cp1y, cp2x, cp2y, x, y
arcTox0, y0, x1, y1, radius
arcx, y, radius, startAngle, endAngle, anticlockwise ("true"/"false")
ellipsex, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise ("true"/"false")
rectx, y, width, height
fill0 args (implicit path, default winding); 1 arg (implicit path, winding rule "nonzero"/"evenodd"); or 2 args (path id, winding rule)
stroke0 args (implicit path) or 1 arg (path id)
clipsame shape as fill above
clearRectx, y, width, height
fillRectx, y, width, height
strokeRectx, y, width, height
fillTexttext, x, y, optional maxWidth
strokeTexttext, x, y, optional maxWidth
setLineDasha single bracketed list of numbers, e.g. [4,2] ([] clears the dash pattern)
drawImagesource element id, then either (dx, dy), (dx, dy, dw, dh), or (sx, sy, sw, sh, dx, dy, dw, dh) (see Notes)
setSrcRegiondx, dy, width, height (see Notes)
createLinearGradientid, x0, y0, x1, y1
createRadialGradientid, x0, y0, r0, x1, y1, r1
addColorStopgradientId, offset, color
createPatternid, sourceElementId, repetition ("repeat"/"repeat-x"/"repeat-y"/"no-repeat")
deleteGradientgradientId
deletePatternpatternId
createPath2Did
deletePath2Did
selectPath2Did (empty string reselects this canvas's own implicit path)

Gradients, patterns and paths

In HTML a gradient, pattern or path is an object that a script keeps hold of. Here each one is given an id by the client when it is created, and is referred to by that id afterwards. Ids belong to the canvas they were created on: the same id on another canvas is a different object.

Notes

beginPath always starts the canvas's own path afresh, whichever path is selected. To start a new named path, create one under a new id.

drawImage's first parameter is the id attribute of an img, canvas or video element in the document. The rest are numbers, in one of three forms: the destination position (dx, dy); the destination rectangle (dx, dy, dw, dh); or a source rectangle followed by the destination rectangle (sx, sy, sw, sh, dx, dy, dw, dh).

setSrcRegion is not a method of the HTML canvas. It sets the area of the canvas that raw pixels sent with HIPE_OP_SET_SRC will be written to: the top-left position (dx, dy) and the width and height of the pixel data. The area is in canvas pixels and is not affected by scale, translate or the other transformations. It stays in effect until it is set again. If it is never set, raw pixels fill the whole canvas. See HIPE_OP_SET_SRC.

Only the 2D context is available. To read a canvas back as an image, use HIPE_OP_GET_SRC.