Instruction set reference
HIPE_OP_CANVAS_SET_PROPERTY
Sets a property on the canvas context currently selected with HIPE_OP_USE_CANVAS (for example, fillStyle or lineWidth).
Only the property names listed below are recognised. An unrecognised property name, or a value that fails to parse for that property's type, is silently ignored — the server does not report an error back to the client.
- location: not applicable — the canvas object was already selected via HIPE_OP_USE_CANVAS.
- arg[0]: the name of the property to set, matching the property names defined in the HTML Canvas 2D Context specification (e.g. "fillStyle", "strokeStyle", "lineWidth", "font").
- arg[1]: the value to assign to that property, as a single string — unlike HIPE_OP_CANVAS_ACTION's arg[1], this is one value, not a comma-separated list.
Properties
| Property | Value |
|---|---|
| fillStyle | a CSS colour string (e.g. red, #ff0000, rgba(0,0,0,0.5)), or url(#id) referencing a gradient/pattern id created via HIPE_OP_CANVAS_ACTION's createLinearGradient/createRadialGradient/createPattern — see that instruction's "Named objects" section |
| strokeStyle | same as fillStyle above |
| lineWidth | a number |
| lineCap | butt, round, or square |
| lineJoin | round, bevel, or miter |
| miterLimit | a number |
| lineDashOffset | a number |
| shadowOffsetX | a number |
| shadowOffsetY | a number |
| shadowBlur | a number |
| shadowColor | a CSS colour string |
| globalAlpha | a number from 0 to 1 |
| globalCompositeOperation | a composite operation name from the HTML Canvas 2D Context specification, e.g. source-over, multiply |
| font | a CSS font shorthand string, e.g. 16px sans-serif |
| textAlign | start, end, left, right, or center |
| textBaseline | a baseline name from the HTML Canvas 2D Context specification, e.g. alphabetic, middle |
| imageSmoothingEnabled | "true" or "false" |
Note that setLineDash is a method in the Canvas 2D specification, not a property — set it via HIPE_OP_CANVAS_ACTION instead, described on that instruction's reference page.
