Geometries, paths, and transformations.

Blend2D offers various geometry structures and objects that can be used with either BLPath for path building or BLContext for rendering.

Classes

Typedefs

Enumerations

Variables

Global Specializations

Overloaded Operators

Typedef Documentation

BLPathSinkFunc

typedef BLResult( * BLPathSinkFunc) (BLPathCore *path, const void *info, void *closure)

Optional callback that can be used to consume a path data.

BLMapPointDArrayFunc

typedef BLResult( * BLMapPointDArrayFunc) (const void *ctx, BLPoint *dst, const BLPoint *src, size_t count)

A generic function that can be used to transform an array of points that use double precision coordinates. This function will be 99.99% of time used with BLMatrix2D so the ctx would point to a const BLMatrix2D* instance.

Enumeration Type Documentation

BLGeometryDirection

enum BLGeometryDirection : uint32_t

Direction of a geometry used by geometric primitives and paths.

ConstantDescription
BL_GEOMETRY_DIRECTION_NONE 

No direction specified.

BL_GEOMETRY_DIRECTION_CW 

Clockwise direction.

BL_GEOMETRY_DIRECTION_CCW 

Counter-clockwise direction.

BLGeometryType

enum BLGeometryType : uint32_t

Geometry type.

Geometry describes a shape or path that can be either rendered or added to a BLPath container. Both BLPath and BLContext provide functionality to work with all geometry types. Please note that each type provided here requires to pass a matching struct or class to the function that consumes a geometryType and geometryData arguments.

ConstantDescription
BL_GEOMETRY_TYPE_NONE 

No geometry provided.

BL_GEOMETRY_TYPE_BOXI 

BLBoxI struct.

BL_GEOMETRY_TYPE_BOXD 

BLBox struct.

BL_GEOMETRY_TYPE_RECTI 

BLRectI struct.

BL_GEOMETRY_TYPE_RECTD 

BLRect struct.

BL_GEOMETRY_TYPE_CIRCLE 

BLCircle struct.

BL_GEOMETRY_TYPE_ELLIPSE 

BLEllipse struct.

BL_GEOMETRY_TYPE_ROUND_RECT 

BLRoundRect struct.

BL_GEOMETRY_TYPE_ARC 

BLArc struct.

BL_GEOMETRY_TYPE_CHORD 

BLArc struct representing chord.

BL_GEOMETRY_TYPE_PIE 

BLArc struct representing pie.

BL_GEOMETRY_TYPE_LINE 

BLLine struct.

BL_GEOMETRY_TYPE_TRIANGLE 

BLTriangle struct.

BL_GEOMETRY_TYPE_POLYLINEI 

BLArrayView<BLPointI> representing a polyline.

BL_GEOMETRY_TYPE_POLYLINED 

BLArrayView<BLPoint> representing a polyline.

BL_GEOMETRY_TYPE_POLYGONI 

BLArrayView<BLPointI> representing a polygon.

BL_GEOMETRY_TYPE_POLYGOND 

BLArrayView<BLPoint> representing a polygon.

BL_GEOMETRY_TYPE_ARRAY_VIEW_BOXI 

BLArrayView<BLBoxI> struct.

BL_GEOMETRY_TYPE_ARRAY_VIEW_BOXD 

BLArrayView<BLBox> struct.

BL_GEOMETRY_TYPE_ARRAY_VIEW_RECTI 

BLArrayView<BLRectI> struct.

BL_GEOMETRY_TYPE_ARRAY_VIEW_RECTD 

BLArrayView<BLRect> struct.

BL_GEOMETRY_TYPE_PATH 

BLPath (or BLPathCore).

BL_GEOMETRY_TYPE_REGION 

BLRegion (or BLRegionCore).

BL_GEOMETRY_TYPE_COUNT 

Count of geometry types.

BLFillRule

enum BLFillRule : uint32_t

Fill rule.

ConstantDescription
BL_FILL_RULE_NON_ZERO 

Non-zero fill-rule.

BL_FILL_RULE_EVEN_ODD 

Even-odd fill-rule.

BL_FILL_RULE_COUNT 

Count of fill rule types.

BLHitTest

enum BLHitTest : uint32_t

Hit-test result.

ConstantDescription
BL_HIT_TEST_IN 

Fully in.

