Blend2D
2D Vector Graphics Engine
Adding multiple segments API was designed to provide high-performance path building in case that the user knows the segments that will be added to the path in advance.
Adding a figure means starting with a move-to segment. For example addBox()
would start a new figure by adding BL_PATH_CMD_MOVE_TO
segment, and then by adding 3 lines, and finally a close command.
Tests whether the path is empty, which means its size equals to zero.
Returns path size (count of vertices used).
Returns path capacity (count of allocated vertices).
Returns the end of path's vertex data (read-only).
Returns path's command data (read-only).
Returns the end of path's command data (read-only).
Returns a read-only path data as BLPathView
.
Reserves the capacity of the path for at least n
vertices and commands.
Sets vertex at index
to cmd
and pt
.
Pass BL_PATH_CMD_PRESERVE
in cmd
to preserve the current command.
Sets vertex at index
to cmd
and [x, y]
.
Pass BL_PATH_CMD_PRESERVE
in cmd
to preserve the current command.
Moves to p0
.
Appends BL_PATH_CMD_MOVE[p0]
command to the path.
Moves to [x0, y0]
.
Appends BL_PATH_CMD_MOVE[x0, y0]
command to the path.
Adds line to p1
.
Appends BL_PATH_CMD_ON[p1]
command to the path.
Adds line to [x1, y1]
.
Appends BL_PATH_CMD_ON[x1, y1]
command to the path.
Adds a polyline (LineTo) of the given poly
array of size count
.
Appends multiple BL_PATH_CMD_ON[x[i], y[i]]
commands to the path depending on count
parameter.
Adds a quadratic curve to p1
and p2
.
Appends the following commands to the path:
BL_PATH_CMD_QUAD[p1]
BL_PATH_CMD_ON[p2]
Matches SVG 'Q' path command:
Adds a quadratic curve to [x1, y1]
and [x2, y2]
.
Appends the following commands to the path:
BL_PATH_CMD_QUAD[x1, y1]
BL_PATH_CMD_ON[x2, y2]
Matches SVG 'Q' path command:
Adds a cubic curve to p1
, p2
, p3
.
Appends the following commands to the path:
BL_PATH_CMD_CUBIC[p1]
BL_PATH_CMD_CUBIC[p2]
BL_PATH_CMD_ON[p3]
Matches SVG 'C' path command:
Adds a cubic curve to [x1, y1]
, [x2, y2]
, and [x3, y3]
.
Appends the following commands to the path:
BL_PATH_CMD_CUBIC[x1, y1]
BL_PATH_CMD_CUBIC[x2, y2]
BL_PATH_CMD_ON[x3, y3]
Matches SVG 'C' path command:
Adds a smooth quadratic curve to p2
, calculating p1
from last points.
Appends the following commands to the path:
BL_PATH_CMD_QUAD[calculated]
BL_PATH_CMD_ON[p2]
Matches SVG 'T' path command:
Adds a smooth quadratic curve to [x2, y2]
, calculating [x1, y1]
from last points.
Appends the following commands to the path:
BL_PATH_CMD_QUAD[calculated]
BL_PATH_CMD_ON[x2, y2]
Matches SVG 'T' path command:
Adds a smooth cubic curve to p2
and p3
, calculating p1
from last points.
Appends the following commands to the path:
BL_PATH_CMD_CUBIC[calculated]
BL_PATH_CMD_CUBIC[p2]
BL_PATH_CMD_ON[p3]
Matches SVG 'S' path command:
Adds a smooth cubic curve to [x2, y2]
and [x3, y3]
, calculating [x1, y1]
from last points.
Appends the following commands to the path:
BL_PATH_CMD_CUBIC[calculated]
BL_PATH_CMD_CUBIC[x2, y2]
BL_PATH_CMD_ON[x3, y3]
Matches SVG 'S' path command:
Adds an arc to the path.
The center of the arc is specified by c
and radius by r
. Both start
and sweep
angles are in radians. If the last vertex doesn't match the start of the arc then a lineTo()
would be emitted before adding the arc. Pass true
in forceMoveTo
to always emit moveTo()
at the beginning of the arc, which starts a new figure.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds an arc quadrant (90deg) to the path. The first point p1
specifies the quadrant corner and the last point p2
specifies the end point.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds an elliptic arc to the path that follows the SVG specification.
Matches SVG 'A' path command:
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Closes the current figure.
Appends BL_PATH_CMD_CLOSE
to the path.
Matches SVG 'Z' path command:
Adds a closed rectangle to the path specified by box
.
Adds a closed rectangle to the path specified by box
.
Adds a closed rectangle to the path specified by [x0, y0, x1, y1]
.
Adds a closed rectangle to the path specified by rect
.
Adds a closed rectangle to the path specified by rect
.
Adds a closed rectangle to the path specified by [x, y, w, h]
.
Adds a geometry to the path.
Adds a closed circle to the path.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds a closed ellipse to the path.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds a closed rounded rectangle to the path.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds a closed triangle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Adds other path
sliced by the given range
to this path.
Adds other path
translated by p
to this path.
Adds other path
translated by p
and sliced by the given range
to this path.
Adds other path
transformed by m
to this path.
Adds other path
transformed by m
and sliced by the given range
to this path.
Adds other path
, but reversed.
Adds other path
, but reversed.
Adds a stroke of path
to this path.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Translates a part of the path specified by the given range
by p
.
Transforms the whole path by matrix m
.
Transforms a part of the path specified by the given range
by matrix m
.
Fits the whole path into the given rect
by taking into account fit flags passed by fitFlags
.
Fits a path of the path specified by the given range
into the given rect
by taking into account fit flags passed by fitFlags
.
Tests whether this path and the other
path are equal.
The equality check is deep. The data of both paths is examined and binary compared (thus a slight difference like -0 and +0 would make the equality check to fail).
Update a path information if necessary.
Stores a bounding box of all vertices and control points to boxOut
.
Control box is simply bounds of all vertices the path has without further processing. It contains both on-path and off-path points. Consider using getBoundingBox()
if you need a visual bounding box.
Stores a bounding box of all on-path vertices and curve extrema to boxOut
.
The bounding box stored to boxOut
could be smaller than a bounding box obtained by getControlBox()
as it's calculated by merging only start/end points and curves at their extrema (not control points). The resulting bounding box represents a visual bounds of the path.
Returns the range describing a figure at the given index
.
Returns the last vertex of the path and stores it to vtxOut
. If the very last command of the path is BL_PATH_CMD_CLOSE
then the path will be iterated in reverse order to match the initial vertex of the last figure.
Hit tests the given point p
by respecting the given fillRule
.