LayOut C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Enumerations | Functions
path.h File Reference
#include <LayOutAPI/common.h>
#include <LayOutAPI/geometry/geometry.h>
#include <LayOutAPI/model/defs.h>

Go to the source code of this file.

Enumerations

enum  LOPathPointType {
  LOPathPointType_MoveTo = 0, LOPathPointType_LineTo, LOPathPointType_BezierTo, LOPathPointType_ArcCenter,
  LOPathPointType_BezierControl, LOPathPointType_Close, LONumPathPointTypes
}
 Defines how a point is to be interpreted in a path entity. More...
 
enum  LOPathWindingType { LOPathWindingType_None = 0, LOPathWindingType_Clockwise, LOPathWindingType_CounterClockwise, LONumPathWindingTypes }
 Defines the winding direction of the path. More...
 

Functions

LO_RESULT LOPathCreate (LOPathRef *path, const LOPoint2D *start_point, const LOPoint2D *end_point)
 Creates a new path object with a straight line between start_point and end_point. More...
 
LO_RESULT LOPathCreateBezier (LOPathRef *path, const LOPoint2D *start_point, const LOPoint2D *control_point_1, const LOPoint2D *control_point_2, const LOPoint2D *end_point)
 Creates a new path object with a Bezier curve between start_point and end_point. More...
 
LO_RESULT LOPathCreateFromRectangle (LOPathRef *path, LORectangleRef rectangle)
 Creates a new path object representing the same shape as a rectangle object. More...
 
LO_RESULT LOPathCreateFromEllipse (LOPathRef *path, LOEllipseRef ellipse)
 Creates a new path object representing the same shape as an ellipse object. More...
 
LO_RESULT LOPathCreateArc (LOPathRef *path, const LOPoint2D *center_point, double radius, double start_angle, double end_angle)
 Creates a new path object representing an arc. More...
 
LO_RESULT LOPathAddReference (LOPathRef path)
 Adds a reference to a path object. More...
 
LO_RESULT LOPathRelease (LOPathRef *path)
 Releases a path object. The object will be invalidated if releasing the last reference. More...
 
LO_EXPORT LOPathRef LOPathFromEntity (LOEntityRef entity)
 Converts from a LOEntityRef to a LOPathRef. This is essentially a downcast operation so the given LOEntityRef must be convertible to a LOPathRef. More...
 
LO_EXPORT LOEntityRef LOPathToEntity (LOPathRef path)
 Converts from a LOPathRef to a LOEntityRef. This is essentially an upcast operation. More...
 
LO_RESULT LOPathGetNumberOfPoints (LOPathRef path, size_t *size)
 Gets the number of points in the path. More...
 
LO_RESULT LOPathGetPoints (LOPathRef path, size_t points_size, LOPoint2D points[], size_t *number_of_points_copied)
 Gets the points in the path. More...
 
LO_RESULT LOPathGetPointAtIndex (LOPathRef path, size_t point_index, LOPoint2D *point)
 Gets the point in the path at the given index. More...
 
LO_RESULT LOPathGetPointTypes (LOPathRef path, size_t pointtypes_size, LOPathPointType pointtypes[], size_t *number_of_pointtypes_copied)
 Gets the type of each point in the path. More...
 
LO_RESULT LOPathGetPointTypeAtIndex (LOPathRef path, size_t point_index, LOPathPointType *pointtype)
 Gets the type of the specified point in the path. More...
 
LO_RESULT LOPathGetStartPoint (LOPathRef path, LOPoint2D *point)
 Gets the start point for the path. More...
 
LO_RESULT LOPathGetEndPoint (LOPathRef path, LOPoint2D *point)
 Gets the end point for the path. More...
 
LO_RESULT LOPathCreateFromStartArrow (LOPathRef *arrow_path, LOPathRef path)
 Creates a new path object in the shape of the start arrow of the given path. More...
 
LO_RESULT LOPathCreateFromEndArrow (LOPathRef *arrow_path, LOPathRef path)
 Creates a new path object in the shape of the end arrow of the given path. More...
 