Partially in/out.

BL_HIT_TEST_PART 

Fully out.

BL_HIT_TEST_OUT 

Hit test failed (invalid argument, NaNs, etc).

BLMatrix2DType

enum BLMatrix2DType : uint32_t

2D matrix type that can be obtained by calling BLMatrix2D::type().

Identity Transl. Scale Swap Affine
[1 0] [1 0] [. 0] [0 .] [. .]
[0 1] [0 1] [0 .] [. 0] [. .]
[0 0] [. .] [. .] [. .] [. .]
ConstantDescription
BL_MATRIX2D_TYPE_IDENTITY 

Identity matrix.

BL_MATRIX2D_TYPE_TRANSLATE 

Has translation part (the rest is like identity).

BL_MATRIX2D_TYPE_SCALE 

Has translation and scaling parts.

BL_MATRIX2D_TYPE_SWAP 

Has translation and scaling parts, however scaling swaps X/Y.

BL_MATRIX2D_TYPE_AFFINE 

Generic affine matrix.

BL_MATRIX2D_TYPE_INVALID 

Invalid/degenerate matrix not useful for transformations.

BL_MATRIX2D_TYPE_COUNT 

Count of matrix types.

BLMatrix2DValue

enum BLMatrix2DValue : uint32_t

2D matrix data index.

BLMatrix2DOp

enum BLMatrix2DOp : uint32_t

2D matrix operation.

ConstantDescription
BL_MATRIX2D_OP_RESET 

Reset matrix to identity (argument ignored, should be nullptr).

BL_MATRIX2D_OP_ASSIGN 

Assign (copy) the other matrix.

BL_MATRIX2D_OP_TRANSLATE 

Translate the matrix by [x, y].

BL_MATRIX2D_OP_SCALE 

Scale the matrix by [x, y].

BL_MATRIX2D_OP_SKEW 

Skew the matrix by [x, y].

BL_MATRIX2D_OP_ROTATE 

Rotate the matrix by the given angle about [0, 0].

BL_MATRIX2D_OP_ROTATE_PT 

Rotate the matrix by the given angle about [x, y].

BL_MATRIX2D_OP_TRANSFORM 

Transform this matrix by other BLMatrix2D.

BL_MATRIX2D_OP_POST_TRANSLATE 

Post-translate the matrix by [x, y].

BL_MATRIX2D_OP_POST_SCALE 

Post-scale the matrix by [x, y].

BL_MATRIX2D_OP_POST_SKEW 

Post-skew the matrix by [x, y].

BL_MATRIX2D_OP_POST_ROTATE 

Post-rotate the matrix about [0, 0].

BL_MATRIX2D_OP_POST_ROTATE_PT 

Post-rotate the matrix about a reference BLPoint.

BL_MATRIX2D_OP_POST_TRANSFORM 

Post-transform this matrix by other BLMatrix2D.

BL_MATRIX2D_OP_COUNT 

Count of matrix operations.

BLPathCmd

enum BLPathCmd : uint32_t

Path command.

ConstantDescription
BL_PATH_CMD_MOVE 

Move-to command (starts a new figure).

BL_PATH_CMD_ON 

On-path command (interpreted as line-to or the end of a curve).

BL_PATH_CMD_QUAD 

Quad-to control point.

BL_PATH_CMD_CUBIC 

Cubic-to control point (always used as a pair of commands).

BL_PATH_CMD_CLOSE 

Close path.

BL_PATH_CMD_COUNT 

Count of path commands.

BLPathCmdExtra

enum BLPathCmdExtra : uint32_t

Path command (never stored in path).

ConstantDescription
BL_PATH_CMD_PRESERVE 

Used by BLPath::setVertexAt to preserve the current command value.

BLPathFlags

enum BLPathFlags : uint32_t

Path flags.

ConstantDescription
BL_PATH_FLAG_EMPTY 

Path is empty (no commands or close commands only).

BL_PATH_FLAG_MULTIPLE 

Path contains multiple figures.

BL_PATH_FLAG_QUADS 

Path contains quad curves (at least one).

BL_PATH_FLAG_CUBICS 

Path contains cubic curves (at least one).

BL_PATH_FLAG_INVALID 

Path is invalid.

BL_PATH_FLAG_DIRTY 

