Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
hdi::core::PathArt Class Reference

Allows for path manipulation, metadata access, trimming, extending, etc. More...

#include <hdicorePathArt.h>

Public Types

enum  WindingOrderType { WindingUnknown = 0 , Clockwise = 1 , CounterClockwise = 2 }
 Describes which direction the (closed) art is wound.
 
enum  SegPointSelectionState {
  SegPointNotSelected = 0 , SegPointAnchorSelected = 1 << 0 , SegPointInSelected = 1 << 1 , SegPointOutSelected = 1 << 2 ,
  SegPointAllSelected = (SegPointAnchorSelected | SegPointInSelected | SegPointOutSelected)
}
 Describes how an individual segment point is selected, if at all. More...
 
enum  TrimDirectionType { TrimGreaterDirectionOnly = 1 << 0 , TrimLesserDirectionOnly = 1 << 1 , TrimBothDirections = (TrimGreaterDirectionOnly | TrimLesserDirectionOnly) }
 Describes which direction a trim should take place (to the greater, lesser, or both sides of a given reference point)
 
enum  TrimError {
  NoTrimError = 0 , HitDataArtMustMatchTrimPathArtError = 10 , TrimPathIsClosedError = 20 , TrimPathNeedsAtLeast2PointsError = 30 ,
  InvalidSourcePathForTrimming = 40
}
 Describes various errors that can occur when trimming a path.
 
enum  ExtendError {
  NoExtendError = 0 , HitDataArtMustMatchExtendPathArtError = 110 , NoExtendIntersectionsFoundError = 120 , ExtendPathEndSegmentsOnlyError = 130 ,
  ExtendPathIsClosedError = 140 , ExtendPathNeedsAtLeast2PointsError = 150 , InvalidSourcePathForExtending = 160
}
 Describes various errors that can occur when trimming a path.
 
enum  StrokeAlignment { UnknownStrokeAlignment = 0 , CenterStrokeAlignment = 10 , InsideStrokeAlignment = 20 , OutsideStrokeAlignment = 30 }
 Describes how a path's stroke should be aligned.
 
typedef std::vector< ArtboardSegPointArtboardSegPointVector
 
typedef std::vector< std::shared_ptr< HitData > > HitDataVector
 

Public Member Functions

 ~PathArt ()
 Destructs a PathArt object.
 
bool isGuide () const
 Gets whether the path is a guide.
 
bool closed () const
 Gets whether the target path is closed.
 
void setClosed (const bool closed_)
 Sets whether the target path is closed.
 
PathStyle style () const
 Gets the target path's style.
 
void setStyle (const PathStyle &style_)
 Sets the target path's style.
 
int16_t segCount () const
 Gets the count of segments in the path, taking into account phantom segments of closed paths.
 
int16_t segPointCount () const
 Gets the count of individual segment points in the path.
 
void setSegCount (const int16_t count_)
 Sets the count of segments in the path.
 
void setSegPointCount (const int16_t count_)
 Sets the count of individual segment points in the path.
 
std::unique_ptr< hdi::core::Bezierbezier (const int16_t segIndex_) const
 Gets a Bezier object for a given segment index.
 
ArtboardPoint midPoint () const
 Gets the midpoint along a path.
 
void endPoints (ArtboardPoint &start__, ArtboardPoint &end__) const
 Gets the end points of a path.
 
bool hasLength () const
 Gets whether the path has any length.
 
double length () const
 Gets the total length of the path.
 
double sublength (const int16_t startSegPt_, const int16_t endSegPt_) const
 Gets the length of a subpath from one segment point to another.
 
double sublength (const int16_t startSeg_, const double startT_, const int16_t endSeg_, const double endT_) const
 Gets the length of a subpath, from segment point at a t-value to another.
 
double tAtLength (const int16_t segNum_, const double length_) const
 Gets the t-value at a given length of a given path segment.
 
double area () const
 Gets the area of the path.
 
bool hasStraightSegs () const
 Gets whether each individual path segment is straight.
 
bool isStraight () const
 Gets whether the entire path forms a perfectly straight line.
 
bool isRectangular () const
 Gets whether the entire path forms a rectangular shape.
 
bool isCircular () const
 Gets whether the entire path forms a circle.
 
bool isEllipse () const
 Gets whether the entire path forms an ellipse.
 