LO_RESULT LOPathGetClosed (LOPathRef path, bool *is_closed)
 Gets whether or not the path is a closed loop. More...
 
LO_RESULT LOPathGetParametricLength (LOPathRef path, double *parametric_length)
 Gets the length of the path. More...
 
LO_RESULT LOPathGetPointAtParameter (LOPathRef path, double parametric_value, LOPoint2D *point)
 Gets the point at the given distance along the path. More...
 
LO_RESULT LOPathGetTangentAtParameter (LOPathRef path, double parametric_value, LOVector2D *tangent)
 Gets the tangent at the given distance along the path. More...
 
LO_RESULT LOPathGetCircle (LOPathRef path, bool *is_circle, LOPoint2D *center, double *radius)
 Gets whether or not the path represents a circle, and if so, gets the geometric representation of the circle. More...
 
LO_RESULT LOPathGetArc (LOPathRef path, bool *is_arc, LOPoint2D *center, double *radius, double *start_angle, double *end_angle)
 Gets whether or not the path represents an arc, and if so, gets the geometric representation of the arc. More...
 
LO_RESULT LOPathAppendLineTo (LOPathRef path, const LOPoint2D *point)
 Adds a point to the end of the path. More...
 
LO_RESULT LOPathAppendBezierTo (LOPathRef path, const LOPoint2D *control_point_1, const LOPoint2D *control_point_2, const LOPoint2D *point)
 Adds a Bezier point to the end of the path. More...
 
LO_RESULT LOPathAppendPathTo (LOPathRef path, LOPathRef other_path)
 Appends two paths. This will duplicate other_path and append it to the path. Note that path may be reversed as a result of this operation. More...
 
LO_RESULT LOPathClose (LOPathRef path)
 Finishes the path loop if the path is not closed. More...
 
LO_RESULT LOPathGetWindingType (LOPathRef path, LOPathWindingType *winding)
 Returns the winding type of the path. More...
 

Enumeration Type Documentation

Defines how a point is to be interpreted in a path entity.

Enumerator
LOPathPointType_MoveTo 

Reserved for the first point in a path.

LOPathPointType_LineTo 

Straight line segment to a given point.

LOPathPointType_BezierTo 

Bezier line segment to a given point.

LOPathPointType_ArcCenter 

Control point that defines the center of an arc.

LOPathPointType_BezierControl 

Control point that defines Bezier curvature.

LOPathPointType_Close 

Close the path with a straight line segment back to the first point.

LONumPathPointTypes 

Defines the winding direction of the path.

Since
LayOut 2019, API 4.0
Enumerator
LOPathWindingType_None 
LOPathWindingType_Clockwise 
LOPathWindingType_CounterClockwise 
LONumPathWindingTypes 

Function Documentation

LO_RESULT LOPathAddReference ( LOPathRef  path)

Adds a reference to a path object.

Parameters
[in]pathThe path object.
Returns
LO_RESULT LOPathAppendBezierTo ( LOPathRef  path,
const LOPoint2D control_point_1,
const LOPoint2D control_point_2,
const LOPoint2D point 
)

Adds a Bezier point to the end of the path.

Parameters
[in]pathThe path object.
[in]control_point_1The first control point.
[in]control_point_2The second control point.
[in]pointThe point to append.
Returns
LO_RESULT LOPathAppendLineTo ( LOPathRef  path,
const LOPoint2D point 
)

Adds a point to the end of the path.

Parameters
[in]pathThe path object.
[in]pointThe point to append.
Returns
LO_RESULT LOPathAppendPathTo ( LOPathRef  path,
LOPathRef  other_path 
)

Appends two paths. This will duplicate other_path and append it to the path. Note that path may be reversed as a result of this operation.

Since
LayOut 2018, API 3.0
Parameters
[in]pathThe path object.
[in]other_pathThe path to append to path.
Returns
LO_RESULT LOPathClose ( LOPathRef  path)

Finishes the path loop if the path is not closed.

