Inkscape
Vector Graphics Editor
|
Go to the source code of this file.
Functions | |
bool | is_closed (Geom::PathVector const &pathv) |
Whether all subpaths are closed. Returns false if the curve is empty. | |
size_t | node_count (Geom::PathVector const &pathv) |
returns the number of nodes in a path, used for statusbar text when selecting an spcurve. | |
Geom::Curve const * | get_last_segment (Geom::PathVector const &pathv) |
Return last pathsegment (possibly the closing path segment) of the last path in PathVector or null. | |
Geom::Curve const * | get_last_segment (Geom::Path const &)=delete |
Geom::Curve const * | get_first_segment (Geom::PathVector const &pathv) |
Return first pathsegment in PathVector or NULL. | |
Geom::Curve const * | get_first_segment (Geom::Path const &)=delete |
void | stretch_endpoints (Geom::PathVector &pathv, Geom::Point const &new_p0, Geom::Point const &new_p1) |
? | |
void | move_endpoints (Geom::PathVector &pathv, Geom::Point const &new_p0, Geom::Point const &new_p1) |
Sets start of first path to new_p0, and end of first path to new_p1. | |
void | move_endpoints (Geom::Path &pathv, Geom::Point const &new_p0, Geom::Point const &new_p1) |
void | last_point_additive_move (Geom::PathVector &pathv, Geom::Point const &p) |
Add p to the last point (and last handle if present) of the last path. | |
void | pathvector_append (Geom::PathVector &to, Geom::PathVector const &pathv, bool use_lineto=false) |
Append pathv to to. | |
bool | pathvector_append_continuous (Geom::PathVector &to, Geom::PathVector const &pathv, double tolerance=0.0625) |
Append pathv to to with possible fusing of close endpoints. | |
Geom::Path | rect_to_open_path (Geom::Rect const &rect) |
Construct an open path from a rectangle. | |
void | closepath_current (Geom::Path &path) |
Close path by setting the end point to the start point instead of adding a new lineto. | |
void | backspace (Geom::PathVector &pathv) |
Remove last segment of curve. | |
void | backspace (Geom::Path &path) |
template<typename T > | |
auto | ptr_to_opt (T const &p) |
Create a std::optional<T> from a (generalised) pointer to T. | |
Geom::Path | path_from_curve (std::unique_ptr< Geom::Curve > curve) |
Construct an open Geom::Path from Geom::Curve. Fixme: Should be in 2geom. | |
Geom::Path | path_from_curve (Geom::Curve const &curve) |
void backspace | ( | Geom::Path & | path | ) |
Definition at line 147 of file curve.cpp.
References Geom::Path::close(), Geom::Path::empty(), and Geom::Path::erase_last().
void backspace | ( | Geom::PathVector & | pathv | ) |
Remove last segment of curve.
Definition at line 139 of file curve.cpp.
References Geom::PathVector::back(), backspace(), and Geom::PathVector::empty().
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOn(), Inkscape::UI::Tools::PenTool::_bsplineSpiroMotion(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOn(), Inkscape::UI::Tools::PenTool::_finishSegment(), Inkscape::UI::Tools::PencilTool::_interpolate(), Inkscape::UI::Tools::PenTool::_lastpointToCurve(), Inkscape::UI::Tools::PenTool::_lastpointToLine(), Inkscape::UI::Tools::PenTool::_undoLastPoint(), backspace(), Inkscape::LivePathEffect::LPERoughen::doEffect(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().
void closepath_current | ( | Geom::Path & | path | ) |
Close path by setting the end point to the start point instead of adding a new lineto.
Used for freehand drawing when the user draws back to the start point.
Definition at line 37 of file curve.cpp.
References Geom::Path::back_open(), Geom::Path::close(), Geom::Path::erase_last(), Geom::Path::initialPoint(), Geom::Path::setFinal(), and Geom::Path::size().
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroBuild(), Inkscape::LivePathEffect::LPEBSpline::doBSplineFromWidget(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPERoughen::doEffect(), Inkscape::LivePathEffect::LPESimplify::generateHelperPathAndSmooth(), Inkscape::LivePathEffect::sp_bspline_do_effect(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().
|
delete |
Geom::Curve const * get_first_segment | ( | Geom::PathVector const & | pathv | ) |
Return first pathsegment in PathVector or NULL.
equal in functionality to SPCurve::first_bpath()
Definition at line 70 of file curve.cpp.
References Geom::Path::empty(), Geom::PathVector::empty(), Geom::PathVector::front(), and Geom::Path::front().
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroOn(), and Inkscape::LivePathEffect::LPERoughen::doEffect().
|
delete |
Geom::Curve const * get_last_segment | ( | Geom::PathVector const & | pathv | ) |
Return last pathsegment (possibly the closing path segment) of the last path in PathVector or null.
If the last path is empty (contains only a moveto), the function returns null.
Definition at line 62 of file curve.cpp.
References Geom::PathVector::back(), Geom::Path::back_default(), Geom::Path::empty(), and Geom::PathVector::empty().
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOn(), Inkscape::UI::Tools::PenTool::_bsplineSpiroMotion(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOn(), Inkscape::UI::Tools::PenTool::_finishSegment(), Inkscape::UI::Tools::PencilTool::_fitAndSplit(), Inkscape::UI::Tools::PencilTool::_interpolate(), Inkscape::UI::Tools::PenTool::_lastpointToCurve(), Inkscape::UI::Tools::PenTool::_lastpointToLine(), Inkscape::UI::Tools::PenTool::_redoLastPoint(), Inkscape::UI::Tools::PenTool::_redrawAll(), Inkscape::UI::Tools::PencilTool::_sketchInterpolate(), Inkscape::UI::Tools::PenTool::_undoLastPoint(), Inkscape::LivePathEffect::LPERoughen::doEffect(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().
bool is_closed | ( | Geom::PathVector const & | pathv | ) |
Whether all subpaths are closed. Returns false if the curve is empty.
Definition at line 47 of file curve.cpp.
References Geom::PathVector::empty().
Referenced by Inkscape::UI::Tools::FreehandBase::_attachSelection(), Inkscape::UI::Tools::cc_item_is_connector(), Inkscape::UI::Tools::cc_item_is_shape(), pathvector_append_continuous(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().
void last_point_additive_move | ( | Geom::PathVector & | pathv, |
Geom::Point const & | p | ||
) |
Add p to the last point (and last handle if present) of the last path.
Definition at line 227 of file curve.cpp.
References Geom::PathVector::back(), Geom::Path::back(), Geom::PathVector::empty(), Geom::Path::end(), Geom::Path::finalPoint(), Geom::Path::replace(), Geom::Path::setFinal(), and Geom::BezierCurve::setPoint().
Referenced by Inkscape::UI::Tools::PenTool::_lastpointMove().
void move_endpoints | ( | Geom::Path & | pathv, |
Geom::Point const & | new_p0, | ||
Geom::Point const & | new_p1 | ||
) |
Definition at line 195 of file curve.cpp.
References Geom::Path::setFinal(), and Geom::Path::setInitial().
void move_endpoints | ( | Geom::PathVector & | pathv, |
Geom::Point const & | new_p0, | ||
Geom::Point const & | new_p1 | ||
) |
Sets start of first path to new_p0, and end of first path to new_p1.
Definition at line 188 of file curve.cpp.
References Geom::PathVector::empty(), Geom::PathVector::front(), and move_endpoints().
Referenced by Inkscape::LivePathEffect::LPEBSpline::doBSplineFromWidget(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPERoughen::doEffect(), move_endpoints(), and Inkscape::LivePathEffect::sp_bspline_do_effect().
size_t node_count | ( | Geom::PathVector const & | pathv | ) |
returns the number of nodes in a path, used for statusbar text when selecting an spcurve.
Sum of nodes in all the paths. When a path is closed, and its closing line segment is of zero-length, this function will not count the closing knot double (so basically ignores the closing line segment when it has zero length)
Definition at line 201 of file curve.cpp.
References Geom::are_near().
Referenced by Inkscape::UI::Tools::PencilTool::_interpolate(), and SPPath::nodesInPath().
Geom::Path path_from_curve | ( | Geom::Curve const & | curve | ) |
Definition at line 251 of file curve.cpp.
References path_from_curve().
Geom::Path path_from_curve | ( | std::unique_ptr< Geom::Curve > | curve | ) |
Construct an open Geom::Path from Geom::Curve. Fixme: Should be in 2geom.
Definition at line 244 of file curve.cpp.
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroMotion(), SPHatchPath::_calculateRenderCurve(), Inkscape::UI::Tools::PencilTool::_setEndpoint(), Inkscape::ObjectSet::cloneOriginal(), path_from_curve(), SPLine::set_shape(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().
void pathvector_append | ( | Geom::PathVector & | to, |
Geom::PathVector const & | pathv, | ||
bool | use_lineto = false |
||
) |
Append pathv to to.
If use_lineto is false, simply add all paths in pathv to to; if use_lineto is true, combine to's last path and pathv's first path and add the rest of the paths in pathv to to.
Definition at line 78 of file curve.cpp.
References Geom::Path::append(), Geom::Path::appendNew(), Geom::PathVector::back(), Geom::PathVector::begin(), Geom::PathVector::empty(), Geom::PathVector::end(), and Geom::PathVector::push_back().
Referenced by SPHatchPath::_calculateRenderCurve(), Inkscape::UI::Tools::TextTool::_updateCursor(), Inkscape::ObjectSet::combine(), Inkscape::Text::Layout::convertToCurves(), Inkscape::LivePathEffect::LPERoughen::doEffect(), Inkscape::LivePathEffect::Parameter::param_higlight(), pathvector_append_continuous(), Inkscape::UI::Tools::sp_update_helperpath(), and Inkscape::UI::Tools::spdc_flush_white().
bool pathvector_append_continuous | ( | Geom::PathVector & | to, |
Geom::PathVector const & | pathv, | ||
double | tolerance = 0.0625 |
||
) |
Append pathv to to with possible fusing of close endpoints.
If the end of to and the start of pathv are within tolerance distance, then the startpoint of pathv is moved to the end of to and the first subpath of pathv is appended to the last subpath of to. When one of the curves is empty, this curves path becomes the non-empty path.
tolerance | Tolerance for endpoint fusion (applied to x and y separately) |
Definition at line 104 of file curve.cpp.
References Geom::Path::append(), Geom::PathVector::back(), Geom::PathVector::begin(), Geom::PathVector::empty(), Geom::PathVector::end(), Geom::Path::finalPoint(), Geom::PathVector::finalPoint(), Geom::PathVector::initialPoint(), is_closed(), Geom::LInfty(), pathvector_append(), Geom::PathVector::push_back(), and Geom::Path::setInitial().
Referenced by Inkscape::UI::Tools::PenTool::_bsplineSpiroBuild(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroEndAnchorOn(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOff(), Inkscape::UI::Tools::PenTool::_bsplineSpiroStartAnchorOn(), SPHatchPath::_calculateRenderCurve(), Inkscape::UI::Tools::ConnectorTool::_finishSegment(), Inkscape::UI::Tools::PenTool::_finishSegment(), Inkscape::UI::Tools::PencilTool::_fitAndSplit(), Inkscape::UI::Tools::PenTool::_lastpointToCurve(), Inkscape::UI::Tools::PenTool::_lastpointToLine(), Inkscape::LivePathEffect::LPERoughen::doEffect(), and Inkscape::UI::Tools::spdc_concat_colors_and_flush().
auto ptr_to_opt | ( | T const & | p | ) |
Create a std::optional<T> from a (generalised) pointer to T.
Definition at line 90 of file curve.h.
Referenced by Inkscape::LivePathEffect::LPECloneOriginal::cloneAttributes(), Inkscape::ObjectSet::cloneOriginalPathLPE(), curve_for_item(), curve_for_item_before_LPE(), extract_shape(), item_find_paths(), Inkscape::LivePathEffect::PathParam::linked_modified_callback(), and Inkscape::LivePathEffect::PathArrayParam::setPathVector().
Geom::Path rect_to_open_path | ( | Geom::Rect const & | rect | ) |
Construct an open path from a rectangle.
That is, with the fourth side represented by a genuine line segment, rather than the closing segment.
Construct an open path from a rectangle.
Copyright (C) 2000 Lauris Kaplinski Copyright (C) 2000-2001 Ximian, Inc. Copyright (C) 2002 Lauris Kaplinski Copyright (C) 2008 Johan Engelen
Released under GNU GPL v2+, read the file 'COPYING' for more information.
Definition at line 22 of file curve.cpp.
References Geom::GenericRect< C >::corner().
Referenced by Inkscape::ObjectSnapper::_getPathvFromRect(), and sp_image_set_curve().
void stretch_endpoints | ( | Geom::PathVector & | pathv, |
Geom::Point const & | new_p0, | ||
Geom::Point const & | new_p1 | ||
) |
?
?
Definition at line 164 of file curve.cpp.
References Geom::arcLengthSb(), Geom::PathVector::empty(), Geom::PathVector::finalPoint(), Geom::PathVector::front(), Geom::PathVector::initialPoint(), Geom::Piecewise< T >::lastValue(), Geom::path_from_piecewise(), Geom::sectionize(), and Geom::Path::toPwSb().
Referenced by Inkscape::UI::Tools::ConnectorTool::_handleMotionNotify().