ArtboardPoint centroid () const
 Calculates the centroid of the path.
 
bool angle (Angle &angle__) const
 Gets the angle of the path relative to the x-axis, if the path is a perfectly straight line.
 
ArtboardSegPointVector segs (const int16_t segIndex_, const int16_t count_) const
 Gets a series of points describing the requested path segments.
 
ArtboardSegPointVector segPoints (const int16_t segPtIndex_, const int16_t count_) const
 Gets a series of path segment points.
 
ArtboardSegPointVector phantomSeg () const
 Gets two segment points describing the phantom segment of a path.
 
ArtboardSegPointVector phantomSegPoints () const
 Gets the two phantom segment points.
 
void setSegs (const int16_t segIndex_, const ArtboardSegPointVector &segPts_)
 Sets a series of segments in the path to new values.
 
void setSegPoints (const int16_t segPtIndex_, const ArtboardSegPointVector &segPts_)
 Sets a series of segment points in the path to new values.
 
bool allSegPointsSelected () const
 Gets whether all the segments points of a path are selected.
 
bool segSelected (const int16_t segIndex_) const
 Gets whether a given segment is selected.
 
SegPointSelectionState segPointSelected (const int16_t segPtIndex_) const
 Gets the selection state of a given segment point.
 
bool setSegPointSelected (const int16_t segPtIndex_, const SegPointSelectionState selected_)
 Sets the selection state of a given segment point.
 
void insertSegs (const int16_t segIndex_, const ArtboardSegPointVector &segPts_)
 Inserts new segments into the target path at a given segment index.
 
void insertSegPoints (const int16_t segPtIndex_, const ArtboardSegPointVector &segPts_)
 Inserts new segment points into the target path after a given segment point index.
 
void deleteSegs (const int16_t segIndex_, const int16_t count_)
 Deletes a given number of segments from a given segment index forward.
 
void deleteSegPoints (const int16_t segPtIndex_, const int16_t count_)
 Deletes a given number of segment points from a given segment point index forward.
 
void rotateSegPoints (const int16_t delta_)
 Rotates segment point indices by a given delta, while keeping the points at the same location in space.
 
void reverseSegs ()
 Reverses the winding order of the segment points in the path.
 
WindingOrderType windingOrder () const
 Gets the winding order of the path.
 
void setWindingOrder (const WindingOrderType winding_)
 Sets the winding order of the path.
 
void setStrokeAlignment (const StrokeAlignment align_)
 Sets the stroke alignment for the target path.
 
void insertSegPointAtT (const int16_t segIndex_, const double t_)
 "Safely" inserts a new segment point in a given segment
 
int16_t segPointClosestToPoint (const ArtboardPoint &pt_) const
 Gets the index of the segment point that is closest to a given point in space.
 
bool containsPoint (const ArtboardPoint &pt_) const
 Gets whether a given point is contained inside the path.
 
bool simplify (const double flatness_)
 Attempts to reduce the number of segment points in the path by converting them to a series of points and then re-fitting curves to the points. Any corner segments are preserved.
 
HitDataVector getIntersections (const int16_t max_=0, const bool guides_=false) const
 Gets all path segment intersections along the target path.
 
HitDataVector getIntersections (const Art &target_, const int16_t max_=0, const bool guides_=false) const
 Gets path segment intersections along the target path.
 
TrimError trim (const HitData &center_, const bool delete_, const TrimDirectionType dir_, const bool guides_, Art &split__)
 Trims a path around a given "center" point, either to one or both sides.
 
ExtendError extend (const HitData &from_, const HitData &to_, const bool guides_)
 Extends a path from a given "point" to another "point".
 

Static Public Attributes

static const int16_t maxSegments = 32000
 Maximum number of segments allowed in a path.
 

Friends

class Art
 

Detailed Description

Allows for path manipulation, metadata access, trimming, extending, etc.

Member Enumeration Documentation

◆ SegPointSelectionState

Describes how an individual segment point is selected, if at all.

Note
There are a limited number of ways that a segment point can be selected. Either the point is not selected at all; its anchor, in, and out controls are selected; its in and out controls are selected; its in control is selected; or its out control is selected. Any other combination is not possible.

Constructor & Destructor Documentation

◆ ~PathArt()

hdi::core::PathArt::~PathArt ( )