Parameters
[in]pathThe path object.
Returns
LO_RESULT LOPathCreate ( LOPathRef path,
const LOPoint2D start_point,
const LOPoint2D end_point 
)

Creates a new path object with a straight line between start_point and end_point.

Parameters
[out]pathThe path object.
[in]start_pointThe starting point of the path.
[in]end_pointThe ending point of the path.
Returns
LO_RESULT LOPathCreateArc ( LOPathRef path,
const LOPoint2D center_point,
double  radius,
double  start_angle,
double  end_angle 
)

Creates a new path object representing an arc.

Since
LayOut 2017, API 2.0
Parameters
[out]pathThe path object.
[in]center_pointThe center point of the arc.
[in]radiusThe radius of the arc.
[in]start_angleThe start angle of the arc.
[in]end_angleThe end angle of the arc.
Returns
LO_RESULT LOPathCreateBezier ( LOPathRef path,
const LOPoint2D start_point,
const LOPoint2D control_point_1,
const LOPoint2D control_point_2,
const LOPoint2D end_point 
)

Creates a new path object with a Bezier curve between start_point and end_point.

Parameters
[out]pathThe path object.
[in]start_pointThe starting point of the path.
[in]control_point_1The first control point.
[in]control_point_2The second control point.
[in]end_pointThe ending point of the path.
Returns
LO_RESULT LOPathCreateFromEllipse ( LOPathRef path,
LOEllipseRef  ellipse 
)

Creates a new path object representing the same shape as an ellipse object.

Parameters
[out]pathThe path object.
[in]ellipseThe ellipse object.
Returns
LO_RESULT LOPathCreateFromEndArrow ( LOPathRef arrow_path,
LOPathRef  path 
)

Creates a new path object in the shape of the end arrow of the given path.

Parameters
[out]arrow_pathThe end arrow as a path.
[in]pathThe path object.
Returns
LO_RESULT LOPathCreateFromRectangle ( LOPathRef path,
LORectangleRef  rectangle 
)

Creates a new path object representing the same shape as a rectangle object.

Parameters
[out]pathThe path object.
[in]rectangleThe rectangle object.
Returns
LO_RESULT LOPathCreateFromStartArrow ( LOPathRef arrow_path,
LOPathRef  path 
)

Creates a new path object in the shape of the start arrow of the given path.

Parameters
[out]arrow_pathThe start arrow as a path.
[in]pathThe path object.
Returns
LO_EXPORT LOPathRef LOPathFromEntity ( LOEntityRef  entity)

Converts from a LOEntityRef to a LOPathRef. This is essentially a downcast operation so the given LOEntityRef must be convertible to a LOPathRef.

Parameters
[in]entityThe entity object.
Returns
  • The converted LOPathRef if the downcast operation succeeds
  • If not, the returned reference will be invalid
LO_RESULT LOPathGetArc ( LOPathRef  path,
bool *  is_arc,
LOPoint2D center,
double *  radius,
double *  start_angle,
double *  end_angle 
)

Gets whether or not the path represents an arc, and if so, gets the geometric representation of the arc.

Since
LayOut 2017, API 2.0
Parameters
[in]pathThe path object.
[out]is_arcWhether or not the path is an arc.
[out]centerCenter point of the arc. Will only be set if is_arc returns true.
[out]radiusRadius of the arc. Will only be set if is_arc returns true.
[out]start_angleStart angle of the arc. Will only be set if is_arc returns true.
[out]end_angleEnd angle of the arc. Will only be set if is_arc returns true.
Returns
LO_RESULT LOPathGetCircle ( LOPathRef  path,
bool *  is_circle,
LOPoint2D center,
double *  radius 
)

Gets whether or not the path represents a circle, and if so, gets the geometric representation of the circle.

Since
LayOut 2017, API 2.0
Parameters
[in]pathThe path object.
[out]is_circleWhether or not the path is a circle.
[out]centerCenter point of the circle. Will only be set if is_circle returns true.
[out]radiusRadius of the circle. Will only be set if is_circle returns true.
Returns
LO_RESULT LOPathGetClosed ( LOPathRef  path,
bool *  is_closed 
)

