Class Shape
Representation of a glyph's shape as a series of contours.
Metamethods
Methods
- Shape:GetVertex (index)
-
Get a "vertex", i.e. a step in the shape's contour(s).
Each contour starts with a "move_to", then consists of a series of mixed "line_to" and "curve_to" steps, describing either a line segment or a quadratic Beziér curve from the previous endpoint to the new one.
Parameters:
- index
uint
Position of vertex in the array, from 1 to
#self
Returns:
-
Either "line_to" or "move_to". (There will be
#self
moves in the array.) - number Position to move to or line segment endpoint, x-coordinate (unscaled)...
- number ...and y-coordinate.
Or
- The string "curve_to".
- number Curve endpoint, x-coordinate...
- number ...and y-coordinate.
- number Control point, x-coordinate...
- number ...and y-coordinate.
- index
uint
Position of vertex in the array, from 1 to
- Shape:Rasterize (w, h, xscale, yscale, xshift, yshift, xoff, yoff[, opts])
-
Rasterize a shape with quadratic Beziérs into a bitmap.
Parameters:
- w uint Bitmap width...
- h uint ...and height.
- xscale number Scale applied to vertices' x-components...
- yscale number ...and y-components.
- xshift number Translation applied to vertices' x-components...
- yshift number ...and y-components.
- xoff int Further translation to the x-components...
- yoff int ...and y-components.
- opts
table
Rasterize options, which include:
- as_userdata: TODO: return as userdata
- blob: TODO: use memory blob
- flatness: Allowable error of curve (in pixels), .35 by default.
- invert: If true, vertically flip shape.
- stride: TODO: stride in blob
Returns:
-
Bytes or string
Rasterized 1-channel bitmap.