summaryrefslogtreecommitdiffstats
path: root/src/dialogs/clonetiler.cpp
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/dialogs/clonetiler.cpp
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/dialogs/clonetiler.cpp')
-rw-r--r--src/dialogs/clonetiler.cpp234
1 files changed, 118 insertions, 116 deletions
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp
index 6e03f87e3..81204f27b 100644
--- a/src/dialogs/clonetiler.cpp
+++ b/src/dialogs/clonetiler.cpp
@@ -197,7 +197,7 @@ enum {
};
-static Geom::Matrix
+static Geom::Affine
clonetiler_get_transform (
// symmetry group
@@ -288,7 +288,7 @@ clonetiler_get_transform (
if ( shifty_exp != 1.0 ) shiftj = pow( shiftj, shifty_exp );
// Final shift
- Geom::Matrix rect_translate (Geom::Translate (w * shifti, h * shiftj));
+ Geom::Affine rect_translate (Geom::Translate (w * shifti, h * shiftj));
// Rotation (in degrees) ------------
double delta_rotationi = 0.0;
@@ -371,25 +371,25 @@ clonetiler_get_transform (
// Calculate transformation matrices, translating back to "center of tile" (rotation center) before transforming
- Geom::Matrix drot_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI*dr/180) * Geom::Translate(cx, cy);
+ Geom::Affine drot_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI*dr/180) * Geom::Translate(cx, cy);
- Geom::Matrix dscale_c = Geom::Translate(-cx, -cy) * Geom::Scale (scalex, scaley) * Geom::Translate(cx, cy);
+ Geom::Affine dscale_c = Geom::Translate(-cx, -cy) * Geom::Scale (scalex, scaley) * Geom::Translate(cx, cy);
- Geom::Matrix d_s_r = dscale_c * drot_c;
+ Geom::Affine d_s_r = dscale_c * drot_c;
- Geom::Matrix rotate_180_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_180_c = Geom::Translate(-cx, -cy) * Geom::Rotate (M_PI) * Geom::Translate(cx, cy);
- Geom::Matrix rotate_90_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/2) * Geom::Translate(cx, cy);
- Geom::Matrix rotate_m90_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/2) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_90_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/2) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_m90_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/2) * Geom::Translate(cx, cy);
- Geom::Matrix rotate_120_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-2*M_PI/3) * Geom::Translate(cx, cy);
- Geom::Matrix rotate_m120_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( 2*M_PI/3) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_120_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-2*M_PI/3) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_m120_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( 2*M_PI/3) * Geom::Translate(cx, cy);
- Geom::Matrix rotate_60_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/3) * Geom::Translate(cx, cy);
- Geom::Matrix rotate_m60_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/3) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_60_c = Geom::Translate(-cx, -cy) * Geom::Rotate (-M_PI/3) * Geom::Translate(cx, cy);
+ Geom::Affine rotate_m60_c = Geom::Translate(-cx, -cy) * Geom::Rotate ( M_PI/3) * Geom::Translate(cx, cy);
- Geom::Matrix flip_x = Geom::Translate(-cx, -cy) * Geom::Scale (-1, 1) * Geom::Translate(cx, cy);
- Geom::Matrix flip_y = Geom::Translate(-cx, -cy) * Geom::Scale (1, -1) * Geom::Translate(cx, cy);
+ Geom::Affine flip_x = Geom::Translate(-cx, -cy) * Geom::Scale (-1, 1) * Geom::Translate(cx, cy);
+ Geom::Affine flip_y = Geom::Translate(-cx, -cy) * Geom::Scale (1, -1) * Geom::Translate(cx, cy);
// Create tile with required symmetry
@@ -514,9 +514,9 @@ clonetiler_get_transform (
case TILE_P4:
{
- Geom::Matrix ori (Geom::Translate ((w + h) * pow((i/2), shiftx_exp) + dx, (h + w) * pow((j/2), shifty_exp) + dy));
- Geom::Matrix dia1 (Geom::Translate (w/2 + h/2, -h/2 + w/2));
- Geom::Matrix dia2 (Geom::Translate (-w/2 + h/2, h/2 + w/2));
+ Geom::Affine ori (Geom::Translate ((w + h) * pow((i/2), shiftx_exp) + dx, (h + w) * pow((j/2), shifty_exp) + dy));
+ Geom::Affine dia1 (Geom::Translate (w/2 + h/2, -h/2 + w/2));
+ Geom::Affine dia2 (Geom::Translate (-w/2 + h/2, h/2 + w/2));
if (j % 2 == 0) {
if (i % 2 == 0) {
return d_s_r * ori;
@@ -536,9 +536,9 @@ clonetiler_get_transform (
case TILE_P4M:
{
double max = MAX(w, h);
- Geom::Matrix ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow((j/2), shifty_exp) + dy));
- Geom::Matrix dia1 (Geom::Translate ( w/2 - h/2, h/2 - w/2));
- Geom::Matrix dia2 (Geom::Translate (-h/2 + w/2, w/2 - h/2));
+ Geom::Affine ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow((j/2), shifty_exp) + dy));
+ Geom::Affine dia1 (Geom::Translate ( w/2 - h/2, h/2 - w/2));
+ Geom::Affine dia2 (Geom::Translate (-h/2 + w/2, w/2 - h/2));
if (j % 2 == 0) {
if (i % 4 == 0) {
return d_s_r * ori;
@@ -566,9 +566,9 @@ clonetiler_get_transform (
case TILE_P4G:
{
double max = MAX(w, h);
- Geom::Matrix ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow(j, shifty_exp) + dy));
- Geom::Matrix dia1 (Geom::Translate ( w/2 + h/2, h/2 - w/2));
- Geom::Matrix dia2 (Geom::Translate (-h/2 + w/2, w/2 + h/2));
+ Geom::Affine ori (Geom::Translate ((max + max) * pow((i/4), shiftx_exp) + dx, (max + max) * pow(j, shifty_exp) + dy));
+ Geom::Affine dia1 (Geom::Translate ( w/2 + h/2, h/2 - w/2));
+ Geom::Affine dia2 (Geom::Translate (-h/2 + w/2, w/2 + h/2));
if (((i/4) + j) % 2 == 0) {
if (i % 4 == 0) {
return d_s_r * ori;
@@ -597,20 +597,20 @@ clonetiler_get_transform (
{
double width;
double height;
- Geom::Matrix dia1;
- Geom::Matrix dia2;
+ Geom::Affine dia1;
+ Geom::Affine dia2;
if (w > h) {
width = w + w * cos60;
height = 2 * w * sin60;
- dia1 = Geom::Matrix (Geom::Translate (w/2 + w/2 * cos60, -(w/2 * sin60)));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (0, 2 * (w/2 * sin60)));
+ dia1 = Geom::Affine (Geom::Translate (w/2 + w/2 * cos60, -(w/2 * sin60)));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (0, 2 * (w/2 * sin60)));
} else {
width = h * cos (M_PI/6);
height = h;
- dia1 = Geom::Matrix (Geom::Translate (h/2 * cos30, -(h/2 * sin30)));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (0, h/2));
+ dia1 = Geom::Affine (Geom::Translate (h/2 * cos30, -(h/2 * sin30)));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (0, h/2));
}
- Geom::Matrix ori (Geom::Translate (width * pow((2*(i/3) + j%2), shiftx_exp) + dx, (height/2) * pow(j, shifty_exp) + dy));
+ Geom::Affine ori (Geom::Translate (width * pow((2*(i/3) + j%2), shiftx_exp) + dx, (height/2) * pow(j, shifty_exp) + dy));
if (i % 3 == 0) {
return d_s_r * ori;
} else if (i % 3 == 1) {
@@ -623,23 +623,23 @@ clonetiler_get_transform (
case TILE_P31M:
{
- Geom::Matrix ori;
- Geom::Matrix dia1;
- Geom::Matrix dia2;
- Geom::Matrix dia3;
- Geom::Matrix dia4;
+ Geom::Affine ori;
+ Geom::Affine dia1;
+ Geom::Affine dia2;
+ Geom::Affine dia3;
+ Geom::Affine dia4;
if (w > h) {
- ori = Geom::Matrix(Geom::Translate (w * pow((i/6) + 0.5*(j%2), shiftx_exp) + dx, (w * cos30) * pow(j, shifty_exp) + dy));
- dia1 = Geom::Matrix (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) );
- dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30)));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30));
+ ori = Geom::Affine(Geom::Translate (w * pow((i/6) + 0.5*(j%2), shiftx_exp) + dx, (w * cos30) * pow(j, shifty_exp) + dy));
+ dia1 = Geom::Affine (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) );
+ dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30)));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30));
} else {
- ori = Geom::Matrix (Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (2*h - h * sin30) * pow(j, shifty_exp) + dy));
- dia1 = Geom::Matrix (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (0, h/2));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30));
+ ori = Geom::Affine (Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (2*h - h * sin30) * pow(j, shifty_exp) + dy));
+ dia1 = Geom::Affine (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (0, h/2));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30));
}
if (i % 6 == 0) {
return d_s_r * ori;
@@ -661,26 +661,26 @@ clonetiler_get_transform (
{
double width;
double height;
- Geom::Matrix dia1;
- Geom::Matrix dia2;
- Geom::Matrix dia3;
- Geom::Matrix dia4;
+ Geom::Affine dia1;
+ Geom::Affine dia2;
+ Geom::Affine dia3;
+ Geom::Affine dia4;
if (w > h) {
width = w + w * cos60;
height = 2 * w * sin60;
- dia1 = Geom::Matrix (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) );
- dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30)));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30));
+ dia1 = Geom::Affine (Geom::Translate (0, h/2) * Geom::Translate (w/2, 0) * Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, -h/2 * sin30) );
+ dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (0, 2 * (w/2 * sin60 - h/2 * sin30)));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30));
} else {
width = 2 * h * cos (M_PI/6);
height = 2 * h;
- dia1 = Geom::Matrix (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (0, h/2));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (-h * cos30, h * sin30));
+ dia1 = Geom::Affine (Geom::Translate (0, -h/2) * Geom::Translate (h/2 * cos30, h/2 * sin30));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, h * sin30));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (0, h/2));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (-h * cos30, h * sin30));
}
- Geom::Matrix ori (Geom::Translate (width * pow((2*(i/6) + j%2), shiftx_exp) + dx, (height/2) * pow(j, shifty_exp) + dy));
+ Geom::Affine ori (Geom::Translate (width * pow((2*(i/6) + j%2), shiftx_exp) + dx, (height/2) * pow(j, shifty_exp) + dy));
if (i % 6 == 0) {
return d_s_r * ori;
} else if (i % 6 == 1) {
@@ -699,24 +699,24 @@ clonetiler_get_transform (
case TILE_P6:
{
- Geom::Matrix ori;
- Geom::Matrix dia1;
- Geom::Matrix dia2;
- Geom::Matrix dia3;
- Geom::Matrix dia4;
- Geom::Matrix dia5;
+ Geom::Affine ori;
+ Geom::Affine dia1;
+ Geom::Affine dia2;
+ Geom::Affine dia3;
+ Geom::Affine dia4;
+ Geom::Affine dia5;
if (w > h) {
- ori = Geom::Matrix(Geom::Translate (w * pow((2*(i/6) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy));
- dia1 = Geom::Matrix (Geom::Translate (w/2 * cos60, -w/2 * sin60));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (w/2, 0));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (w/2 * cos60, w/2 * sin60));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (-w/2 * cos60, w/2 * sin60));
- dia5 = dia4 * Geom::Matrix (Geom::Translate (-w/2, 0));
+ ori = Geom::Affine(Geom::Translate (w * pow((2*(i/6) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy));
+ dia1 = Geom::Affine (Geom::Translate (w/2 * cos60, -w/2 * sin60));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (w/2, 0));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (w/2 * cos60, w/2 * sin60));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (-w/2 * cos60, w/2 * sin60));
+ dia5 = dia4 * Geom::Affine (Geom::Translate (-w/2, 0));
} else {
- ori = Geom::Matrix(Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (h + h * sin30) * pow(j, shifty_exp) + dy));
- dia1 = Geom::Matrix (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2));
+ ori = Geom::Affine(Geom::Translate (2*h * cos30 * pow((i/6 + 0.5*(j%2)), shiftx_exp) + dx, (h + h * sin30) * pow(j, shifty_exp) + dy));
+ dia1 = Geom::Affine (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2));
dia4 = dia3 * dia1.inverse();
dia5 = dia3 * dia2.inverse();
}
@@ -739,28 +739,28 @@ clonetiler_get_transform (
case TILE_P6M:
{
- Geom::Matrix ori;
- Geom::Matrix dia1, dia2, dia3, dia4, dia5, dia6, dia7, dia8, dia9, dia10;
+ Geom::Affine ori;
+ Geom::Affine dia1, dia2, dia3, dia4, dia5, dia6, dia7, dia8, dia9, dia10;
if (w > h) {
- ori = Geom::Matrix(Geom::Translate (w * pow((2*(i/12) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy));
- dia1 = Geom::Matrix (Geom::Translate (w/2, h/2) * Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, h/2 * sin30));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, -h * sin30));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (-h/2 * cos30, h/2 * sin30) * Geom::Translate (w * cos60, 0) * Geom::Translate (-h/2 * cos30, -h/2 * sin30));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30));
- dia5 = dia4 * Geom::Matrix (Geom::Translate (-h/2 * cos30, -h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60) * Geom::Translate (w/2, -h/2));
- dia6 = dia5 * Geom::Matrix (Geom::Translate (0, h));
+ ori = Geom::Affine(Geom::Translate (w * pow((2*(i/12) + (j%2)), shiftx_exp) + dx, (2*w * sin60) * pow(j, shifty_exp) + dy));
+ dia1 = Geom::Affine (Geom::Translate (w/2, h/2) * Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (-h/2 * cos30, h/2 * sin30));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, -h * sin30));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (-h/2 * cos30, h/2 * sin30) * Geom::Translate (w * cos60, 0) * Geom::Translate (-h/2 * cos30, -h/2 * sin30));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (h * cos30, h * sin30));
+ dia5 = dia4 * Geom::Affine (Geom::Translate (-h/2 * cos30, -h/2 * sin30) * Geom::Translate (-w/2 * cos60, w/2 * sin60) * Geom::Translate (w/2, -h/2));
+ dia6 = dia5 * Geom::Affine (Geom::Translate (0, h));
dia7 = dia6 * dia1.inverse();
dia8 = dia6 * dia2.inverse();
dia9 = dia6 * dia3.inverse();
dia10 = dia6 * dia4.inverse();
} else {
- ori = Geom::Matrix(Geom::Translate (4*h * cos30 * pow((i/12 + 0.5*(j%2)), shiftx_exp) + dx, (2*h + 2*h * sin30) * pow(j, shifty_exp) + dy));
- dia1 = Geom::Matrix (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60));
- dia2 = dia1 * Geom::Matrix (Geom::Translate (h * cos30, -h * sin30));
- dia3 = dia2 * Geom::Matrix (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h * cos30, 0) * Geom::Translate (-w/2 * cos60, w/2 * sin60));
- dia4 = dia3 * Geom::Matrix (Geom::Translate (h * cos30, h * sin30));
- dia5 = dia4 * Geom::Matrix (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2));
- dia6 = dia5 * Geom::Matrix (Geom::Translate (0, h));
+ ori = Geom::Affine(Geom::Translate (4*h * cos30 * pow((i/12 + 0.5*(j%2)), shiftx_exp) + dx, (2*h + 2*h * sin30) * pow(j, shifty_exp) + dy));
+ dia1 = Geom::Affine (Geom::Translate (-w/2, -h/2) * Geom::Translate (h/2 * cos30, -h/2 * sin30) * Geom::Translate (w/2 * cos60, w/2 * sin60));
+ dia2 = dia1 * Geom::Affine (Geom::Translate (h * cos30, -h * sin30));
+ dia3 = dia2 * Geom::Affine (Geom::Translate (-w/2 * cos60, -w/2 * sin60) * Geom::Translate (h * cos30, 0) * Geom::Translate (-w/2 * cos60, w/2 * sin60));
+ dia4 = dia3 * Geom::Affine (Geom::Translate (h * cos30, h * sin30));
+ dia5 = dia4 * Geom::Affine (Geom::Translate (w/2 * cos60, -w/2 * sin60) * Geom::Translate (h/2 * cos30, h/2 * sin30) * Geom::Translate (-w/2, h/2));
+ dia6 = dia5 * Geom::Affine (Geom::Translate (0, h));
dia7 = dia6 * dia1.inverse();
dia8 = dia6 * dia2.inverse();
dia9 = dia6 * dia3.inverse();
@@ -804,27 +804,29 @@ clonetiler_get_transform (
static bool
clonetiler_is_a_clone_of (SPObject *tile, SPObject *obj)
{
+ bool result = false;
char *id_href = NULL;
if (obj) {
- Inkscape::XML::Node *obj_repr = SP_OBJECT_REPR(obj);
+ Inkscape::XML::Node *obj_repr = obj->getRepr();
id_href = g_strdup_printf("#%s", obj_repr->attribute("id"));
}
if (SP_IS_USE(tile) &&
- SP_OBJECT_REPR(tile)->attribute("xlink:href") &&
- (!id_href || !strcmp(id_href, SP_OBJECT_REPR(tile)->attribute("xlink:href"))) &&
- SP_OBJECT_REPR(tile)->attribute("inkscape:tiled-clone-of") &&
- (!id_href || !strcmp(id_href, SP_OBJECT_REPR(tile)->attribute("inkscape:tiled-clone-of"))))
+ tile->getRepr()->attribute("xlink:href") &&
+ (!id_href || !strcmp(id_href, tile->getRepr()->attribute("xlink:href"))) &&
+ tile->getRepr()->attribute("inkscape:tiled-clone-of") &&
+ (!id_href || !strcmp(id_href, tile->getRepr()->attribute("inkscape:tiled-clone-of"))))
{
- if (id_href)
- g_free (id_href);
- return true;
+ result = true;
} else {
- if (id_href)
- g_free (id_href);
- return false;
+ result = false;
}
+ if (id_href) {
+ g_free(id_href);
+ id_href = 0;
+ }
+ return result;
}
static NRArena const *trace_arena = NULL;
@@ -857,7 +859,7 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original)
// hide the (current) original and any tiled clones, we only want to pick the background
original->invoke_hide(trace_visionkey);
- clonetiler_trace_hide_tiled_clones_recursively(SP_OBJECT(trace_doc->getRoot()));
+ clonetiler_trace_hide_tiled_clones_recursively(trace_doc->getRoot());
trace_doc->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
trace_doc->ensureUpToDate();
@@ -871,7 +873,7 @@ clonetiler_trace_pick (Geom::Rect box)
if (!trace_arena)
return 0;
- Geom::Matrix t(Geom::Scale(trace_zoom, trace_zoom));
+ Geom::Affine t(Geom::Scale(trace_zoom, trace_zoom));
nr_arena_item_set_transform(trace_root, &t);
NRGC gc(NULL);
gc.transform.setIdentity();
@@ -931,8 +933,8 @@ clonetiler_unclump( GtkWidget */*widget*/, void * )
return;
}
- SPObject *obj = SP_OBJECT(selection->singleItem());
- SPObject *parent = SP_OBJECT_PARENT (obj);
+ SPObject *obj = selection->singleItem();
+ SPObject *parent = obj->parent;
GSList *to_unclump = NULL; // not including the original
@@ -955,7 +957,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * )
static guint
clonetiler_number_of_clones (SPObject *obj)
{
- SPObject *parent = SP_OBJECT_PARENT (obj);
+ SPObject *parent = obj->parent;
guint n = 0;
@@ -983,8 +985,8 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true )
return;
}
- SPObject *obj = SP_OBJECT(selection->singleItem());
- SPObject *parent = SP_OBJECT_PARENT (obj);
+ SPObject *obj = selection->singleItem();
+ SPObject *parent = obj->parent;
// remove old tiling
GSList *to_delete = NULL;
@@ -1007,7 +1009,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true )
}
static Geom::Rect
-transform_rect( Geom::Rect const &r, Geom::Matrix const &m)
+transform_rect( Geom::Rect const &r, Geom::Affine const &m)
{
using Geom::X;
using Geom::Y;
@@ -1068,10 +1070,10 @@ clonetiler_apply( GtkWidget */*widget*/, void * )
gtk_widget_queue_draw(GTK_WIDGET(status));
gdk_window_process_all_updates();
- SPObject *obj = SP_OBJECT(selection->singleItem());
- Inkscape::XML::Node *obj_repr = SP_OBJECT_REPR(obj);
+ SPObject *obj = selection->singleItem();
+ Inkscape::XML::Node *obj_repr = obj->getRepr();
const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id"));
- SPObject *parent = SP_OBJECT_PARENT (obj);
+ SPObject *parent = obj->parent;
clonetiler_remove (NULL, NULL, false);
@@ -1229,7 +1231,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * )
// Note: We create a clone at 0,0 too, right over the original, in case our clones are colored
// Get transform from symmetry, shift, scale, rotation
- Geom::Matrix t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h,
+ Geom::Affine t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h,
shiftx_per_i, shifty_per_i,
shiftx_per_j, shifty_per_j,
shiftx_rand, shifty_rand,
@@ -1428,7 +1430,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * )
}
// add the new clone to the top of the original's parent
- SP_OBJECT_REPR(parent)->appendChild(clone);
+ parent->getRepr()->appendChild(clone);
if (blur > 0.0) {
SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone);
@@ -1441,7 +1443,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * )
// that we can take bbox of; however here we only need a lower bound so that blur
// margins are not too small, and the perimeter should work
SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter);
- sp_style_set_property_url (clone_object, "filter", SP_OBJECT(constructed), false);
+ sp_style_set_property_url (clone_object, "filter", constructed, false);
}
if (center_set) {
@@ -2336,7 +2338,7 @@ clonetiler_dialog (void)
// Dissolve
{
GtkWidget *l = gtk_label_new ("");
- gtk_label_set_markup (GTK_LABEL(l), _("<b>Fade out:</b>"));
+ gtk_label_set_markup (GTK_LABEL(l), _("<b>Opacity:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
clonetiler_table_attach (table, l, 1, 4, 1);
}