obj = ipe.Reference(attributes, name, pos) obj = ipe.Text(attributes, text, pos) -- Text of type label obj = ipe.Text(attributes, text, pos, width) -- Text of type minipage obj = ipe.Path(attributes, shape, with_arrows) obj = ipe.Group(elements) -- elements is a table of objects
Here, attributes
is a table defining the desired attributes, see below. shape
is a table defining a shape, see below. To create path with arrows, you need to set with_arrows
to true (it defaults to false). The arrow settings are then used from the attributes
.
Objects have the following methods:
obj:type() -- return type as string: group, text, path, image, reference obj:clone() -- clone the object obj:set(property, value, stroke, fill) -- see below obj:get(property) -- see below obj:xml() -- return XML representation obj:matrix() obj:setMatrix(m) obj:addToBBox(r, m) -- including control points obj:addToBBox(r, m, false) -- without control points -- text and reference objects only: v = obj:position() -- text objects only: obj:setText(str) str = obj:text() -- path objects only: shape = obj:shape() obj:setShape(shape) -- group objects only: n = obj:count() shape = obj:clip() -- nil if no clipping obj:setClip(shape) -- image objects only: obj:info() -- returns table about bitmap -- group objects only: elements = obj:elements() -- returns table with clones of elements
r
, g
, b
minipage
, farrow
, rarrow
) are booleans (but the strings "true" and "false" can be used to set them)pathmode -- "stroked", "strokedfilled", "filled" stroke -- symbolic or color fill -- symbolic or color dashstyle -- symbolic or absolute string pen -- symbolic or number farrow -- boolean rarrow -- boolean farrowshape -- symbolic rarrowshape -- symbolic arrowsize -- symbolic or number symbolsize -- symbolic or number symbolshape -- symbolic textsize -- symbolic or number transformableText -- boolean textstyle -- symbolic opacity -- symbolic tiling -- symbolic minipage -- boolean width -- number horizontalAlignment -- "left", "right", "hcenter" verticalAlignment -- "bottom", "baseline", "top", "vcenter" linejoin -- "normal", "miter", "round", "bevel" linecap -- "normal", "butt", "round", "square" fillrule -- "normal", "wind", "evenodd" pinned -- "none", "horizontal", "vertical", "fixed" transformations -- "translations", "rigid", "affine"
pen, symbolsize, farrow, rarrow, farrowsize, rarrowsize, farrowshape, rarrowshape, stroke, fill, markshape, pathmode, dashstyle, textsize, textstyle, minipage, width, opacity, tiling, gradient, horizontalalignment, verticalalignment, linejoin, linecap, fillrule, pinned, transformations,
It is okay to set a property on objects that do not support them (for instance, "textsize" on a path object). Reading such properties results in an "undefined" return value.
The arguments stroke and fill for set are only used if the property is pathmode
. When the pathmode newly adds stroking or filling to an object, then it takes the stroke and/or fill color from this argument.
Each subpath is again a table with a type
field whose value must be one of "ellipse", "closedspline", or "curve".
For an ellipse, element 1 of the table is the matrix.
For a closed spline, the table contains the control points.
For a curve, the table has a second field closed
, which is either true
or false
. The table also has an entry for each segment of the curve. Each segment is again a table with a type
field, whose value is one of "arc", "segment", "quad", "bezier", or "spline". The segment table contains the control points of the segment. For arc segments, there is an additional arc
field in the segment table that contains the arc as an ipe.Arc object.