summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5f83f6e)
raw | patch | inline | side by side (parent: 5f83f6e)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 31 Aug 2008 14:52:06 +0000 (14:52 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 31 Aug 2008 14:52:06 +0000 (14:52 +0000) |
src/splivarot.cpp | patch | blob | history | |
src/splivarot.h | patch | blob | history |
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 0996ca53812e2a2d9aa61520c86ea2f42faed796..b65e6c239fc55ce97f142c7e8025468ff5b24fa1 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
#include <glibmm/i18n.h>
#include "prefs-utils.h"
-#include "libnr/n-art-bpath.h"
-#include "libnr/nr-path.h"
#include "xml/repr.h"
#include "xml/repr-sorting.h"
#include <2geom/pathvector.h>
-#include <libnr/nr-matrix-fns.h>
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-matrix-translate-ops.h>
#include <libnr/nr-scale-matrix-ops.h>
-#include <libnr/n-art-bpath-2geom.h>
#include "helper/geom.h"
#include "livarot/Path.h"
return curve; // do not forget to unref the curve at some point!
}
-Path *bpath_to_Path(NArtBpath const *bpath)
-{
- Path *dest = new Path;
- dest->SetBackData(false);
- {
- int i;
- bool closed = false;
- float lastX = 0.0;
- float lastY = 0.0;
-
- for (i = 0; bpath[i].code != NR_END; i++) {
- switch (bpath[i].code) {
- case NR_LINETO:
- lastX = bpath[i].x3;
- lastY = bpath[i].y3;
- {
- NR::Point tmp(lastX, lastY);
- dest->LineTo(tmp);
- }
- break;
-
- case NR_CURVETO:
- {
- NR::Point tmp, tms, tme;
- tmp[0]=bpath[i].x3;
- tmp[1]=bpath[i].y3;
- tms[0]=3 * (bpath[i].x1 - lastX);
- tms[1]=3 * (bpath[i].y1 - lastY);
- tme[0]=3 * (bpath[i].x3 - bpath[i].x2);
- tme[1]=3 * (bpath[i].y3 - bpath[i].y2);
- dest->CubicTo(tmp,tms,tme);
- }
- lastX = bpath[i].x3;
- lastY = bpath[i].y3;
- break;
-
- case NR_MOVETO_OPEN:
- case NR_MOVETO:
- if (closed)
- dest->Close();
- closed = (bpath[i].code == NR_MOVETO);
- lastX = bpath[i].x3;
- lastY = bpath[i].y3;
- {
- NR::Point tmp(lastX, lastY);
- dest->MoveTo(tmp);
- }
- break;
- default:
- break;
- }
- }
- if (closed)
- dest->Close();
- }
- return dest;
-}
-
boost::optional<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg)
{
//get nearest position on path
diff --git a/src/splivarot.h b/src/splivarot.h
index 755beaa800d412c7880e31e2e5e9d6eb159a7bb3..a4fe588ed2b0e7eefb9c7ff8dce386e51788bc5a 100644 (file)
--- a/src/splivarot.h
+++ b/src/splivarot.h
SPCurve *curve_for_item(SPItem *item);
boost::optional<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg = 0);
NR::Point get_point_on_Path(Path *path, int piece, double t);
-Path *bpath_to_Path(NArtBpath const *bpath);
#endif