summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-09-24 22:47:22 +0000
committerMarkus Engel <markus.engel@tum.de>2013-09-24 22:47:22 +0000
commit22548e97b7fd38308c9aacea4c865491d84562a6 (patch)
tree249c35a5a87f2f5be1d028eddbec04fe9344a623 /src
parentRefactored SPSpiral. (diff)
downloadinkscape-22548e97b7fd38308c9aacea4c865491d84562a6.tar.gz
inkscape-22548e97b7fd38308c9aacea4c865491d84562a6.zip
Simplified some in-code circle creation.
(bzr r11608.1.131)
Diffstat (limited to 'src')
-rw-r--r--src/dropper-context.cpp17
-rw-r--r--src/dyna-draw-context.cpp15
-rw-r--r--src/spray-context.cpp14
-rw-r--r--src/tweak-context.cpp14
4 files changed, 25 insertions, 35 deletions
diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp
index d513dd587..dcb1ab66c 100644
--- a/src/dropper-context.cpp
+++ b/src/dropper-context.cpp
@@ -19,6 +19,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include <2geom/transforms.h>
+#include <2geom/circle.h>
#include "macros.h"
#include "display/canvas-bpath.h"
@@ -92,16 +93,14 @@ SPDropperContext::~SPDropperContext() {
void SPDropperContext::setup() {
SPEventContext::setup();
- /* TODO: have a look at sp_dyna_draw_context_setup where the same is done.. generalize? at least make it an arcto! */
- SPCurve *c = new SPCurve();
- const double C1 = 0.552;
- c->moveto(-1,0);
- c->curveto(-1, C1, -C1, 1, 0, 1 );
- c->curveto(C1, 1, 1, C1, 1, 0 );
- c->curveto(1, -C1, C1, -1, 0, -1 );
- c->curveto(-C1, -1, -1, -C1, -1, 0 );
- c->closepath();
+ /* TODO: have a look at SPDynaDrawContext::setup where the same is done.. generalize? */
+ Geom::PathVector path;
+ Geom::Circle(0, 0, 1).getPath(path);
+
+ SPCurve *c = new SPCurve(path);
+
this->area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c);
+
c->unref();
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->area), 0x00000000,(SPWindRule)0);
diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp
index 3e35c0ac1..01f71f76a 100644
--- a/src/dyna-draw-context.cpp
+++ b/src/dyna-draw-context.cpp
@@ -38,6 +38,7 @@
#include <2geom/math-utils.h>
#include <2geom/pathvector.h>
#include <2geom/bezier-utils.h>
+#include <2geom/circle.h>
#include "display/curve.h"
#include <glib.h>
#include "macros.h"
@@ -151,17 +152,11 @@ void SPDynaDrawContext::setup() {
g_signal_connect(G_OBJECT(this->currentshape), "event", G_CALLBACK(sp_desktop_root_handler), this->desktop);
{
- /* TODO: this can be done either with an arcto, and should maybe also be put in a general file (other tools use this as well) */
- SPCurve *c = new SPCurve();
+ /* TODO: have a look at SPDropperContext::setup where the same is done.. generalize? */
+ Geom::PathVector path;
+ Geom::Circle(0, 0, 1).getPath(path);
- const double C1 = 0.552;
-
- c->moveto(-1,0);
- c->curveto(-1, C1, -C1, 1, 0, 1 );
- c->curveto(C1, 1, 1, C1, 1, 0 );
- c->curveto(1, -C1, C1, -1, 0, -1 );
- c->curveto(-C1, -1, -1, -C1, -1, 0 );
- c->closepath();
+ SPCurve *c = new SPCurve(path);
this->hatch_area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c);
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index 08dc59bce..fd9aff196 100644
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -55,6 +55,7 @@
#include "display/canvas-arena.h"
#include "display/curve.h"
#include "livarot/Shape.h"
+#include <2geom/circle.h>
#include <2geom/transforms.h>
#include "preferences.h"
#include "style.h"
@@ -212,14 +213,11 @@ void SPSprayContext::setup() {
{
/* TODO: have a look at sp_dyna_draw_context_setup where the same is done.. generalize? at least make it an arcto! */
- SPCurve *c = new SPCurve();
- const double C1 = 0.552;
- c->moveto(-1,0);
- c->curveto(-1, C1, -C1, 1, 0, 1 );
- c->curveto(C1, 1, 1, C1, 1, 0 );
- c->curveto(1, -C1, C1, -1, 0, -1 );
- c->curveto(-C1, -1, -1, -C1, -1, 0 );
- c->closepath();
+ Geom::PathVector path;
+ Geom::Circle(0, 0, 1).getPath(path);
+
+ SPCurve *c = new SPCurve(path);
+
this->dilate_area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c);
c->unref();
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->dilate_area), 0x00000000,(SPWindRule)0);
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 65106e651..410ea4000 100644
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -74,6 +74,7 @@
#include "display/curve.h"
#include "livarot/Shape.h"
#include <2geom/transforms.h>
+#include <2geom/circle.h>
#include "preferences.h"
#include "style.h"
#include "box3d.h"
@@ -271,14 +272,11 @@ void SPTweakContext::setup() {
{
/* TODO: have a look at sp_dyna_draw_context_setup where the same is done.. generalize? at least make it an arcto! */
- SPCurve *c = new SPCurve();
- const double C1 = 0.552;
- c->moveto(-1,0);
- c->curveto(-1, C1, -C1, 1, 0, 1 );
- c->curveto(C1, 1, 1, C1, 1, 0 );
- c->curveto(1, -C1, C1, -1, 0, -1 );
- c->curveto(-C1, -1, -1, -C1, -1, 0 );
- c->closepath();
+ Geom::PathVector path;
+ Geom::Circle(0, 0, 1).getPath(path);
+
+ SPCurve *c = new SPCurve(path);
+
this->dilate_area = sp_canvas_bpath_new(sp_desktop_controls(this->desktop), c);
c->unref();
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(this->dilate_area), 0x00000000,(SPWindRule)0);