Flags are dirty (not reflecting the current status).

BLPathReverseMode

enum BLPathReverseMode : uint32_t

Path reversal mode.

ConstantDescription
BL_PATH_REVERSE_MODE_COMPLETE 

Reverse each figure and their order as well (default).

BL_PATH_REVERSE_MODE_SEPARATE 

Reverse each figure separately (keeps their order).

BL_PATH_REVERSE_MODE_COUNT 

Count of path-reversal modes.

BLStrokeJoin

enum BLStrokeJoin : uint32_t

Stroke join type.

ConstantDescription
BL_STROKE_JOIN_MITER_CLIP 

Miter-join possibly clipped at miterLimit [default].

BL_STROKE_JOIN_MITER_BEVEL 

Miter-join or bevel-join depending on miterLimit condition.

BL_STROKE_JOIN_MITER_ROUND 

Miter-join or round-join depending on miterLimit condition.

BL_STROKE_JOIN_BEVEL 

Bevel-join.

BL_STROKE_JOIN_ROUND 

Round-join.

BL_STROKE_JOIN_COUNT 

Count of stroke join types.

BLStrokeCapPosition

enum BLStrokeCapPosition : uint32_t

Position of a stroke-cap.

ConstantDescription
BL_STROKE_CAP_POSITION_START 

Start of the path.

BL_STROKE_CAP_POSITION_END 

End of the path.

BL_STROKE_CAP_POSITION_COUNT 

Count of stroke position options.

BLStrokeCap

enum BLStrokeCap : uint32_t

A presentation attribute defining the shape to be used at the end of open subpaths.

ConstantDescription
BL_STROKE_CAP_BUTT 

Butt cap [default].

BL_STROKE_CAP_SQUARE 

Square cap.

BL_STROKE_CAP_ROUND 

Round cap.

BL_STROKE_CAP_ROUND_REV 

Round cap reversed.

BL_STROKE_CAP_TRIANGLE 

Triangle cap.

BL_STROKE_CAP_TRIANGLE_REV 

Triangle cap reversed.

BL_STROKE_CAP_COUNT 

Used to catch invalid arguments.

BLStrokeTransformOrder

enum BLStrokeTransformOrder : uint32_t

Stroke transform order.

ConstantDescription
BL_STROKE_TRANSFORM_ORDER_AFTER 

Transform after stroke => Transform(Stroke(Input)) [default].

BL_STROKE_TRANSFORM_ORDER_BEFORE 

Transform before stroke => Stroke(Transform(Input)).

BL_STROKE_TRANSFORM_ORDER_COUNT 

Count of transform order types.

BLFlattenMode

enum BLFlattenMode : uint32_t

Mode that specifies how curves are approximated to line segments.

ConstantDescription
BL_FLATTEN_MODE_DEFAULT 

Use default mode (decided by Blend2D).

BL_FLATTEN_MODE_RECURSIVE 

Recursive subdivision flattening.

BL_FLATTEN_MODE_COUNT 

Count of flatten modes.

BLOffsetMode

enum BLOffsetMode : uint32_t

Mode that specifies how to construct offset curves.

ConstantDescription
BL_OFFSET_MODE_DEFAULT 

Use default mode (decided by Blend2D).

BL_OFFSET_MODE_ITERATIVE 

Iterative offset construction.

BL_OFFSET_MODE_COUNT 

Count of offset modes.

BLRegionType

enum BLRegionType : uint32_t

Region type.

ConstantDescription
BL_REGION_TYPE_EMPTY 

Region is empty (has no rectangles).

BL_REGION_TYPE_RECT 

Region has one rectangle (rectangular).

BL_REGION_TYPE_COMPLEX 

Region has more YX sorted rectangles.

BL_REGION_TYPE_COUNT 

Count of region types.

Variable Documentation

blMatrix2DMapPointDArrayFuncs

BLMapPointDArrayFunc blMatrix2DMapPointDArrayFuncs[BL_MATRIX2D_TYPE_COUNT]

Array of functions for transforming points indexed by BLMatrixType. Each function is optimized for the respective type. This is mostly used internally, but exported for users that can take advantage of Blend2D SIMD optimziations.

blDefaultApproximationOptions

const BLApproximationOptions blDefaultApproximationOptions

Default approximation options used by Blend2D.