summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c4284b)
raw | patch | inline | side by side (parent: 3c4284b)
author | verbalshadow <verbalshadow@users.sourceforge.net> | |
Fri, 28 Nov 2008 22:33:23 +0000 (22:33 +0000) | ||
committer | verbalshadow <verbalshadow@users.sourceforge.net> | |
Fri, 28 Nov 2008 22:33:23 +0000 (22:33 +0000) |
src/sp-text.cpp | patch | blob | history | |
src/text-tag-attributes.h | patch | blob | history | |
src/tweak-context.cpp | patch | blob | history | |
src/tweak-context.h | patch | blob | history |
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index eae9dd08877684e503b2c048699db969da626078..6c2a5264a979223c73e031954052a362273dfdfe 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
if (tspan->role == SP_TSPAN_ROLE_UNSPECIFIED) continue;
if (!tspan->attributes.singleXYCoordinates()) continue;
Inkscape::Text::Layout::iterator iter = layout.sourceToIterator(tspan);
- NR::Point anchor_point = layout.chunkAnchorPoint(iter);
+ Geom::Point anchor_point = layout.chunkAnchorPoint(iter);
tspan->attributes.setFirstXY(anchor_point);
}
}
return !attributes.x.empty() || !attributes.y.empty() || !attributes.dx.empty() || !attributes.dy.empty() || !attributes.rotate.empty();
}
-NR::Point TextTagAttributes::firstXY() const
+Geom::Point TextTagAttributes::firstXY() const
{
- NR::Point point;
- if (attributes.x.empty()) point[NR::X] = 0.0;
- else point[NR::X] = attributes.x[0].computed;
- if (attributes.y.empty()) point[NR::Y] = 0.0;
- else point[NR::Y] = attributes.y[0].computed;
+ Geom::Point point;
+ if (attributes.x.empty()) point[Geom::X] = 0.0;
+ else point[Geom::X] = attributes.x[0].computed;
+ if (attributes.y.empty()) point[Geom::Y] = 0.0;
+ else point[Geom::Y] = attributes.y[0].computed;
return point;
}
-void TextTagAttributes::setFirstXY(NR::Point &point)
+void TextTagAttributes::setFirstXY(Geom::Point &point)
{
SVGLength zero_length;
zero_length = 0.0;
attributes.x.resize(1, zero_length);
if (attributes.y.empty())
attributes.y.resize(1, zero_length);
- attributes.x[0].computed = point[NR::X];
- attributes.y[0].computed = point[NR::Y];
+ attributes.x[0].computed = point[Geom::X];
+ attributes.y[0].computed = point[Geom::Y];
}
void TextTagAttributes::mergeInto(Inkscape::Text::Layout::OptionalTextTagAttrs *output, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_attrs, unsigned parent_attrs_offset, bool copy_xy, bool copy_dxdyrotate) const
@@ -878,7 +878,7 @@ void TextTagAttributes::joinSingleAttribute(std::vector<SVGLength> *dest_vector,
}
}
-void TextTagAttributes::transform(NR::Matrix const &matrix, double scale_x, double scale_y, bool extend_zero_length)
+void TextTagAttributes::transform(Geom::Matrix const &matrix, double scale_x, double scale_y, bool extend_zero_length)
{
SVGLength zero_length;
zero_length = 0.0;
@@ -892,22 +892,22 @@ void TextTagAttributes::transform(NR::Matrix const &matrix, double scale_x, doub
points_count = 1;
for (unsigned i = 0 ; i < points_count ; i++) {
NR::Point point;
- if (i < attributes.x.size()) point[NR::X] = attributes.x[i].computed;
+ if (i < attributes.x.size()) point[Geom::X] = attributes.x[i].computed;
else point[NR::X] = 0.0;
- if (i < attributes.y.size()) point[NR::Y] = attributes.y[i].computed;
- else point[NR::Y] = 0.0;
+ if (i < attributes.y.size()) point[Geom::Y] = attributes.y[i].computed;
+ else point[Geom::Y] = 0.0;
point *= matrix;
if (i < attributes.x.size())
- attributes.x[i] = point[NR::X];
- else if (point[NR::X] != 0.0 && extend_zero_length) {
+ attributes.x[i] = point[Geom::X];
+ else if (point[Geom::X] != 0.0 && extend_zero_length) {
attributes.x.resize(i + 1, zero_length);
- attributes.x[i] = point[NR::X];
+ attributes.x[i] = point[Geom::X];
}
if (i < attributes.y.size())
- attributes.y[i] = point[NR::Y];
- else if (point[NR::Y] != 0.0 && extend_zero_length) {
+ attributes.y[i] = point[Geom::Y];
+ else if (point[Geom::Y] != 0.0 && extend_zero_length) {
attributes.y.resize(i + 1, zero_length);
- attributes.y[i] = point[NR::Y];
+ attributes.y[i] = point[Geom::Y];
}
}
for (std::vector<SVGLength>::iterator it = attributes.dx.begin() ; it != attributes.dx.end() ; it++)
@@ -916,18 +916,18 @@ void TextTagAttributes::transform(NR::Matrix const &matrix, double scale_x, doub
*it = it->computed * scale_y;
}
-void TextTagAttributes::addToDxDy(unsigned index, NR::Point const &adjust)
+void TextTagAttributes::addToDxDy(unsigned index, Geom::Point const &adjust)
{
SVGLength zero_length;
zero_length = 0.0;
- if (adjust[NR::X] != 0.0) {
+ if (adjust[Geom::X] != 0.0) {
if (attributes.dx.size() < index + 1) attributes.dx.resize(index + 1, zero_length);
- attributes.dx[index] = attributes.dx[index].computed + adjust[NR::X];
+ attributes.dx[index] = attributes.dx[index].computed + adjust[Geom::X];
}
- if (adjust[NR::Y] != 0.0) {
+ if (adjust[Geom::Y] != 0.0) {
if (attributes.dy.size() < index + 1) attributes.dy.resize(index + 1, zero_length);
- attributes.dy[index] = attributes.dy[index].computed + adjust[NR::Y];
+ attributes.dy[index] = attributes.dy[index].computed + adjust[Geom::Y];
}
}
index 9c1425dffd203fa767d47d94ebca2cb9ec839721..7a7ba576359f59e1e0ba09560bda3e7d54717739 100644 (file)
If \a extend_zero_length is true, then if the x or y vectors are empty
they will be made length 1 in order to store the newly calculated
position. */
- void transform(NR::Matrix const &matrix, double scale_x, double scale_y, bool extend_zero_length = false);
+ void transform(Geom::Matrix const &matrix, double scale_x, double scale_y, bool extend_zero_length = false);
/** Adds the given values to the dx and dy vectors at the given
\a index. The vectors are extended if necessary. */
- void addToDxDy(unsigned index, NR::Point const &adjust);
+ void addToDxDy(unsigned index, Geom::Point const &adjust);
/** Adds the given value to the rotate vector at the given \a index. The
vector is extended if necessary. Delta is measured in degrees, clockwise
/** Returns the first coordinates in the x and y vectors. If either
is zero length, 0.0 is used for that coordinate. */
- NR::Point firstXY() const;
+ Geom::Point firstXY() const;
/** Sets the first coordinates in the x and y vectors. */
- void setFirstXY(NR::Point &point);
+ void setFirstXY(Geom::Point &point);
private:
/// This holds the actual values.
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 156ce0169b555ea0e00e2f172c7c7be72d7a34ff..3cc26393b958f73cf55bc62408b13f0dc8ac753c 100644 (file)
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
void
tweak_colors_in_gradient (SPItem *item, bool fill_or_stroke,
- guint32 const rgb_goal, NR::Point p_w, double radius, double force, guint mode,
+ guint32 const rgb_goal, Geom::Point p_w, double radius, double force, guint mode,
bool do_h, bool do_s, bool do_l, bool /*do_o*/)
{
SPGradient *gradient = sp_item_gradient (item, fill_or_stroke);
if (!gradient || !SP_IS_GRADIENT(gradient))
return;
- NR::Matrix i2d (sp_item_i2doc_affine (item));
- NR::Point p = p_w * i2d.inverse();
+ Geom::Matrix i2d (sp_item_i2doc_affine (item));
+ Geom::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
if (SP_IS_LINEARGRADIENT(gradient)) {
SPLinearGradient *lg = SP_LINEARGRADIENT(gradient);
- NR::Point p1(lg->x1.computed, lg->y1.computed);
- NR::Point p2(lg->x2.computed, lg->y2.computed);
- NR::Point pdiff(p2 - p1);
- double vl = NR::L2(pdiff);
+ Geom::Point p1(lg->x1.computed, lg->y1.computed);
+ Geom::Point p2(lg->x2.computed, lg->y2.computed);
+ Geom::Point pdiff(p2 - p1);
+ double vl = Geom::L2(pdiff);
// This is the matrix which moves and rotates the gradient line
// so it's oriented along the X axis:
- NR::Matrix norm = NR::Matrix(Geom::Translate(-p1)) * NR::Matrix(Geom::Rotate(-atan2(pdiff[NR::Y], pdiff[NR::X])));
+ Geom::Matrix norm = Geom::Matrix(Geom::Translate(-p1)) * Geom::Matrix(Geom::Rotate(-atan2(pdiff[Geom::Y], pdiff[Geom::X])));
// Transform the mouse point by it to find out its projection onto the gradient line:
- NR::Point pnorm = p * norm;
+ Geom::Point pnorm = p * norm;
// Scale its X coordinate to match the length of the gradient line:
- pos = pnorm[NR::X] / vl;
+ pos = pnorm[Geom::X] / vl;
// Calculate radius in lenfth-of-gradient-line units
r = radius / vl;
} else if (SP_IS_RADIALGRADIENT(gradient)) {
SPRadialGradient *rg = SP_RADIALGRADIENT(gradient);
- NR::Point c (rg->cx.computed, rg->cy.computed);
- pos = NR::L2(p - c) / rg->r.computed;
+ Geom::Point c (rg->cx.computed, rg->cy.computed);
+ pos = Geom::L2(p - c) / rg->r.computed;
r = radius / rg->r.computed;
}
guint32 stroke_goal, bool do_stroke,
float opacity_goal, bool do_opacity,
bool do_blur, bool reverse,
- NR::Point p, double radius, double force,
+ Geom::Point p, double radius, double force,
bool do_h, bool do_s, bool do_l, bool do_o)
{
bool did = false;
Geom::Rect brush(p - Geom::Point(radius, radius), p + Geom::Point(radius, radius));
- NR::Point center = bbox->midpoint();
+ Geom::Point center = bbox->midpoint();
double this_force;
// if item == item_at_point, use max force
// else if object > 0.5 brush: test 4 corners of bbox and center on being in the brush, choose max
// else if still smaller, then check only the object center:
} else {
- this_force = force * tweak_profile (NR::L2 (p - center), radius);
+ this_force = force * tweak_profile (Geom::L2 (p - center), radius);
}
if (this_force > 0.002) {
bool
-sp_tweak_dilate (SPTweakContext *tc, NR::Point event_p, NR::Point p, NR::Point vector, bool reverse)
+sp_tweak_dilate (SPTweakContext *tc, Geom::Point event_p, Geom::Point p, Geom::Point vector, bool reverse)
{
Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(tc)->desktop);
SPDesktop *desktop = SP_EVENT_CONTEXT(tc)->desktop;
sp_tweak_update_area (SPTweakContext *tc)
{
double radius = get_dilate_radius(tc);
- NR::Matrix const sm (Geom::Scale(radius, radius) * Geom::Translate(SP_EVENT_CONTEXT(tc)->desktop->point()));
+ Geom::Matrix const sm (Geom::Scale(radius, radius) * Geom::Translate(SP_EVENT_CONTEXT(tc)->desktop->point()));
sp_canvas_item_affine_absolute(tc->dilate_area, sm);
sp_canvas_item_show(tc->dilate_area);
}
return TRUE;
}
- NR::Point const button_w(event->button.x,
+ Geom::Point const button_w(event->button.x,
event->button.y);
- NR::Point const button_dt(desktop->w2d(button_w));
+ Geom::Point const button_dt(desktop->w2d(button_w));
tc->last_push = desktop->dt2doc(button_dt);
sp_tweak_extinput(tc, event);
break;
case GDK_MOTION_NOTIFY:
{
- NR::Point const motion_w(event->motion.x,
+ Geom::Point const motion_w(event->motion.x,
event->motion.y);
- NR::Point motion_dt(desktop->w2d(motion_w));
- NR::Point motion_doc(desktop->dt2doc(motion_dt));
+ Geom::Point motion_dt(desktop->w2d(motion_w));
+ Geom::Point motion_doc(desktop->dt2doc(motion_dt));
sp_tweak_extinput(tc, event);
// draw the dilating cursor
double radius = get_dilate_radius(tc);
- NR::Matrix const sm (Geom::Scale(radius, radius) * Geom::Translate(desktop->w2d(motion_w)));
+ Geom::Matrix const sm (Geom::Scale(radius, radius) * Geom::Translate(desktop->w2d(motion_w)));
sp_canvas_item_affine_absolute(tc->dilate_area, sm);
sp_canvas_item_show(tc->dilate_area);
case GDK_BUTTON_RELEASE:
{
- NR::Point const motion_w(event->button.x, event->button.y);
- NR::Point const motion_dt(desktop->w2d(motion_w));
+ Geom::Point const motion_w(event->button.x, event->button.y);
+ Geom::Point const motion_dt(desktop->w2d(motion_w));
sp_canvas_end_forced_full_redraws(desktop->canvas);
tc->is_drawing = false;
if (!tc->has_dilated) {
// if we did not rub, do a light tap
tc->pressure = 0.03;
- sp_tweak_dilate (tc, motion_w, desktop->dt2doc(motion_dt), NR::Point(0,0), MOD__SHIFT);
+ sp_tweak_dilate (tc, motion_w, desktop->dt2doc(motion_dt), Geom::Point(0,0), MOD__SHIFT);
}
tc->is_dilating = false;
tc->has_dilated = false;
diff --git a/src/tweak-context.h b/src/tweak-context.h
index b5a9b6b7e92762fb2fd98bc76f85da04b450e64c..e860fd7ea36bf0d67d51b04b77e92fa71a005468 100644 (file)
--- a/src/tweak-context.h
+++ b/src/tweak-context.h
bool is_dilating;
bool has_dilated;
- NR::Point last_push;
+ Geom::Point last_push;
SPCanvasItem *dilate_area;
bool do_h;