Class Shape

Representation of a glyph's shape as a series of contours.

Metamethods

Shape:__len ()
Metamethod.

Returns:

    uint Number of vertices in shape.

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:

  1. Either "line_to" or "move_to". (There will be #self moves in the array.)
  2. number Position to move to or line segment endpoint, x-coordinate (unscaled)...
  3. number ...and y-coordinate.

Or

  1. The string "curve_to".
  2. number Curve endpoint, x-coordinate...
  3. number ...and y-coordinate.
  4. number Control point, x-coordinate...
  5. number ...and y-coordinate.
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
    (optional)

Returns:

    Bytes or string Rasterized 1-channel bitmap.
generated by LDoc 1.4.6 Last updated 2018-09-03 18:10:34