summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
commit945ce419c806c73d70203dec33ececafbe108a92 (patch)
treecfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/live_effects
parentMerge from trunk (again) (diff)
parentExtensions. SVG+media fix (see Bug #400356). (diff)
downloadinkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz
inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/effect.cpp22
-rw-r--r--src/live_effects/effect.h4
-rw-r--r--src/live_effects/lpe-bendpath.cpp6
-rw-r--r--src/live_effects/lpe-constructgrid.cpp4
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp4
-rw-r--r--src/live_effects/lpe-curvestitch.cpp24
-rw-r--r--src/live_effects/lpe-curvestitch.h2
-rw-r--r--src/live_effects/lpe-dynastroke.cpp10
-rw-r--r--src/live_effects/lpe-envelope.cpp4
-rw-r--r--src/live_effects/lpe-gears.cpp4
-rw-r--r--src/live_effects/lpe-interpolate.cpp4
-rw-r--r--src/live_effects/lpe-knot.cpp14
-rw-r--r--src/live_effects/lpe-line_segment.cpp2
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp12
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp18
-rw-r--r--src/live_effects/lpe-patternalongpath.h2
-rw-r--r--src/live_effects/lpe-powerstroke.cpp167
-rw-r--r--src/live_effects/lpe-powerstroke.h2
-rw-r--r--src/live_effects/lpe-rough-hatches.cpp8
-rw-r--r--src/live_effects/lpe-ruler.cpp12
-rw-r--r--src/live_effects/lpe-sketch.cpp2
-rw-r--r--src/live_effects/lpe-spiro.cpp2
-rw-r--r--src/live_effects/lpe-vonkoch.cpp36
-rw-r--r--src/live_effects/lpegroupbbox.cpp2
-rw-r--r--src/live_effects/lpeobject-reference.cpp4
-rw-r--r--src/live_effects/lpeobject-reference.h1
-rw-r--r--src/live_effects/lpeobject.cpp12
-rw-r--r--src/live_effects/parameter/parameter.h2
-rw-r--r--src/live_effects/parameter/path-reference.h1
-rw-r--r--src/live_effects/parameter/path.cpp2
-rw-r--r--src/live_effects/parameter/path.h3
-rw-r--r--src/live_effects/parameter/point.cpp4
-rw-r--r--src/live_effects/parameter/point.h2
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp4
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.h2
-rw-r--r--src/live_effects/parameter/vector.cpp4
-rw-r--r--src/live_effects/parameter/vector.h2
37 files changed, 284 insertions, 126 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 3ea57de23..ed0d162ac 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -38,7 +38,7 @@
#include <exception>
#include <2geom/sbasis-to-bezier.h>
-#include <2geom/matrix.h>
+#include <2geom/affine.h>
#include <2geom/pathvector.h>
// include effects:
@@ -249,7 +249,7 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj)
}
if (neweffect) {
- neweffect->readallParameters(SP_OBJECT_REPR(lpeobj));
+ neweffect->readallParameters(lpeobj->getRepr());
}
return neweffect;
@@ -262,7 +262,7 @@ void Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item)
Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");
repr->setAttribute("effect", name);
- SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc))->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute
+ SP_DOCUMENT_DEFS(doc)->getRepr()->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute
const gchar * repr_id = repr->attribute("id");
Inkscape::GC::release(repr);
@@ -579,17 +579,17 @@ Effect::newWidget(Gtk::Tooltips * tooltips)
}
-Inkscape::XML::Node *
-Effect::getRepr()
+Inkscape::XML::Node *Effect::getRepr()
{
- return SP_OBJECT_REPR(lpeobj);
+ return lpeobj->getRepr();
}
-SPDocument *
-Effect::getSPDoc()
+SPDocument *Effect::getSPDoc()
{
- if (SP_OBJECT_DOCUMENT(lpeobj) == NULL) g_message("Effect::getSPDoc() returns NULL");
- return SP_OBJECT_DOCUMENT(lpeobj);
+ if (lpeobj->document == NULL) {
+ g_message("Effect::getSPDoc() returns NULL");
+ }
+ return lpeobj->document;
}
Parameter *
@@ -668,7 +668,7 @@ Effect::resetDefaults(SPItem * /*item*/)
}
void
-Effect::transform_multiply(Geom::Matrix const& postmul, bool set)
+Effect::transform_multiply(Geom::Affine const& postmul, bool set)
{
// cycle through all parameters. Most parameters will not need transformation, but path and point params do.
for (std::vector<Parameter *>::iterator it = param_vector.begin(); it != param_vector.end(); it++) {
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 681bae387..7fe4e9348 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -10,7 +10,6 @@
*/
-#include "display/display-forward.h"
#include <map>
#include <glibmm/ustring.h>
#include <2geom/forward.h>
@@ -29,6 +28,7 @@ class SPLPEItem;
class KnotHolder;
class KnotHolderEntity;
class SPPath;
+struct SPCurve;
namespace Gtk {
class Widget;
@@ -92,7 +92,7 @@ public:
virtual void resetDefaults(SPItem * item);
/// /todo: is this method really necessary? it causes UI inconsistensies... (johan)
- virtual void transform_multiply(Geom::Matrix const& postmul, bool set);
+ virtual void transform_multiply(Geom::Affine const& postmul, bool set);
// /TODO: providesKnotholder() is currently used as an indicator of whether a nodepath is
// created for an item or not. When we allow both at the same time, this needs rethinking!
diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp
index 254500908..2d6bbeb22 100644
--- a/src/live_effects/lpe-bendpath.cpp
+++ b/src/live_effects/lpe-bendpath.cpp
@@ -53,9 +53,9 @@ namespace LivePathEffect {
LPEBendPath::LPEBendPath(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
bend_path(_("Bend path:"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),
- prop_scale(_("Width:"), _("Width of the path"), "prop_scale", &wr, this, 1),
- scale_y_rel(_("Width in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false),
- vertical_pattern(_("Original path is vertical"), _("Rotates the original 90 degrees, before bending it along the bend path"), "vertical", &wr, this, false)
+ prop_scale(_("_Width:"), _("Width of the path"), "prop_scale", &wr, this, 1),
+ scale_y_rel(_("W_idth in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false),
+ vertical_pattern(_("_Original path is vertical"), _("Rotates the original 90 degrees, before bending it along the bend path"), "vertical", &wr, this, false)
{
registerParameter( dynamic_cast<Parameter *>(&bend_path) );
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );
diff --git a/src/live_effects/lpe-constructgrid.cpp b/src/live_effects/lpe-constructgrid.cpp
index aee4c127a..cb9c031aa 100644
--- a/src/live_effects/lpe-constructgrid.cpp
+++ b/src/live_effects/lpe-constructgrid.cpp
@@ -23,8 +23,8 @@ using namespace Geom;
LPEConstructGrid::LPEConstructGrid(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- nr_x(_("Size X:"), _("The size of the grid in X direction."), "nr_x", &wr, this, 5),
- nr_y(_("Size Y:"), _("The size of the grid in Y direction."), "nr_y", &wr, this, 5)
+ nr_x(_("Size _X:"), _("The size of the grid in X direction."), "nr_x", &wr, this, 5),
+ nr_y(_("Size _Y:"), _("The size of the grid in Y direction."), "nr_y", &wr, this, 5)
{
registerParameter( dynamic_cast<Parameter *>(&nr_x) );
registerParameter( dynamic_cast<Parameter *>(&nr_y) );
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index dac34c5d4..38869cb97 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -101,12 +101,12 @@ LPECopyRotate::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p
Piecewise<D2<SBasis> > output;
- Matrix pre = Translate(-origin) * Rotate(-deg_to_rad(starting_angle));
+ Affine pre = Translate(-origin) * Rotate(-deg_to_rad(starting_angle));
for (int i = 0; i < num_copies; ++i) {
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
Rotate rot(-deg_to_rad(rotation_angle * i));
- Matrix t = pre * rot * Translate(origin);
+ Affine t = pre * rot * Translate(origin);
output.concat(pwd2_in * t);
}
diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp
index 9e9488ce5..a002901b2 100644
--- a/src/live_effects/lpe-curvestitch.cpp
+++ b/src/live_effects/lpe-curvestitch.cpp
@@ -27,7 +27,7 @@
#include <2geom/bezier-to-sbasis.h>
#include <2geom/sbasis-to-bezier.h>
#include <2geom/d2.h>
-#include <2geom/matrix.h>
+#include <2geom/affine.h>
#include "ui/widget/scalar.h"
#include "libnr/nr-values.h"
@@ -40,13 +40,13 @@ using namespace Geom;
LPECurveStitch::LPECurveStitch(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
strokepath(_("Stitch path:"), _("The path that will be used as stitch."), "strokepath", &wr, this, "M0,0 L1,0"),
- nrofpaths(_("Number of paths:"), _("The number of paths that will be generated."), "count", &wr, this, 5),
- startpoint_edge_variation(_("Start edge variance:"), _("The amount of random jitter to move the start points of the stitches inside & outside the guide path"), "startpoint_edge_variation", &wr, this, 0),
- startpoint_spacing_variation(_("Start spacing variance:"), _("The amount of random shifting to move the start points of the stitches back & forth along the guide path"), "startpoint_spacing_variation", &wr, this, 0),
- endpoint_edge_variation(_("End edge variance:"), _("The amount of randomness that moves the end points of the stitches inside & outside the guide path"), "endpoint_edge_variation", &wr, this, 0),
- endpoint_spacing_variation(_("End spacing variance:"), _("The amount of random shifting to move the end points of the stitches back & forth along the guide path"), "endpoint_spacing_variation", &wr, this, 0),
- prop_scale(_("Scale width:"), _("Scale the width of the stitch path"), "prop_scale", &wr, this, 1),
- scale_y_rel(_("Scale width relative to length"), _("Scale the width of the stitch path relative to its length"), "scale_y_rel", &wr, this, false)
+ nrofpaths(_("N_umber of paths:"), _("The number of paths that will be generated."), "count", &wr, this, 5),
+ startpoint_edge_variation(_("Sta_rt edge variance:"), _("The amount of random jitter to move the start points of the stitches inside & outside the guide path"), "startpoint_edge_variation", &wr, this, 0),
+ startpoint_spacing_variation(_("Sta_rt spacing variance:"), _("The amount of random shifting to move the start points of the stitches back & forth along the guide path"), "startpoint_spacing_variation", &wr, this, 0),
+ endpoint_edge_variation(_("End ed_ge variance:"), _("The amount of randomness that moves the end points of the stitches inside & outside the guide path"), "endpoint_edge_variation", &wr, this, 0),
+ endpoint_spacing_variation(_("End spa_cing variance:"), _("The amount of random shifting to move the end points of the stitches back & forth along the guide path"), "endpoint_spacing_variation", &wr, this, 0),
+ prop_scale(_("Scale _width:"), _("Scale the width of the stitch path"), "prop_scale", &wr, this, 1),
+ scale_y_rel(_("Scale _width relative to length"), _("Scale the width of the stitch path relative to its length"), "scale_y_rel", &wr, this, false)
{
registerParameter( dynamic_cast<Parameter *>(&nrofpaths) );
registerParameter( dynamic_cast<Parameter *>(&startpoint_edge_variation) );
@@ -120,7 +120,7 @@ LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
scaling_y = prop_scale;
}
- Matrix transform;
+ Affine transform;
transform.setXAxis( (end-start) / scaling );
transform.setYAxis( rot90(unit_vector(end-start)) * scaling_y);
transform.setTranslation( start );
@@ -163,7 +163,7 @@ LPECurveStitch::resetDefaults(SPItem * item)
// calculate bounding box: (isn't there a simpler way?)
Piecewise<D2<SBasis> > pwd2;
- std::vector<Geom::Path> temppath = sp_svg_read_pathv( SP_OBJECT_REPR(item)->attribute("inkscape:original-d"));
+ std::vector<Geom::Path> temppath = sp_svg_read_pathv( item->getRepr()->attribute("inkscape:original-d"));
for (unsigned int i=0; i < temppath.size(); i++) {
pwd2.concat( temppath[i].toPwSb() );
}
@@ -195,7 +195,7 @@ LPECurveStitch::resetDefaults(SPItem * item)
* special casing is probably needed, because rotation should not be propagated to the strokepath.
*/
void
-LPECurveStitch::transform_multiply(Geom::Matrix const& postmul, bool set)
+LPECurveStitch::transform_multiply(Geom::Affine const& postmul, bool set)
{
// only take translations into account
if (postmul.isTranslation()) {
@@ -203,7 +203,7 @@ LPECurveStitch::transform_multiply(Geom::Matrix const& postmul, bool set)
} else if (!scale_y_rel.get_value()) {
// this basically means that for this transformation, the result should be the same as normal scaling the result path
// don't know how to do this yet.
-// Geom::Matrix new_postmul;
+// Geom::Affine new_postmul;
//new_postmul.setIdentity();
// new_postmul.setTranslation(postmul.translation());
// Effect::transform_multiply(new_postmul, set);
diff --git a/src/live_effects/lpe-curvestitch.h b/src/live_effects/lpe-curvestitch.h
index 8a8e43f2c..f46f2a5d2 100644
--- a/src/live_effects/lpe-curvestitch.h
+++ b/src/live_effects/lpe-curvestitch.h
@@ -32,7 +32,7 @@ public:
virtual void resetDefaults(SPItem * item);
- virtual void transform_multiply(Geom::Matrix const& postmul, bool set);
+ virtual void transform_multiply(Geom::Affine const& postmul, bool set);
private:
PathParam strokepath;
diff --git a/src/live_effects/lpe-dynastroke.cpp b/src/live_effects/lpe-dynastroke.cpp
index a9f9202e9..0fd31dccf 100644
--- a/src/live_effects/lpe-dynastroke.cpp
+++ b/src/live_effects/lpe-dynastroke.cpp
@@ -166,12 +166,12 @@ LPEDynastroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p
std::cout<<"ellptic pen\n";
//FIXME: roundness=0???
double c = cos(angle_rad), s = sin(angle_rad);
- Matrix rot,slant;
- rot = Matrix(c, -s, s, c, 0, 0 );
- slant = Matrix(double(width)*roundness, 0, 0, double(width), 0, 0 );
+ Affine rot,slant;
+ rot = Affine(c, -s, s, c, 0, 0 );
+ slant = Affine(double(width)*roundness, 0, 0, double(width), 0, 0 );
Piecewise<D2<SBasis> > nn = unitVector(v * ( rot * slant ) );
- slant = Matrix( 0,-roundness, 1, 0, 0, 0 );
- rot = Matrix(-s, -c, c, -s, 0, 0 );
+ slant = Affine( 0,-roundness, 1, 0, 0, 0 );
+ rot = Affine(-s, -c, c, -s, 0, 0 );
nn = nn * (slant * rot );
n1 = nn*double(width);
diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp
index bd1cc5861..49f294498 100644
--- a/src/live_effects/lpe-envelope.cpp
+++ b/src/live_effects/lpe-envelope.cpp
@@ -34,8 +34,8 @@ LPEEnvelope::LPEEnvelope(LivePathEffectObject *lpeobject) :
bend_path2(_("Right bend path:"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"),
bend_path3(_("Bottom bend path:"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"),
bend_path4(_("Left bend path:"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"),
- xx(_("Enable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true),
- yy(_("Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true)
+ xx(_("E_nable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true),
+ yy(_("_Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true)
{
registerParameter( dynamic_cast<Parameter *>(&yy) );
registerParameter( dynamic_cast<Parameter *>(&xx) );
diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp
index c9bbde8f2..337beb516 100644
--- a/src/live_effects/lpe-gears.cpp
+++ b/src/live_effects/lpe-gears.cpp
@@ -209,8 +209,8 @@ namespace LivePathEffect {
LPEGears::LPEGears(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- teeth(_("Teeth:"), _("The number of teeth"), "teeth", &wr, this, 10),
- phi(_("Phi:"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5)
+ teeth(_("_Teeth:"), _("The number of teeth"), "teeth", &wr, this, 10),
+ phi(_("_Phi:"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5)
{
/* Tooth pressure angle: The angle between the tooth profile and a perpendicular to the pitch
* circle, usually at the point where the pitch circle meets the tooth profile. Standard angles
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index a4546726f..621823546 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -28,8 +28,8 @@ namespace LivePathEffect {
LPEInterpolate::LPEInterpolate(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
trajectory_path(_("Trajectory:"), _("Path along which intermediate steps are created."), "trajectory", &wr, this, "M0,0 L0,0"),
- number_of_steps(_("Steps:"), _("Determines the number of steps from start to end path."), "steps", &wr, this, 5),
- equidistant_spacing(_("Equidistant spacing"), _("If true, the spacing between intermediates is constant along the length of the path. If false, the distance depends on the location of the nodes of the trajectory path."), "equidistant_spacing", &wr, this, true)
+ number_of_steps(_("Steps_:"), _("Determines the number of steps from start to end path."), "steps", &wr, this, 5),
+ equidistant_spacing(_("E_quidistant spacing"), _("If true, the spacing between intermediates is constant along the length of the path. If false, the distance depends on the location of the nodes of the trajectory path."), "equidistant_spacing", &wr, this, true)
{
show_orig_path = true;
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index fef4e1f87..522b3cdc6 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -95,7 +95,7 @@ findShadowedTime(Geom::Path const &patha, std::vector<Geom::Point> const &pt_and
Point N = T.cw();
Point A = pt_and_dir[0]-3*width*T, B = A+6*width*T;
- Matrix mat = from_basis( T, N, pt_and_dir[0] );
+ Affine mat = from_basis( T, N, pt_and_dir[0] );
mat = mat.inverse();
Path p = patha * mat;
@@ -340,11 +340,11 @@ CrossingPoints::inherit_signs(CrossingPoints const &other, int default_value)
LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
// initialise your parameters here:
- interruption_width(_("Fixed width:"), _("Size of hidden region of lower string"), "interruption_width", &wr, this, 3),
- prop_to_stroke_width(_("In units of stroke width"), _("Consider 'Interruption width' as a ratio of stroke width"), "prop_to_stroke_width", &wr, this, true),
- add_stroke_width(_("Stroke width"), _("Add the stroke width to the interruption size"), "add_stroke_width", &wr, this, true),
- add_other_stroke_width(_("Crossing path stroke width"), _("Add crossed stroke width to the interruption size"), "add_other_stroke_width", &wr, this, true),
- switcher_size(_("Switcher size:"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15),
+ interruption_width(_("Fi_xed width:"), _("Size of hidden region of lower string"), "interruption_width", &wr, this, 3),
+ prop_to_stroke_width(_("_In units of stroke width"), _("Consider 'Interruption width' as a ratio of stroke width"), "prop_to_stroke_width", &wr, this, true),
+ add_stroke_width(_("St_roke width"), _("Add the stroke width to the interruption size"), "add_stroke_width", &wr, this, true),
+ add_other_stroke_width(_("_Crossing path stroke width"), _("Add crossed stroke width to the interruption size"), "add_other_stroke_width", &wr, this, true),
+ switcher_size(_("S_witcher size:"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15),
crossing_points_vector(_("Crossing Signs"), _("Crossings signs"), "crossing_points_vector", &wr, this),
gpaths(),gstroke_widths()
{
@@ -611,7 +611,7 @@ LPEKnot::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVecto
svgd = "M 10,0 C 10,5.52 5.52,10 0,10 -5.52,10 -10,5.52 -10,0 c 0,-5.52 4.48,-10 10,-10 5.52,0 10,4.48 10,10 z";
}
PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Matrix(r,0,0,r,0,0);
+ pathv *= Affine(r,0,0,r,0,0);
pathv+=switcher;
hp_vec.push_back(pathv);
}
diff --git a/src/live_effects/lpe-line_segment.cpp b/src/live_effects/lpe-line_segment.cpp
index df5619002..da30cd32c 100644
--- a/src/live_effects/lpe-line_segment.cpp
+++ b/src/live_effects/lpe-line_segment.cpp
@@ -47,7 +47,7 @@ LPELineSegment::~LPELineSegment()
void
LPELineSegment::doBeforeEffect (SPLPEItem *lpeitem)
{
- lpetool_get_limiting_bbox_corners(SP_OBJECT_DOCUMENT(lpeitem), bboxA, bboxB);
+ lpetool_get_limiting_bbox_corners(lpeitem->document, bboxA, bboxB);
}
std::vector<Geom::Path>
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 1af2ed6ca..dec8c9216 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -20,7 +20,7 @@
#include <2geom/path.h>
#include <2geom/transforms.h>
-#include <2geom/matrix.h>
+#include <2geom/affine.h>
namespace Inkscape {
namespace LivePathEffect {
@@ -46,7 +46,7 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem)
using namespace Geom;
SPItem *item = SP_ITEM(lpeitem);
- Geom::Matrix t = item->i2d_affine();
+ Geom::Affine t = item->i2d_affine();
Geom::Rect bbox = *item->getBounds(t); // fixme: what happens if getBounds does not return a valid rect?
Point A(bbox.left(), bbox.bottom());
@@ -74,15 +74,15 @@ LPEMirrorSymmetry::doEffect_path (std::vector<Geom::Path> const & path_in)
Geom::Point A(mline.front().initialPoint());
Geom::Point B(mline.back().finalPoint());
- Geom::Matrix m1(1.0, 0.0, 0.0, 1.0, A[0], A[1]);
+ Geom::Affine m1(1.0, 0.0, 0.0, 1.0, A[0], A[1]);
double hyp = Geom::distance(A, B);
double c = (B[0] - A[0]) / hyp; // cos(alpha)
double s = (B[1] - A[1]) / hyp; // sin(alpha)
- Geom::Matrix m2(c, -s, s, c, 0.0, 0.0);
- Geom::Matrix sca(1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
+ Geom::Affine m2(c, -s, s, c, 0.0, 0.0);
+ Geom::Affine sca(1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
- Geom::Matrix m = m1.inverse() * m2;
+ Geom::Affine m = m1.inverse() * m2;
m = m * sca;
m = m * m2.inverse();
m = m * m1;
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp
index d00dc11db..0a05228d2 100644
--- a/src/live_effects/lpe-patternalongpath.cpp
+++ b/src/live_effects/lpe-patternalongpath.cpp
@@ -61,22 +61,22 @@ LPEPatternAlongPath::LPEPatternAlongPath(LivePathEffectObject *lpeobject) :
pattern(_("Pattern source:"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"),
copytype(_("Pattern copies:"), _("How many pattern copies to place along the skeleton path"),
"copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),
- prop_scale(_("Width:"), _("Width of the pattern"), "prop_scale", &wr, this, 1),
- scale_y_rel(_("Width in units of length"),
+ prop_scale(_("_Width:"), _("Width of the pattern"), "prop_scale", &wr, this, 1),
+ scale_y_rel(_("Wid_th in units of length"),
_("Scale the width of the pattern in units of its length"),
"scale_y_rel", &wr, this, false),
- spacing(_("Spacing:"),
+ spacing(_("Spa_cing:"),
// xgettext:no-c-format
_("Space between copies of the pattern. Negative values allowed, but are limited to -90% of pattern width."),
"spacing", &wr, this, 0),
- normal_offset(_("Normal offset:"), "", "normal_offset", &wr, this, 0),
- tang_offset(_("Tangential offset:"), "", "tang_offset", &wr, this, 0),
- prop_units(_("Offsets in unit of pattern size"),
+ normal_offset(_("No_rmal offset:"), "", "normal_offset", &wr, this, 0),
+ tang_offset(_("Tan_gential offset:"), "", "tang_offset", &wr, this, 0),
+ prop_units(_("Offsets in _unit of pattern size"),
_("Spacing, tangential and normal offset are expressed as a ratio of width/height"),
"prop_units", &wr, this, false),
- vertical_pattern(_("Pattern is vertical"), _("Rotate pattern 90 deg before applying"),
+ vertical_pattern(_("Pattern is _vertical"), _("Rotate pattern 90 deg before applying"),
"vertical_pattern", &wr, this, false),
- fuse_tolerance(_("Fuse nearby ends:"), _("Fuse ends closer than this number. 0 means don't fuse."),
+ fuse_tolerance(_("_Fuse nearby ends:"), _("Fuse ends closer than this number. 0 means don't fuse."),
"fuse_tolerance", &wr, this, 0)
{
registerParameter( dynamic_cast<Parameter *>(&pattern) );
@@ -230,7 +230,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
}
void
-LPEPatternAlongPath::transform_multiply(Geom::Matrix const& postmul, bool set)
+LPEPatternAlongPath::transform_multiply(Geom::Affine const& postmul, bool set)
{
// overriding the Effect class default method, disabling transform forwarding to the parameters.
diff --git a/src/live_effects/lpe-patternalongpath.h b/src/live_effects/lpe-patternalongpath.h
index 1c02f2c08..f48281090 100644
--- a/src/live_effects/lpe-patternalongpath.h
+++ b/src/live_effects/lpe-patternalongpath.h
@@ -32,7 +32,7 @@ public:
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- virtual void transform_multiply(Geom::Matrix const& postmul, bool set);
+ virtual void transform_multiply(Geom::Affine const& postmul, bool set);
PathParam pattern;
private:
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 5dc170e84..82f4ccdea 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -21,18 +21,31 @@
#include <2geom/transforms.h>
#include <2geom/bezier-utils.h>
+#include "live_effects/bezctx.h"
+#include "live_effects/bezctx_intf.h"
+#include "live_effects/spiro.h"
+
/// @TODO Move this to 2geom
namespace Geom {
namespace Interpolate {
+enum InterpolatorType {
+ INTERP_LINEAR,
+ INTERP_CUBICBEZIER,
+ INTERP_CUBICBEZIER_JOHAN,
+ INTERP_SPIRO
+};
+
class Interpolator {
public:
Interpolator() {};
virtual ~Interpolator() {};
+ static Interpolator* create(InterpolatorType type);
+
// virtual Piecewise<D2<SBasis> > interpolateToPwD2Sb(std::vector<Point> points) = 0;
- virtual Path interpolateToPath(std::vector<Point> points) = 0;
+ virtual Geom::Path interpolateToPath(std::vector<Point> points) = 0;
private:
Interpolator(const Interpolator&);
@@ -120,16 +133,153 @@ private:
CubicBezierJohan& operator=(const CubicBezierJohan&);
};
+
+#define SPIRO_SHOW_INFINITE_COORDINATE_CALLS
+class SpiroInterpolator : public Interpolator {
+public:
+ SpiroInterpolator() {};
+ virtual ~SpiroInterpolator() {};
+
+ virtual Path interpolateToPath(std::vector<Point> points) {
+ Path fit;
+
+ Coord scale_y = 100.;
+
+ guint len = points.size();
+ bezctx *bc = new_bezctx_ink(&fit);
+ spiro_cp *controlpoints = g_new (spiro_cp, len);
+ for (unsigned int i = 0; i < len; ++i) {
+ controlpoints[i].x = points[i][X];
+ controlpoints[i].y = points[i][Y] / scale_y;
+ controlpoints[i].ty = 'c';
+ }
+ controlpoints[0].ty = '{';
+ controlpoints[1].ty = 'v';
+ controlpoints[len-2].ty = 'v';
+ controlpoints[len-1].ty = '}';
+
+ spiro_seg *s = run_spiro(controlpoints, len);
+ spiro_to_bpath(s, len, bc);
+ free(s);
+ free(bc);
+
+ fit *= Scale(1,scale_y);
+ return fit;
+ };
+
+private:
+ typedef struct {
+ bezctx base;
+ Path *path;
+ int is_open;
+ } bezctx_ink;
+
+ static void bezctx_ink_moveto(bezctx *bc, double x, double y, int /*is_open*/)
+ {
+ bezctx_ink *bi = (bezctx_ink *) bc;
+ if ( IS_FINITE(x) && IS_FINITE(y) ) {
+ bi->path->start(Point(x, y));
+ }
+ #ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS
+ else {
+ g_message("spiro moveto not finite");
+ }
+ #endif
+ }
+
+ static void bezctx_ink_lineto(bezctx *bc, double x, double y)
+ {
+ bezctx_ink *bi = (bezctx_ink *) bc;
+ if ( IS_FINITE(x) && IS_FINITE(y) ) {
+ bi->path->appendNew<LineSegment>( Point(x, y) );
+ }
+ #ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS
+ else {
+ g_message("spiro lineto not finite");
+ }
+ #endif
+ }
+
+ static void bezctx_ink_quadto(bezctx *bc, double xm, double ym, double x3, double y3)
+ {
+ bezctx_ink *bi = (bezctx_ink *) bc;
+
+ if ( IS_FINITE(xm) && IS_FINITE(ym) && IS_FINITE(x3) && IS_FINITE(y3) ) {
+ bi->path->appendNew<QuadraticBezier>(Point(xm, ym), Point(x3, y3));
+ }
+ #ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS
+ else {
+ g_message("spiro quadto not finite");
+ }
+ #endif
+ }
+
+ static void bezctx_ink_curveto(bezctx *bc, double x1, double y1, double x2, double y2,
+ double x3, double y3)
+ {
+ bezctx_ink *bi = (bezctx_ink *) bc;
+ if ( IS_FINITE(x1) && IS_FINITE(y1) && IS_FINITE(x2) && IS_FINITE(y2) ) {
+ bi->path->appendNew<CubicBezier>(Point(x1, y1), Point(x2, y2), Point(x3, y3));
+ }
+ #ifdef SPIRO_SHOW_INFINITE_COORDINATE_CALLS
+ else {
+ g_message("spiro curveto not finite");
+ }
+ #endif
+ }
+
+ bezctx *
+ new_bezctx_ink(Geom::Path *path) {
+ bezctx_ink *result = g_new(bezctx_ink, 1);
+ result->base.moveto = bezctx_ink_moveto;
+ result->base.lineto = bezctx_ink_lineto;
+ result->base.quadto = bezctx_ink_quadto;
+ result->base.curveto = bezctx_ink_curveto;
+ result->base.mark_knot = NULL;
+ result->path = path;
+ return &result->base;
+ }
+
+ SpiroInterpolator(const SpiroInterpolator&);
+ SpiroInterpolator& operator=(const SpiroInterpolator&);
+};
+
+
+Interpolator*
+Interpolator::create(InterpolatorType type) {
+ switch (type) {
+ case INTERP_LINEAR:
+ return new Geom::Interpolate::Linear();
+ case INTERP_CUBICBEZIER:
+ return new Geom::Interpolate::CubicBezierFit();
+ case INTERP_CUBICBEZIER_JOHAN:
+ return new Geom::Interpolate::CubicBezierJohan();
+ case INTERP_SPIRO:
+ return new Geom::Interpolate::SpiroInterpolator();
+ default:
+ return new Geom::Interpolate::Linear();
+ }
+}
+
} //namespace Interpolate
} //namespace Geom
namespace Inkscape {
namespace LivePathEffect {
+static const Util::EnumData<unsigned> InterpolatorTypeData[] = {
+ {Geom::Interpolate::INTERP_LINEAR , N_("Linear"), "Linear"},
+ {Geom::Interpolate::INTERP_CUBICBEZIER , N_("CubicBezierFit"), "CubicBezierFit"},
+ {Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN , N_("CubicBezierJohan"), "CubicBezierJohan"},
+ {Geom::Interpolate::INTERP_SPIRO , N_("SpiroInterpolator"), "SpiroInterpolator"}
+};
+static const Util::EnumDataConverter<unsigned> InterpolatorTypeConverter(InterpolatorTypeData, sizeof(InterpolatorTypeData)/sizeof(*InterpolatorTypeData));
+
LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
offset_points(_("Offset points"), _("Offset points"), "offset_points", &wr, this),
- sort_points(_("Sort points"), _("Sort offset points according to their time value along the curve."), "sort_points", &wr, this, true)
+ sort_points(_("Sort points"), _("Sort offset points according to their time value along the curve."), "sort_points", &wr, this, true),
+ interpolator_type(_("Interpolator type"), _("Determines which kind of interpolator will be used to interpolate between stroke width along the path."), "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN)
{
show_orig_path = true;
@@ -137,6 +287,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) :
registerParameter( dynamic_cast<Parameter *>(&offset_points) );
registerParameter( dynamic_cast<Parameter *>(&sort_points) );
+ registerParameter( dynamic_cast<Parameter *>(&interpolator_type) );
}
LPEPowerStroke::~LPEPowerStroke()
@@ -195,9 +346,10 @@ LPEPowerStroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
}
// create stroke path where points (x,y) := (t, offset)
- Geom::Interpolate::CubicBezierJohan interpolator;
- Path strokepath = interpolator.interpolateToPath(ts);
- Path mirroredpath = strokepath.reverse() * Geom::Scale(1,-1);
+ Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(static_cast<Geom::Interpolate::InterpolatorType>(interpolator_type.get_value()));
+ Geom::Path strokepath = interpolator->interpolateToPath(ts);
+ Geom::Path mirroredpath = strokepath.reverse() * Geom::Scale(1,-1);
+ delete interpolator;
strokepath.append(mirroredpath, Geom::Path::STITCH_DISCONTINUOUS);
strokepath.close();
@@ -221,8 +373,9 @@ LPEPowerStroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
ts.insert(ts.begin(), last_point - Point(pwd2_in.domain().extent() ,0));
ts.push_back( first_point + Point(pwd2_in.domain().extent() ,0) );
// create stroke path where points (x,y) := (t, offset)
- Geom::Interpolate::CubicBezierJohan interpolator;
- Path strokepath = interpolator.interpolateToPath(ts);
+ Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(static_cast<Geom::Interpolate::InterpolatorType>(interpolator_type.get_value()));
+ Geom::Path strokepath = interpolator->interpolateToPath(ts);
+ delete interpolator;
// output 2 separate paths
D2<Piecewise<SBasis> > patternd2 = make_cuts_independent(strokepath.toPwSb());
diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h
index 667c94f53..7a1f3829a 100644
--- a/src/live_effects/lpe-powerstroke.h
+++ b/src/live_effects/lpe-powerstroke.h
@@ -15,6 +15,7 @@
#include "live_effects/effect.h"
#include "live_effects/parameter/bool.h"
#include "live_effects/parameter/powerstrokepointarray.h"
+#include "live_effects/parameter/enum.h"
namespace Inkscape {
namespace LivePathEffect {
@@ -31,6 +32,7 @@ public:
private:
PowerStrokePointArrayParam offset_points;
BoolParam sort_points;
+ EnumParam<unsigned> interpolator_type;
LPEPowerStroke(const LPEPowerStroke&);
LPEPowerStroke& operator=(const LPEPowerStroke&);
diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp
index 7d5b6c238..671d88a8b 100644
--- a/src/live_effects/lpe-rough-hatches.cpp
+++ b/src/live_effects/lpe-rough-hatches.cpp
@@ -28,7 +28,7 @@
#include <2geom/bezier-to-sbasis.h>
#include <2geom/sbasis-to-bezier.h>
#include <2geom/d2.h>
-#include <2geom/matrix.h>
+#include <2geom/affine.h>
#include "ui/widget/scalar.h"
#include "libnr/nr-values.h"
@@ -309,12 +309,12 @@ LPERoughHatches::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
}
Point transformed_org = direction.getOrigin();
Piecewise<SBasis> tilter;//used to bend the hatches
- Matrix bend_mat;//used to bend the hatches
+ Affine bend_mat;//used to bend the hatches
if (do_bend.get_value()){
Point bend_dir = -rot90(unit_vector(bender.getVector()));
double bend_amount = L2(bender.getVector());
- bend_mat = Matrix(-bend_dir[Y], bend_dir[X], bend_dir[X], bend_dir[Y],0,0);
+ bend_mat = Affine(-bend_dir[Y], bend_dir[X], bend_dir[X], bend_dir[Y],0,0);
transformed_pwd2_in = transformed_pwd2_in * bend_mat;
tilter = Piecewise<SBasis>(shift(Linear(-bend_amount),1));
OptRect bbox = bounds_exact( transformed_pwd2_in );
@@ -325,7 +325,7 @@ LPERoughHatches::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
}
hatch_dist = Geom::L2(direction.getVector())/5;
Point hatches_dir = rot90(unit_vector(direction.getVector()));
- Matrix mat(-hatches_dir[Y], hatches_dir[X], hatches_dir[X], hatches_dir[Y],0,0);
+ Affine mat(-hatches_dir[Y], hatches_dir[X], hatches_dir[X], hatches_dir[Y],0,0);
transformed_pwd2_in = transformed_pwd2_in * mat;
transformed_org *= mat;
diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp
index e51b03d15..d7a393197 100644
--- a/src/live_effects/lpe-ruler.cpp
+++ b/src/live_effects/lpe-ruler.cpp
@@ -40,14 +40,14 @@ static const Util::EnumDataConverter<BorderMarkType> BorderMarkTypeConverter(Bor
LPERuler::LPERuler(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- mark_distance(_("Mark distance:"), _("Distance between successive ruler marks"), "mark_distance", &wr, this, 20.0),
+ mark_distance(_("_Mark distance:"), _("Distance between successive ruler marks"), "mark_distance", &wr, this, 20.0),
unit(_("Unit:"), _("Unit"), "unit", &wr, this),
- mark_length(_("Major length:"), _("Length of major ruler marks"), "mark_length", &wr, this, 14.0),
- minor_mark_length(_("Minor length:"), _("Length of minor ruler marks"), "minor_mark_length", &wr, this, 7.0),
- major_mark_steps(_("Major steps:"), _("Draw a major mark every ... steps"), "major_mark_steps", &wr, this, 5),
- shift(_("Shift marks by:"), _("Shift marks by this many steps"), "shift", &wr, this, 0),
+ mark_length(_("Ma_jor length:"), _("Length of major ruler marks"), "mark_length", &wr, this, 14.0),
+ minor_mark_length(_("Mino_r length:"), _("Length of minor ruler marks"), "minor_mark_length", &wr, this, 7.0),
+ major_mark_steps(_("Major steps_:"), _("Draw a major mark every ... steps"), "major_mark_steps", &wr, this, 5),
+ shift(_("Shift marks _by:"), _("Shift marks by this many steps"), "shift", &wr, this, 0),
mark_dir(_("Mark direction:"), _("Direction of marks (when viewing along the path from start to end)"), "mark_dir", MarkDirTypeConverter, &wr, this, MARKDIR_LEFT),
- offset(_("Offset:"), _("Offset of first mark"), "offset", &wr, this, 0.0),
+ offset(_("_Offset:"), _("Offset of first mark"), "offset", &wr, this, 0.0),
border_marks(_("Border marks:"), _("Choose whether to draw marks at the beginning and end of the path"), "border_marks", BorderMarkTypeConverter, &wr, this, BORDERMARK_BOTH)
{
registerParameter(dynamic_cast<Parameter *>(&unit));
diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp
index bcdf9df3c..b621f6eca 100644
--- a/src/live_effects/lpe-sketch.cpp
+++ b/src/live_effects/lpe-sketch.cpp
@@ -343,7 +343,7 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_
//TODO: put this 4 as a parameter in the UI...
//TODO: what if with v=0?
double l = tgtlength*(1-tgtlength_rdm)/v_t.length();
- double r = pow(v_t.length(),3)/cross(a_t,v_t);
+ double r = std::pow(v_t.length(),3)/cross(a_t,v_t);
r = sqrt((2*fabs(r)-tgtscale)*tgtscale)/v_t.length();
l=(r<l)?r:l;
//collect the tgt segment into output.
diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp
index 7c8262af6..54554ebb2 100644
--- a/src/live_effects/lpe-spiro.cpp
+++ b/src/live_effects/lpe-spiro.cpp
@@ -9,7 +9,7 @@
#include "display/curve.h"
#include <typeinfo>
#include <2geom/pathvector.h>
-#include <2geom/matrix.h>
+#include <2geom/affine.h>
#include <2geom/bezier-curve.h>
#include <2geom/hvlinesegment.h>
#include <2geom/isnan.h>
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index b94d03c1f..56e73e3a3 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -43,16 +43,16 @@ VonKochRefPathParam::param_readSVGValue(const gchar * strvalue)
LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- nbgenerations(_("Nb of generations:"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1),
+ nbgenerations(_("N_r of generations:"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1),
generator(_("Generating path:"), _("Path whose segments define the iterated transforms"), "generator", &wr, this, "M0,0 L30,0 M0,10 L10,10 M 20,10 L30,10"),
- similar_only(_("Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false),
- drawall(_("Draw all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true),
+ similar_only(_("_Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false),
+ drawall(_("Dra_w all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true),
//,draw_boxes(_("Display boxes"), _("Display boxes instead of paths only"), "draw_boxes", &wr, this, true)
ref_path(_("Reference segment:"), _("The reference segment. Defaults to the horizontal midline of the bbox."), "ref_path", &wr, this, "M0,0 L10,0"),
//refA(_("Ref Start"), _("Left side middle of the reference box"), "refA", &wr, this),
//refB(_("Ref End"), _("Right side middle of the reference box"), "refB", &wr, this),
//FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug.
- maxComplexity(_("Max complexity:"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000)
+ maxComplexity(_("_Max complexity:"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000)
{
//FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug.
registerParameter( dynamic_cast<Parameter *>(&ref_path) );
@@ -88,25 +88,25 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
}
//Collect transform matrices.
- Matrix m0;
+ Affine m0;
Geom::Path refpath = ref_path.get_pathvector().front();
Point A = refpath.pointAt(0);
Point B = refpath.pointAt(refpath.size());
Point u = B-A;
- m0 = Matrix(u[X], u[Y],-u[Y], u[X], A[X], A[Y]);
+ m0 = Affine(u[X], u[Y],-u[Y], u[X], A[X], A[Y]);
//FIXME: a path is used as ref instead of 2 points to work around path/point param incompatibility bug.
//Point u = refB-refA;
- //m0 = Matrix(u[X], u[Y],-u[Y], u[X], refA[X], refA[Y]);
+ //m0 = Affine(u[X], u[Y],-u[Y], u[X], refA[X], refA[Y]);
m0 = m0.inverse();
- std::vector<Matrix> transforms;
+ std::vector<Affine> transforms;
for (unsigned i=0; i<generating_path.size(); i++){
- Matrix m;
+ Affine m;
if(generating_path[i].size()==1){
Point p = generating_path[i].pointAt(0);
Point u = generating_path[i].pointAt(1)-p;
- m = Matrix(u[X], u[Y],-u[Y], u[X], p[X], p[Y]);
+ m = Affine(u[X], u[Y],-u[Y], u[X], p[X], p[Y]);
m = m0*m;
transforms.push_back(m);
}else if(generating_path[i].size()>=2){
@@ -118,7 +118,7 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
v[X] = -u[Y]*sign;
v[Y] = u[X]*sign;
}
- m = Matrix(u[X], u[Y],v[X], v[Y], p[X], p[Y]);
+ m = Affine(u[X], u[Y],v[X], v[Y], p[X], p[Y]);
m = m0*m;
transforms.push_back(m);
}
@@ -133,16 +133,16 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
for (unsigned k = 0; k < path_in.size(); k++){
path_in_complexity+=path_in[k].size();
}
- double complexity = pow(transforms.size(),nbgenerations)*path_in_complexity;
+ double complexity = std::pow(transforms.size(),nbgenerations)*path_in_complexity;
if (drawall.get_value()){
int k = transforms.size();
if(k>1){
- complexity = (pow(k,nbgenerations+1)-1)/(k-1)*path_in_complexity;
+ complexity = (std::pow(k,nbgenerations+1)-1)/(k-1)*path_in_complexity;
}else{
complexity = nbgenerations*k*path_in_complexity;
}
}else{
- complexity = pow(transforms.size(),nbgenerations)*path_in_complexity;
+ complexity = std::pow(transforms.size(),nbgenerations)*path_in_complexity;
}
if (complexity > double(maxComplexity)){
g_warning("VonKoch lpe's output too complex. Effect bypassed.");
@@ -288,8 +288,8 @@ LPEVonKoch::resetDefaults(SPItem * item)
refpaths.push_back(path);
ref_path.set_new_value(refpaths, true);
- paths.push_back(path * Matrix(1./3,0,0,1./3, A[X]*2./3, A[Y]*2./3 + boundingbox_Y.extent()/2));
- paths.push_back(path * Matrix(1./3,0,0,1./3, B[X]*2./3, B[Y]*2./3 + boundingbox_Y.extent()/2));
+ paths.push_back(path * Affine(1./3,0,0,1./3, A[X]*2./3, A[Y]*2./3 + boundingbox_Y.extent()/2));
+ paths.push_back(path * Affine(1./3,0,0,1./3, B[X]*2./3, B[Y]*2./3 + boundingbox_Y.extent()/2));
generator.set_new_value(paths, true);
//FIXME: a path is used as ref instead of 2 points to work around path/point param incompatibility bug.
@@ -300,8 +300,8 @@ LPEVonKoch::resetDefaults(SPItem * item)
//std::vector<Geom::Path> paths;
//Geom::Path path = Geom::Path( (Point) refA);
//path.appendNew<Geom::LineSegment>( (Point) refB );
- //paths.push_back(path * Matrix(1./3,0,0,1./3, refA[X]*2./3, refA[Y]*2./3 + boundingbox_Y.extent()/2));
- //paths.push_back(path * Matrix(1./3,0,0,1./3, refB[X]*2./3, refB[Y]*2./3 + boundingbox_Y.extent()/2));
+ //paths.push_back(path * Affine(1./3,0,0,1./3, refA[X]*2./3, refA[Y]*2./3 + boundingbox_Y.extent()/2));
+ //paths.push_back(path * Affine(1./3,0,0,1./3, refB[X]*2./3, refB[Y]*2./3 + boundingbox_Y.extent()/2));
//paths.push_back(path);
//generator.set_new_value(paths, true);
}
diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp
index e6fc95f86..2678509a4 100644
--- a/src/live_effects/lpegroupbbox.cpp
+++ b/src/live_effects/lpegroupbbox.cpp
@@ -28,7 +28,7 @@ GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute)
// Get item bounding box
SPItem* item = SP_ITEM(lpeitem);
- Geom::Matrix transform;
+ Geom::Affine transform;
if (absolute) {
transform = item->i2doc_affine();
}
diff --git a/src/live_effects/lpeobject-reference.cpp b/src/live_effects/lpeobject-reference.cpp
index 9163d1c91..573c8a2fd 100644
--- a/src/live_effects/lpeobject-reference.cpp
+++ b/src/live_effects/lpeobject-reference.cpp
@@ -45,7 +45,7 @@ bool LPEObjectReference::_acceptObject(SPObject * const obj) const
if (IS_LIVEPATHEFFECT(obj)) {
SPObject * const owner = getOwner();
/* Refuse references to us or to an ancestor. */
- for ( SPObject *iter = owner ; iter ; iter = SP_OBJECT_PARENT(iter) ) {
+ for ( SPObject *iter = owner ; iter ; iter = iter->parent ) {
if ( iter == obj ) {
return false;
}
@@ -94,7 +94,7 @@ LPEObjectReference::start_listening(LivePathEffectObject* to)
return;
}
lpeobject = to;
- lpeobject_repr = SP_OBJECT_REPR(to);
+ lpeobject_repr = to->getRepr();
_delete_connection = to->connectDelete(sigc::bind(sigc::ptr_fun(&lpeobjectreference_delete_self), this));
_modified_connection = to->connectModified(sigc::bind<2>(sigc::ptr_fun(&lpeobjectreference_source_modified), this));
}
diff --git a/src/live_effects/lpeobject-reference.h b/src/live_effects/lpeobject-reference.h
index 48d7eb3a5..8d2b406eb 100644
--- a/src/live_effects/lpeobject-reference.h
+++ b/src/live_effects/lpeobject-reference.h
@@ -11,6 +11,7 @@
#include <forward.h>
#include <uri-references.h>
+#include <stddef.h>
#include <sigc++/sigc++.h>
namespace Inkscape {
diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp
index 389e18d20..1b5ed1d49 100644
--- a/src/live_effects/lpeobject.cpp
+++ b/src/live_effects/lpeobject.cpp
@@ -125,13 +125,13 @@ LivePathEffectObject::livepatheffect_release(SPObject *object)
LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object);
- SP_OBJECT_REPR(object)->removeListenerByData(object);
+ object->getRepr()->removeListenerByData(object);
/*
- if (SP_OBJECT_DOCUMENT(object)) {
+ if (object->document) {
// Unregister ourselves
- sp_document_removeResource(SP_OBJECT_DOCUMENT(object), "livepatheffect", SP_OBJECT(object));
+ sp_document_removeResource(object->document, "livepatheffect", object);
}
if (gradient->ref) {
@@ -249,11 +249,11 @@ livepatheffect_on_repr_attr_changed ( Inkscape::XML::Node * /*repr*/,
LivePathEffectObject *LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users)
{
if (hrefcount > nr_of_allowed_users) {
- SPDocument *doc = SP_OBJECT_DOCUMENT(this);
+ SPDocument *doc = this->document;
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
- Inkscape::XML::Node *dup_repr = SP_OBJECT_REPR (this)->duplicate(xml_doc);
+ Inkscape::XML::Node *dup_repr = this->getRepr()->duplicate(xml_doc);
- SP_OBJECT_REPR (SP_DOCUMENT_DEFS (doc))->addChild(dup_repr, NULL);
+ SP_DOCUMENT_DEFS(doc)->getRepr()->addChild(dup_repr, NULL);
LivePathEffectObject *lpeobj_new = LIVEPATHEFFECT( doc->getObjectByRepr(dup_repr) );
Inkscape::GC::release(dup_repr);
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index ff878e717..cee10bc70 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -67,7 +67,7 @@ public:
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
virtual void param_setup_nodepath(Inkscape::NodePath::Path */*np*/) {};
- virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/) {};
+ virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/) {};
Glib::ustring param_key;
Inkscape::UI::Widget::Registry * param_wr;
diff --git a/src/live_effects/parameter/path-reference.h b/src/live_effects/parameter/path-reference.h
index 3bedecccb..26fce952a 100644
--- a/src/live_effects/parameter/path-reference.h
+++ b/src/live_effects/parameter/path-reference.h
@@ -13,6 +13,7 @@
#include <forward.h>
#include "sp-item.h"
#include <uri-references.h>
+#include <stddef.h>
#include <sigc++/sigc++.h>
class Path;
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index 8d9b2376f..d652dfd0c 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -235,7 +235,7 @@ PathParam::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVec
* Only applies transform when not referring to other path!
*/
void
-PathParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+PathParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
{
// only apply transform when not referring to other path
if (!href) {
diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h
index 23ad51417..8c4de7cff 100644
--- a/src/live_effects/parameter/path.h
+++ b/src/live_effects/parameter/path.h
@@ -16,6 +16,7 @@
#include "live_effects/parameter/parameter.h"
#include "live_effects/parameter/path-reference.h"
+#include <stddef.h>
#include <sigc++/sigc++.h>
namespace Inkscape {
@@ -49,7 +50,7 @@ public:
virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);
virtual void addCanvasIndicators(SPLPEItem *lpeitem, std::vector<Geom::PathVector> &hp_vec);
- virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
+ virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
sigc::signal <void> signal_path_pasted;
sigc::signal <void> signal_path_changed;
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index e7abb70ea..550a8517c 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -84,7 +84,7 @@ PointParam::param_newWidget(Gtk::Tooltips * /*tooltips*/)
param_effect->getSPDoc() ) );
// TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP)
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Geom::Matrix transf = desktop->doc2dt();
+ Geom::Affine transf = desktop->doc2dt();
pointwdg->setTransform(transf);
pointwdg->setValue( *this );
pointwdg->clearProgrammatically();
@@ -114,7 +114,7 @@ PointParam::param_set_and_write_new_value (Geom::Point newpoint)
}
void
-PointParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
{
param_set_and_write_new_value( (*this) * postmul );
}
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index ec61fcd88..2d4e942c0 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -45,7 +45,7 @@ public:
void param_set_and_write_new_value(Geom::Point newpoint);
- virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
+ virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index c20980193..9d43e8447 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -55,7 +55,7 @@ PowerStrokePointArrayParam::param_newWidget(Gtk::Tooltips * /*tooltips*/)
param_effect->getSPDoc() ) );
// TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP)
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
- Geom::Matrix transf = desktop->doc2dt();
+ Geom::Affine transf = desktop->doc2dt();
pointwdg->setTransform(transf);
pointwdg->setValue( *this );
pointwdg->clearProgrammatically();
@@ -71,7 +71,7 @@ PowerStrokePointArrayParam::param_newWidget(Gtk::Tooltips * /*tooltips*/)
void
-PowerStrokePointArrayParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+PowerStrokePointArrayParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
{
// param_set_and_write_new_value( (*this) * postmul );
}
diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h
index 06d406dfe..d984a7de5 100644
--- a/src/live_effects/parameter/powerstrokepointarray.h
+++ b/src/live_effects/parameter/powerstrokepointarray.h
@@ -36,7 +36,7 @@ public:
virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
- virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
+ virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 5496b52f2..9086ab376 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -112,9 +112,9 @@ VectorParam::set_and_write_new_values(Geom::Point const &new_origin, Geom::Point
}
void
-VectorParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+VectorParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
{
- set_and_write_new_values( origin * postmul, vector * postmul.without_translation() );
+ set_and_write_new_values( origin * postmul, vector * postmul.withoutTranslation() );
}
diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h
index a4c29d317..cb7094b7f 100644
--- a/src/live_effects/parameter/vector.h
+++ b/src/live_effects/parameter/vector.h
@@ -48,7 +48,7 @@ public:
void set_and_write_new_values(Geom::Point const &new_origin, Geom::Point const &new_vector);
- virtual void param_transform_multiply(Geom::Matrix const &postmul, bool set);
+ virtual void param_transform_multiply(Geom::Affine const &postmul, bool set);
void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_origin_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);