Destructs a PathArt object.

Author
GW
Date
08/2013

Member Function Documentation

◆ allSegPointsSelected()

bool hdi::core::PathArt::allSegPointsSelected ( ) const

Gets whether all the segments points of a path are selected.

Author
GW
Date
08/2013
Returns
true if all the segments points are selected, false otherwise

◆ angle()

bool hdi::core::PathArt::angle ( Angle angle__) const

Gets the angle of the path relative to the x-axis, if the path is a perfectly straight line.

Author
GW
Date
08/2013
Parameters
angle__Return-by-reference for the angle of the path
Returns
true if the path is straight and, therefore, the value of angle__ is valid
Note
See isStraight() method.

◆ area()

double hdi::core::PathArt::area ( ) const

Gets the area of the path.

Author
GW
Date
08/2013
Returns
The area formed by the path, in square points

◆ bezier()

std::unique_ptr< hdi::core::Bezier > hdi::core::PathArt::bezier ( const int16_t  segIndex_) const

Gets a Bezier object for a given segment index.

Author
GW
Date
08/2013
Parameters
segIndex_Segment index number in question
Returns
The Bezier object that describes the path segment (if the seg index is valid), NULL otherwise

◆ centroid()

ArtboardPoint hdi::core::PathArt::centroid ( ) const

Calculates the centroid of the path.

Author
GW
Date
04/2023
Returns
The centroid of the path, via approximating its various edges as triangles and computing the sum of each of their centroids
Note
If the path has a single point, then that point will be returned. If the path has two points, then the midpoint will be returned.

◆ closed()

bool hdi::core::PathArt::closed ( ) const

Gets whether the target path is closed.

Author
GW
Date
08/2013
Returns
true if the path is closed, false if open

◆ containsPoint()

bool hdi::core::PathArt::containsPoint ( const ArtboardPoint pt_) const

Gets whether a given point is contained inside the path.

Author
GW
Date
08/2013
Parameters
pt_The point in question
Returns
true if the given point lies within the path, false otherwise

◆ deleteSegPoints()

void hdi::core::PathArt::deleteSegPoints ( const int16_t  segPtIndex_,
const int16_t  count_ 
)

Deletes a given number of segment points from a given segment point index forward.

Author
GW
Date
08/2013
Parameters
segPtIndex_Index number of the first segment point to delete
count_Number of segment points to delete from segIndex_ forward (inclusive)

◆ deleteSegs()

void hdi::core::PathArt::deleteSegs ( const int16_t  segIndex_,
const int16_t  count_ 
)

Deletes a given number of segments from a given segment index forward.

Author
GW
Date
08/2013
Parameters
segIndex_Index number of the first segment to delete
count_Number of segments to delete from segIndex_ forward (inclusive)

◆ endPoints()

void hdi::core::PathArt::endPoints ( ArtboardPoint start__,
ArtboardPoint end__ 
) const

Gets the end points of a path.

Author
GW
Date
08/2013
Parameters
start__Return-by-reference for the start point (i.e. segment index 0, t-value 0.0)
end__Return-by-reference for the end point (i.e. segment index n-1, t-value 1.0)
Note
This method will also work for closed paths, giving the start and end points around the phantom segment.

◆ extend()

ExtendError hdi::core::PathArt::extend ( const HitData from_,
const HitData to_,
const bool  guides_ 
)

Extends a path from a given "point" to another "point".

Author
GW
Date
08/2013
Parameters
from_HitData object describing the point from which the extension should take place
to_HitData object describing the path and segment to which the target should be extended
guides_Whether guides should be included when extending
Returns
An error code for the result of the extend operation. Closed paths cannot be extended, "paths" with only one segment point cannot be extended, only the endpoints of a path can be extended, and a path cannot be extended to another path parallel to it. Successful cases return NoExtendError.
Note
The art that from_ contains must be the same as the art to which the target path belongs.
If some art should not be considered for extending, simply lock or hide it before calling the extend() method.

◆ getIntersections() [1/2]

HitDataVector hdi::core::PathArt::getIntersections ( const Art target_,
const int16_t  max_ = 0,
const bool  guides_ = false 
) const

Gets path segment intersections along the target path.

This method only gets intersections between a path and a provided target piece of art

