summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 280e31b)
raw | patch | inline | side by side (parent: 280e31b)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 28 Dec 2008 21:50:27 +0000 (21:50 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 28 Dec 2008 21:50:27 +0000 (21:50 +0000) |
src/dyna-draw-context.cpp | patch | blob | history |
index 402af6d49797d25fac1643d09b0bc376d3066c13..257e6f7dc9947d853158c3be03bae2b5917554fa 100644 (file)
#include "svg/svg.h"
#include "display/canvas-bpath.h"
+#include <2geom/isnan.h>
+#include <2geom/pathvector.h>
#include <2geom/bezier-utils.h>
#include "display/curve.h"
#include <glib/gmem.h>
#include "message-context.h"
#include "preferences.h"
#include "pixmaps/cursor-calligraphy.xpm"
-#include "libnr/nr-matrix-ops.h"
-#include "libnr/nr-scale-translate-ops.h"
-#include "libnr/nr-convert2geom.h"
#include "xml/repr.h"
#include "context-fns.h"
#include "sp-item.h"
#include "display/canvas-bpath.h"
#include "display/canvas-arena.h"
#include "livarot/Shape.h"
-#include <2geom/isnan.h>
-#include <2geom/pathvector.h>
#include "dyna-draw-context.h"
// distance from pointer to nearest
- hatch_dist = NR::L2(pointer - nearest);
+ hatch_dist = Geom::L2(pointer - nearest);
// unit-length vector
hatch_unit_vector = (pointer - nearest)/hatch_dist;
// Calculate angle cosine of this vector-to-guide and all past vectors
// summed, to detect if we accidentally flipped to the other side of the
// guide
- double dot = NR::dot (pointer - nearest, dc->hatch_vector_accumulated);
+ double dot = Geom::dot (pointer - nearest, dc->hatch_vector_accumulated);
dot /= Geom::L2(pointer - nearest) * Geom::L2(dc->hatch_vector_accumulated);
if (dc->hatch_spacing != 0) { // spacing was already set
if (dc->hatch_spacing == 0 && hatch_dist != 0) {
// Haven't set spacing yet: gray, center free, update radius live
Geom::Point c = desktop->w2d(motion_w);
- NR::Matrix const sm (Geom::Scale(hatch_dist, hatch_dist) * Geom::Translate(c));
+ Geom::Matrix const sm (Geom::Scale(hatch_dist, hatch_dist) * Geom::Translate(c));
sp_canvas_item_affine_absolute(dc->hatch_area, sm);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->hatch_area), 0x7f7f7fff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_item_show(dc->hatch_area);
} else if (dc->dragging && !dc->hatch_escaped) {
// Tracking: green, center snapped, fixed radius
Geom::Point c = motion_dt;
- NR::Matrix const sm (Geom::Scale(dc->hatch_spacing, dc->hatch_spacing) * Geom::Translate(c));
+ Geom::Matrix const sm (Geom::Scale(dc->hatch_spacing, dc->hatch_spacing) * Geom::Translate(c));
sp_canvas_item_affine_absolute(dc->hatch_area, sm);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->hatch_area), 0x00FF00ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_item_show(dc->hatch_area);
} else if (dc->dragging && dc->hatch_escaped) {
// Tracking escaped: red, center free, fixed radius
Geom::Point c = desktop->w2d(motion_w);
- NR::Matrix const sm (Geom::Scale(dc->hatch_spacing, dc->hatch_spacing) * Geom::Translate(c));
+ Geom::Matrix const sm (Geom::Scale(dc->hatch_spacing, dc->hatch_spacing) * Geom::Translate(c));
sp_canvas_item_affine_absolute(dc->hatch_area, sm);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->hatch_area), 0xFF0000ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
// Not drawing but spacing set: gray, center snapped, fixed radius
Geom::Point c = (nearest + dc->hatch_spacing * hatch_unit_vector) * motion_to_curve.inverse();
if (!IS_NAN(c[Geom::X]) && !IS_NAN(c[Geom::Y])) {
- NR::Matrix const sm (Geom::Scale(dc->hatch_spacing, dc->hatch_spacing) * Geom::Translate(c));
+ Geom::Matrix const sm (Geom::Scale(dc->hatch_spacing, dc->hatch_spacing) * Geom::Translate(c));
sp_canvas_item_affine_absolute(dc->hatch_area, sm);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->hatch_area), 0x7f7f7fff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_item_show(dc->hatch_area);
double rounding)
{
if (Geom::L2( to - from ) > DYNA_EPSILON) {
- Geom::Point vel = rounding * NR::rot90( to - from ) / sqrt(2.0);
+ Geom::Point vel = rounding * Geom::rot90( to - from ) / sqrt(2.0);
double mag = Geom::L2(vel);
- Geom::Point v = mag * NR::rot90( to - from ) / Geom::L2( to - from );
+ Geom::Point v = mag * Geom::rot90( to - from ) / Geom::L2( to - from );
curve->curveto(from + v, to + v, to);
}
}