7#ifndef __HDI_CORE_PATH_ART__
8#define __HDI_CORE_PATH_ART__
10#if defined(HDI_CORE_AIP_MODE)
25 class ArtboardSegPoint;
33 typedef std::vector<ArtboardSegPoint> ArtboardSegPointVector;
34 typedef std::vector< std::shared_ptr<HitData> > HitDataVector;
61 SegPointNotSelected = 0,
62 SegPointAnchorSelected = 1 << 0,
63 SegPointInSelected = 1 << 1,
64 SegPointOutSelected = 1 << 2,
65 SegPointAllSelected = (SegPointAnchorSelected | SegPointInSelected | SegPointOutSelected)
74 TrimGreaterDirectionOnly = 1 << 0,
75 TrimLesserDirectionOnly = 1 << 1,
76 TrimBothDirections = (TrimGreaterDirectionOnly | TrimLesserDirectionOnly)
85 HitDataArtMustMatchTrimPathArtError = 10,
86 TrimPathIsClosedError = 20,
87 TrimPathNeedsAtLeast2PointsError = 30,
88 InvalidSourcePathForTrimming = 40
97 HitDataArtMustMatchExtendPathArtError = 110,
98 NoExtendIntersectionsFoundError = 120,
99 ExtendPathEndSegmentsOnlyError = 130,
100 ExtendPathIsClosedError = 140,
101 ExtendPathNeedsAtLeast2PointsError = 150,
102 InvalidSourcePathForExtending = 160
219 std::unique_ptr<hdi::core::Bezier>
bezier(
const int16_t segIndex_)
const;
273 double sublength(
const int16_t startSegPt_,
const int16_t endSegPt_)
const;
287 const int16_t startSeg_,
288 const double startT_,
289 const int16_t endSeg_,
302 double tAtLength(
const int16_t segNum_,
const double length_)
const;
400 ArtboardSegPointVector
segs(
const int16_t segIndex_,
const int16_t count_)
const;
413 ArtboardSegPointVector
segPoints(
const int16_t segPtIndex_,
const int16_t count_)
const;
455 void setSegs(
const int16_t segIndex_,
const ArtboardSegPointVector& segPts_);
470 void setSegPoints(
const int16_t segPtIndex_,
const ArtboardSegPointVector& segPts_);
545 void insertSegs(
const int16_t segIndex_,
const ArtboardSegPointVector& segPts_);
561 void insertSegPoints(
const int16_t segPtIndex_,
const ArtboardSegPointVector& segPts_);
571 void deleteSegs(
const int16_t segIndex_,
const int16_t count_);
632 UnknownStrokeAlignment = 0,
633 CenterStrokeAlignment = 10,
634 InsideStrokeAlignment = 20,
635 OutsideStrokeAlignment = 30
724 const int16_t max_ = 0,
725 const bool guides_ =
false
Describes an angle, and allows for easy conversion between various units.
Definition: hdicoreAngle.h:26
Handles general art-related functionality.
Definition: hdicoreArt.h:51
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:31
Allows for hit data creation, metadata access, snapping, etc.
Definition: hdicoreHitData.h:32
Allows for path manipulation, metadata access, trimming, extending, etc.
Definition: hdicorePathArt.h:31
bool simplify(const double flatness_)
Attempts to reduce the number of segment points in the path by converting them to a series of points ...
void endPoints(ArtboardPoint &start__, ArtboardPoint &end__) const
Gets the end points of a path.
SegPointSelectionState segPointSelected(const int16_t segPtIndex_) const
Gets the selection state of a given segment point.
bool angle(Angle &angle__) const
Gets the angle of the path relative to the x-axis, if the path is a perfectly straight line.
StrokeAlignment
Describes how a path's stroke should be aligned.
Definition: hdicorePathArt.h:631
static const int16_t maxSegments
Maximum number of segments allowed in a path.
Definition: hdicorePathArt.h:39
void setSegPoints(const int16_t segPtIndex_, const ArtboardSegPointVector &segPts_)
Sets a series of segment points in the path to new values.
ArtboardPoint centroid() const
Calculates the centroid of the path.
void setWindingOrder(const WindingOrderType winding_)
Sets the winding order of the path.
HitDataVector getIntersections(const Art &target_, const int16_t max_=0, const bool guides_=false) const
Gets path segment intersections along the target path.
PathStyle style() const
Gets the target path's style.
ArtboardSegPointVector phantomSeg() const
Gets two segment points describing the phantom segment of a path.
int16_t segCount() const
Gets the count of segments in the path, taking into account phantom segments of closed paths.
bool allSegPointsSelected() const
Gets whether all the segments points of a path are selected.
bool hasStraightSegs() const
Gets whether each individual path segment is straight.
double tAtLength(const int16_t segNum_, const double length_) const
Gets the t-value at a given length of a given path segment.
bool isGuide() const
Gets whether the path is a guide.
bool segSelected(const int16_t segIndex_) const
Gets whether a given segment is selected.
ArtboardSegPointVector segs(const int16_t segIndex_, const int16_t count_) const
Gets a series of points describing the requested path segments.
double length() const
Gets the total length of the path.
bool isStraight() const
Gets whether the entire path forms a perfectly straight line.
TrimError
Describes various errors that can occur when trimming a path.
Definition: hdicorePathArt.h:83
void deleteSegs(const int16_t segIndex_, const int16_t count_)
Deletes a given number of segments from a given segment index forward.
bool hasLength() const
Gets whether the path has any length.
void setSegs(const int16_t segIndex_, const ArtboardSegPointVector &segPts_)
Sets a series of segments in the path to new values.
void setSegCount(const int16_t count_)
Sets the count of segments in the path.
ExtendError extend(const HitData &from_, const HitData &to_, const bool guides_)
Extends a path from a given "point" to another "point".
std::unique_ptr< hdi::core::Bezier > bezier(const int16_t segIndex_) const
Gets a Bezier object for a given segment index.
bool setSegPointSelected(const int16_t segPtIndex_, const SegPointSelectionState selected_)
Sets the selection state of a given segment point.
void setStrokeAlignment(const StrokeAlignment align_)
Sets the stroke alignment for the target path.
bool isEllipse() const
Gets whether the entire path forms an ellipse.
SegPointSelectionState
Describes how an individual segment point is selected, if at all.
Definition: hdicorePathArt.h:60
bool isCircular() const
Gets whether the entire path forms a circle.
void rotateSegPoints(const int16_t delta_)
Rotates segment point indices by a given delta, while keeping the points at the same location in spac...
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.
TrimError trim(const HitData ¢er_, 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.
double sublength(const int16_t startSegPt_, const int16_t endSegPt_) const
Gets the length of a subpath from one segment point to another.
ArtboardPoint midPoint() const
Gets the midpoint along a path.
void deleteSegPoints(const int16_t segPtIndex_, const int16_t count_)
Deletes a given number of segment points from a given segment point index forward.
WindingOrderType
Describes which direction the (closed) art is wound.
Definition: hdicorePathArt.h:45
WindingOrderType windingOrder() const
Gets the winding order of the path.
ArtboardSegPointVector phantomSegPoints() const
Gets the two phantom segment points.
bool isRectangular() const
Gets whether the entire path forms a rectangular shape.
void insertSegs(const int16_t segIndex_, const ArtboardSegPointVector &segPts_)
Inserts new segments into the target path at a given segment index.
void insertSegPointAtT(const int16_t segIndex_, const double t_)
"Safely" inserts a new segment point in a given segment
double area() const
Gets the area of the path.
HitDataVector getIntersections(const int16_t max_=0, const bool guides_=false) const
Gets all path segment intersections along the target path.
bool closed() const
Gets whether the target path is closed.
void setClosed(const bool closed_)
Sets whether the target path is closed.
TrimDirectionType
Describes which direction a trim should take place (to the greater, lesser, or both sides of a given ...
Definition: hdicorePathArt.h:73
ArtboardSegPointVector segPoints(const int16_t segPtIndex_, const int16_t count_) const
Gets a series of path segment points.
~PathArt()
Destructs a PathArt object.
void setSegPointCount(const int16_t count_)
Sets the count of individual segment points in the path.
int16_t segPointCount() const
Gets the count of individual segment points in the path.
void insertSegPoints(const int16_t segPtIndex_, const ArtboardSegPointVector &segPts_)
Inserts new segment points into the target path after a given segment point index.
ExtendError
Describes various errors that can occur when trimming a path.
Definition: hdicorePathArt.h:95
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.
void setStyle(const PathStyle &style_)
Sets the target path's style.
void reverseSegs()
Reverses the winding order of the segment points in the path.
Describes all styling attributes of a path.
Definition: hdicorePathStyle.h:442
Header file for geometric point manipulation on the Illustrator artboard.
Header file for path style-related classes.