Author
GW
Date
08/2013
Parameters
target_Piece of art to check against for intersections with the target path
max_If desired, limits the max count of intersections, in whichever order they are found first; pass 0 for "unlimited"
guides_Whether guides should be included in the search
Returns
A vector of HitData objects describing each intersection point along the target path. Each intersection, if any, will only contain target_ as the intersecting art. Inspect each HitData object in the vector for info about how it intersects the path.

◆ getIntersections() [2/2]

HitDataVector hdi::core::PathArt::getIntersections ( const int16_t  max_ = 0,
const bool  guides_ = false 
) const

Gets all path segment intersections along the target path.

Author
GW
Date
08/2013
Parameters
max_If desired, limits the max count of intersections, in whichever order they are found first; pass 0 for "unlimited"
guides_Whether guides should be included in the search
Returns
A vector of HitData objects describing each intersection point along the target path (including intersections with itself). Inspect each HitData object in the vector for info about which piece of art intersects the target path, and how it intersects the path.

◆ hasLength()

bool hdi::core::PathArt::hasLength ( ) const

Gets whether the path has any length.

Author
GW
Date
08/2013
Returns
true if the path has length, false otherwise
Note
A path might have zero length if it consists of a single point or all the points lie atop one another.

◆ hasStraightSegs()

bool hdi::core::PathArt::hasStraightSegs ( ) const

Gets whether each individual path segment is straight.

Author
GW
Date
08/2013
Returns
true if the entire path is composed of straight segments, false otherwise

◆ insertSegPointAtT()

void hdi::core::PathArt::insertSegPointAtT ( const int16_t  segIndex_,
const double  t_ 
)

"Safely" inserts a new segment point in a given segment

Author
GW
Date
08/2013
Parameters
segIndex_Index number of the segment in which the new point will be added
t_T-value along the given path segment at which the new point will be added
Note
This method is considered "safe" because it keeps the same bezier curvature present at the provided t-value by calculating the proper in- and out-point positions.

◆ insertSegPoints()

void hdi::core::PathArt::insertSegPoints ( const int16_t  segPtIndex_,
const ArtboardSegPointVector &  segPts_ 
)

Inserts new segment points into the target path after a given segment point index.

Author
GW
Date
08/2013
Parameters
segPtIndex_Segment point index, after which the new seg points will be inserted
segPts_Vector of new segment points
Note
For example, passing 0 for segPtIndex_ means that the new seg pts will be inserted between the existing seg pts 0 and 1.
The number of points inserted will be equal to the count of the points in segPts_
If a negative number is passed for segPtIndex_, and the count of segPts_ is equal to its absolute value, these new points will be inserted before the first point in the path.

◆ insertSegs()

void hdi::core::PathArt::insertSegs ( const int16_t  segIndex_,
const ArtboardSegPointVector &  segPts_ 
)

Inserts new segments into the target path at a given segment index.

Author
GW
Date
08/2013
Parameters
segIndex_Segment index, in which the new segs will start
segPts_Vector of new segment points describing the segments
Note
For example, passing 0 for segIndex_ means that the new segs will be inserted between the existing seg pts 0 and 1.
The number of segments inserted will be equal to the count of the points in segPts_, minus one (since two points are needed to describe a single segment).
Negative index values, to insert points before the start of the path, can only be passed to the insertSegPoints() method.

◆ isCircular()

bool hdi::core::PathArt::isCircular ( ) const

Gets whether the entire path forms a circle.

Author
GW
Date
08/2013
Returns
true if the path forms a closed circle, false otherwise

◆ isEllipse()

bool hdi::core::PathArt::isEllipse ( ) const

Gets whether the entire path forms an ellipse.

Author
GW
Date
03/2021
Returns
true if the path forms a closed ellipse, false otherwise

◆ isGuide()

bool hdi::core::PathArt::isGuide ( ) const

Gets whether the path is a guide.

Author
GW
Date
08/2013
Returns
true if the path is a guide path, false otherwise

◆ isRectangular()

bool hdi::core::PathArt::isRectangular ( ) const

Gets whether the entire path forms a rectangular shape.

Author
GW
Date
08/2013
Returns
true if the path forms an open or closed rectangle (with straight segments)

◆ isStraight()

bool hdi::core::PathArt::isStraight ( ) const

Gets whether the entire path forms a perfectly straight line.