Gets whether or not the path is a closed loop.

Parameters
[in]pathThe path object.
[out]is_closedWhether the path is closed or not.
Returns
LO_RESULT LOPathGetEndPoint ( LOPathRef  path,
LOPoint2D point 
)

Gets the end point for the path.

Parameters
[in]pathThe path object.
[out]pointThe end point.
Returns
LO_RESULT LOPathGetNumberOfPoints ( LOPathRef  path,
size_t *  size 
)

Gets the number of points in the path.

Parameters
[in]pathThe path object.
[out]sizeThe number of points in the path.
Returns
LO_RESULT LOPathGetParametricLength ( LOPathRef  path,
double *  parametric_length 
)

Gets the length of the path.

Parameters
[in]pathThe path object.
[out]parametric_lengthThe length of the path.
Returns
LO_RESULT LOPathGetPointAtIndex ( LOPathRef  path,
size_t  point_index,
LOPoint2D point 
)

Gets the point in the path at the given index.

Parameters
[in]pathThe path object.
[in]point_indexThe index of the point to get.
[out]pointThe point at the given index.
Returns
LO_RESULT LOPathGetPointAtParameter ( LOPathRef  path,
double  parametric_value,
LOPoint2D point 
)

Gets the point at the given distance along the path.

Parameters
[in]pathThe path object.
[in]parametric_valueThe distance along the path to get the point.
[out]pointThe point at the given distance along the path.
Returns
LO_RESULT LOPathGetPoints ( LOPathRef  path,
size_t  points_size,
LOPoint2D  points[],
size_t *  number_of_points_copied 
)

Gets the points in the path.

Parameters
[in]pathThe path object.
[in]points_sizeThe maximum number of points to copy.
[out]pointsThe array that the points will be copied to.
[out]number_of_points_copiedThe number of points actually copied.
Returns
LO_RESULT LOPathGetPointTypeAtIndex ( LOPathRef  path,
size_t  point_index,
LOPathPointType pointtype 
)

Gets the type of the specified point in the path.

Parameters
[in]pathThe path object.
[in]point_indexThe index of the point to get type information of.
[out]pointtypeThe point type.
Returns
LO_RESULT LOPathGetPointTypes ( LOPathRef  path,
size_t  pointtypes_size,
LOPathPointType  pointtypes[],
size_t *  number_of_pointtypes_copied 
)

Gets the type of each point in the path.

Parameters
[in]pathThe path object.
[in]pointtypes_sizeThe maximum number of point types to copy.
[out]pointtypesThe array that the point types will be copied to.
[out]number_of_pointtypes_copiedThe number of point types actually copied.
Returns
LO_RESULT LOPathGetStartPoint ( LOPathRef  path,
LOPoint2D point 
)

Gets the start point for the path.

Parameters
[in]pathThe path object.
[out]pointThe start point.
Returns
LO_RESULT LOPathGetTangentAtParameter ( LOPathRef  path,
double  parametric_value,
LOVector2D tangent 
)

Gets the tangent at the given distance along the path.

Parameters
[in]pathThe path object.
[in]parametric_valueThe distance along the path to get the tangent.
[out]tangentThe tangent at the given distane along the path.
Returns
LO_RESULT LOPathGetWindingType ( LOPathRef  path,
LOPathWindingType winding 
)

Returns the winding type of the path.

Since
LayOut 2019, API 4.0
Parameters
[in]pathThe path object.
[out]windingThe winding type of the path.
Returns
LO_RESULT LOPathRelease ( LOPathRef path)

Releases a path object. The object will be invalidated if releasing the last reference.

Parameters
[in]pathThe path object.
Returns
LO_EXPORT LOEntityRef LOPathToEntity ( LOPathRef  path)

Converts from a LOPathRef to a LOEntityRef. This is essentially an upcast operation.

Parameters
[in]pathThe path object.
Returns
  • The converted LOEntityRef if path is a valid object
  • If not, the returned reference will be invalid