Author
GW
Date
08/2013
Returns
true if the entire path is straight and composes the same angle relative to 0.0°

◆ length()

double hdi::core::PathArt::length ( ) const

Gets the total length of the path.

Author
GW
Date
08/2013
Returns
The length of the path in points

◆ midPoint()

ArtboardPoint hdi::core::PathArt::midPoint ( ) const

Gets the midpoint along a path.

Author
GW
Date
08/2013
Returns
The midpoint of the path (a point equidistant from either end point of the path)

◆ phantomSeg()

ArtboardSegPointVector hdi::core::PathArt::phantomSeg ( ) const

Gets two segment points describing the phantom segment of a path.

Author
GW
Date
08/2013
Returns
A vector of the two segment points describing the segment
Note
This method is indentical to the phantomSegPoints() method.

◆ phantomSegPoints()

ArtboardSegPointVector hdi::core::PathArt::phantomSegPoints ( ) const

Gets the two phantom segment points.

Author
GW
Date
08/2013
Returns
A vector of the two segment points describing the segment
Note
This method is indentical to the phantomSeg() method.

◆ reverseSegs()

void hdi::core::PathArt::reverseSegs ( )

Reverses the winding order of the segment points in the path.

Author
GW
Date
08/2013

◆ rotateSegPoints()

void hdi::core::PathArt::rotateSegPoints ( const int16_t  delta_)

Rotates segment point indices by a given delta, while keeping the points at the same location in space.

Author
GW
Date
08/2013
Parameters
delta_The number of positions to move each segment point
Note
The rotation changes the segment point index by the given delta; e.g. if a path had point indices and locations 0:(0,1), 1:(2,3), 2:(4,5) and delta_ was 1, the points would shift to become 0:(2,3), 1:(4,5), 2:(0,1) instead.

◆ segCount()

int16_t hdi::core::PathArt::segCount ( ) const

Gets the count of segments in the path, taking into account phantom segments of closed paths.

Author
GW
Date
08/2013
Returns
The count of segments in the path

◆ segPointClosestToPoint()

int16_t hdi::core::PathArt::segPointClosestToPoint ( const ArtboardPoint pt_) const

Gets the index of the segment point that is closest to a given point in space.

Author
GW
Date
08/2013
Parameters
pt_The point in question
Returns
The segment point index closest to the provided point, or -1 for error

◆ segPointCount()

int16_t hdi::core::PathArt::segPointCount ( ) const

Gets the count of individual segment points in the path.

Author
GW
Date
08/2013
Returns
The count of segment points in the path

◆ segPoints()

ArtboardSegPointVector hdi::core::PathArt::segPoints ( const int16_t  segPtIndex_,
const int16_t  count_ 
) const

Gets a series of path segment points.

Author
GW
Date
08/2013
Parameters
segPtIndex_Index number of the first segment point in question
count_Number of segment points requested from segIndex_ forward (inclusive)
Returns
A vector of segment points describing the segments in question
Note
The maximum value for count_ is equal to maxSegments

◆ segPointSelected()

SegPointSelectionState hdi::core::PathArt::segPointSelected ( const int16_t  segPtIndex_) const

Gets the selection state of a given segment point.

Author
GW
Date
08/2013
Parameters
segPtIndex_Index number of the segment point in question
Returns
A segment point selection state enum value to describe how the point is selected
Note
It is worth noting that a segment point being selected individually by the direct selection tool will result in all control points being selected (and visibly so on the artboard), but a path's segment points being selected en masse by the regular selection tool will result in the Illustrator SDK saying that all control points are selected too (though only the anchor point will be visibly selected on the artboard). It is not possible to determine with the SDK whether a given segment point was selected by one tool or another, nor is it possible to determine that only the anchor point is visibly shown to be selected (and not the other two control points). As such, if you need to make a distinction between these two situations, it is best to make an initial pass through all of the segment points of a path and count how many appear to have all of their control points selected. If it is exactly one, then that individual segment point will indeed visibly show all of its control points as being selected. If the count is not one, then all of the "fully selected" control points will only visibly show their anchor point as being selected.

◆ segs()

ArtboardSegPointVector hdi::core::PathArt::segs ( const int16_t  segIndex_,
const int16_t  count_ 
) const

Gets a series of points describing the requested path segments.

Author
GW
Date
08/2013
Parameters
segIndex_Index number of the first segment in question
count_Number of segments requested from segIndex_ forward (inclusive)
Returns
A vector of segment points describing the segments in question
Note
The count of the resultant points in the vector will typically be equal to count_ + 1 (since two points are needed to describe a single segment). This will be overridden in the case of a requested count that is larger than the path's segment count, or the path being closed (the phantom segment is at the "end" and wraps around).
You can acquire the phantom segment of a path (closed or open) by passing in -1 (or segPtCount() - 1) for segIndex_ and 1 for count_
The maximum value for count_ is equal to maxSegments

◆ segSelected()

bool hdi::core::PathArt::segSelected ( const int16_t  segIndex_) const

Gets whether a given segment is selected.

Author
GW
Date
08/2013
Parameters
segIndex_Index number of the segment in question
Returns
true if the segment is selected, false otherwise
Note
A segment is selected if both its endpoints are fully selected

◆ setClosed()

void hdi::core::PathArt::setClosed ( const bool  closed_)

Sets whether the target path is closed.

Author
GW
Date
08/2013
Parameters
closed_true to close the path, false to open it

◆ setSegCount()

void hdi::core::PathArt::setSegCount ( const int16_t  count_)

Sets the count of segments in the path.

Author
GW
Date
08/2013
Parameters
count_New segment count
Precondition
Path closedness/openness must already be set to the desired value, otherwise unexpected results may occur. If the closed/open state of a (new) path is not yet determinable, use the setSegPointCount() method instead.
Note
For new path art, this method should be called before any segment point manipulation method, e.g. setSegs() or setSegPoints(), as it "primes" the path to have the requisite number of segments available for said manipulation.
For new path art, if this method is called and then e.g. setSegs() is never called, then all the segment points will simply lie at (0,0).

◆ setSegPointCount()

void hdi::core::PathArt::setSegPointCount ( const int16_t  count_)

Sets the count of individual segment points in the path.

Author
GW
Date
08/2013
Parameters
count_New segment point count
Note
For new path art, this method should be called before any segment point manipulation method, e.g. setSegs() or setSegPoints(), as it "primes" the path to have the requisite number of segment points available for said manipulation.
For new path art, if this method is called and then e.g. setSegPoints() is never called, then all the segment points will simply lie at (0,0).

◆ setSegPoints()

void hdi::core::PathArt::setSegPoints ( const int16_t  segPtIndex_,
const ArtboardSegPointVector &  segPts_ 
)

Sets a series of segment points in the path to new values.

Author
GW
Date
08/2013
Parameters
segPtIndex_Index number of the first segment point to set
segPts_Vector of new segment points
Note
This method will either change existing segment points, or create new ones if they don't exist yet.
The number of points modified will be equal to the count of the points in segPts_
The maximum count for segPts_ is equal to maxSegments

◆ setSegPointSelected()

bool hdi::core::PathArt::setSegPointSelected ( const int16_t  segPtIndex_,
const SegPointSelectionState  selected_ 
)

Sets the selection state of a given segment point.

Author
GW
Date
03/2015
Parameters
segPtIndex_Index number of the segment point in question
selected_New segment point selection state enum value
Returns
true if the point was selected as indicated, false otherwise (see the documentation for the SegPointSelectionState enum for why this might occur)

◆ setSegs()

void hdi::core::PathArt::setSegs ( const int16_t  segIndex_,
const ArtboardSegPointVector &  segPts_ 
)

Sets a series of segments in the path to new values.

Author
GW
Date
08/2013
Parameters
segIndex_Index number of the first segment to set
segPts_Vector of new segment points describing the segments
Precondition
Path closedness/openness must already be set to the desired value, otherwise unexpected results may occur. If the closed/open state of a (new) path is not yet determinable, use the setSegPoints() method instead.
Note
This method will either change existing segments, or create new ones if they don't exist yet.
The number of segments modified will be equal to the count of the points in segPts_ for closed paths, or the count minus one for open paths (since two points are needed to describe a single segment).
The maximum count for segPts_ is equal to maxSegments

◆ setStrokeAlignment()

void hdi::core::PathArt::setStrokeAlignment ( const StrokeAlignment  align_)

Sets the stroke alignment for the target path.

Author
GW
Date
08/2014
Parameters
align_New stroke alignment setting
Note
As of Illustrator 26, there is no getter for stroke alignment.

◆ setStyle()

void hdi::core::PathArt::setStyle ( const PathStyle style_)

Sets the target path's style.

Author
GW
Date
08/2013
Parameters
style_New path styling info

◆ setWindingOrder()

void hdi::core::PathArt::setWindingOrder ( const WindingOrderType  winding_)

Sets the winding order of the path.

Author
GW
Date
08/2013
Parameters
winding_New path winding order
Note
If a specific winding order is desired, this method offers more control than the reverseSegs() method. For example, if a path is already clockwise, setting it to clockwise has no effect. If a path is counter-clockwise, setting it to clockwise will switch the winding order.

◆ simplify()

bool hdi::core::PathArt::simplify ( const double  flatness_)

Attempts to reduce the number of segment points in the path by converting them to a series of points and then re-fitting curves to the points. Any corner segments are preserved.

Author
GW
Date
09/2021
Parameters
flatness_An upper bound on the error between the line segments and the true curve
Returns
true if the simplification was successful, false otherwise

◆ style()

PathStyle hdi::core::PathArt::style ( ) const

Gets the target path's style.

Author
GW
Date
08/2013
Returns
An PathStyle object describing the path's styling info

◆ sublength() [1/2]

double hdi::core::PathArt::sublength ( const int16_t  startSeg_,
const double  startT_,
const int16_t  endSeg_,
const double  endT_ 
) const

Gets the length of a subpath, from segment point at a t-value to another.

Author
GW
Date
08/2013
Parameters
startSeg_Starting segment point number for calculating path length
startT_T-value along startSeg_ seg to begin the calculation
endSeg_Ending segment point number for calculating path length
endT_T-value along endSeg_ seg to end the calculation
Returns
The length in points of the subpath from startSeg_ at startT_ to endSeg_ at endT_

◆ sublength() [2/2]

double hdi::core::PathArt::sublength ( const int16_t  startSegPt_,
const int16_t  endSegPt_ 
) const

Gets the length of a subpath from one segment point to another.

Author
GW
Date
08/2013
Parameters
startSegPt_Starting segment point number for calculating path length
endSegPt_Ending segment point number for calculating path length
Returns
The length in points of the subpath from startSegPt_ to endSegPt_

◆ tAtLength()

double hdi::core::PathArt::tAtLength ( const int16_t  segNum_,
const double  length_ 
) const

Gets the t-value at a given length of a given path segment.

Author
GW
Date
08/2013
Parameters
segNum_Segment number in which the given sublength resides
length_Length within the given segment number for which a t-value is desired
Returns
The bezier t-value in the given segment at which the given length is reached

◆ trim()

TrimError hdi::core::PathArt::trim ( const HitData center_,
const bool  delete_,
const TrimDirectionType  dir_,
const bool  guides_,
Art split__ 
)

Trims a path around a given "center" point, either to one or both sides.

Author
GW
Date
08/2013
Parameters
center_HitData object describing the "center" from which the trims will take place
delete_Whether portion(s) of the path beyond the intersection(s) should be deleted
dir_Which direction the trim(s) should take place
guides_Whether guides should be taken into account for trimming
split__Return-by-reference for the second piece of path art, if necessary
Returns
An error code for the result of the trim operation. Closed paths cannot be trimmed, and "paths" with only one segment point cannot be trimmed. Successful cases return NoTrimError.
Note
Intersection(s) nearest center_, on the path, will be trimmed. The art that center_ contains must be the same as the art to which the target path belongs.
Pass true for delete_ to remove portions of the path beyond the intersection(s), or false to insert new segment points where the deletion would have otherwise occurred.
The dir_ arg can be used to perform a trim on only one side of a line, regardless of intersections existing on the other side.
split__ will be set to the secondary piece of path art after a trim that results in the path being split (i.e. deleting pts in the middle). It will first be set to an empty Art object by default.
If some art should not be considered for trimming, simply lock or hide it before calling the trim() method.

◆ windingOrder()

WindingOrderType hdi::core::PathArt::windingOrder ( ) const

Gets the winding order of the path.

Author
GW
Date
08/2013
Returns
An enum value for clockwise or counter-clockwise winding order