index 057877daf61ee76272b084c79443f22fb84d63b8..4abd7483f42207c2c968d39e51e4ea5c8da17992 100644 (file)
#include "sp-tspan.h"
#include <libnr/nr-matrix-fns.h>
#include <libnr/nr-point-fns.h>
+#include <libnr/nr-matrix-ops.h>
+#include <libnr/nr-rotate-ops.h>
+#include <2geom/transforms.h>
#include "xml/repr.h"
#include "svg/svg.h"
#include "svg/svg-color.h"
#include "svg/css-ostringstream.h"
-#include "prefs-utils.h"
+#include "preferences.h"
// Terminology:
/* If gr hrefs some other gradient, remove the href */
if (gr->ref->getObject()) {
/* We are hrefing someone, so require flattening */
- SP_OBJECT(gr)->updateRepr(((SPObject *) gr)->repr, SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL);
+ SP_OBJECT(gr)->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL);
sp_gradient_repr_set_link(SP_OBJECT_REPR(gr), NULL);
}
sp_gradient_fork_vector_if_necessary (SPGradient *gr)
{
// Some people actually prefer their gradient vectors to be shared...
- if (prefs_get_int_attribute("options.forkgradientvectors", "value", 1) == 0)
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ if (!prefs->getBool("/options/forkgradientvectors/value", true))
return gr;
if (SP_OBJECT_HREFCOUNT(gr) > 1) {
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
+ Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
- if ( !bbox || bbox->isEmpty() )
+ if (!bbox)
return gr;
- NR::Coord const width = bbox->dimensions()[NR::X];
- NR::Coord const height = bbox->dimensions()[NR::Y];
+ Geom::Coord const width = bbox->dimensions()[Geom::X];
+ Geom::Coord const height = bbox->dimensions()[Geom::Y];
- NR::Point const center = bbox->midpoint();
+ Geom::Point const center = bbox->midpoint();
if (SP_IS_RADIALGRADIENT(gr)) {
- sp_repr_set_svg_double(repr, "cx", center[NR::X]);
- sp_repr_set_svg_double(repr, "cy", center[NR::Y]);
- sp_repr_set_svg_double(repr, "fx", center[NR::X]);
- sp_repr_set_svg_double(repr, "fy", center[NR::Y]);
+ sp_repr_set_svg_double(repr, "cx", center[Geom::X]);
+ sp_repr_set_svg_double(repr, "cy", center[Geom::Y]);
+ sp_repr_set_svg_double(repr, "fx", center[Geom::X]);
+ sp_repr_set_svg_double(repr, "fy", center[Geom::Y]);
sp_repr_set_svg_double(repr, "r", width/2);
// we want it to be elliptic, not circular
- NR::Matrix squeeze = NR::Matrix (NR::translate (-center)) *
- NR::Matrix (NR::scale(1, height/width)) *
- NR::Matrix (NR::translate (center));
+ Geom::Matrix squeeze = Geom::Translate (-center) *
+ Geom::Scale(1, height/width) *
+ Geom::Translate (center);
gr->gradientTransform = squeeze;
{
g_free(c);
}
} else {
- sp_repr_set_svg_double(repr, "x1", (center - NR::Point(width/2, 0))[NR::X]);
- sp_repr_set_svg_double(repr, "y1", (center - NR::Point(width/2, 0))[NR::Y]);
- sp_repr_set_svg_double(repr, "x2", (center + NR::Point(width/2, 0))[NR::X]);
- sp_repr_set_svg_double(repr, "y2", (center + NR::Point(width/2, 0))[NR::Y]);
+ sp_repr_set_svg_double(repr, "x1", (center - Geom::Point(width/2, 0))[Geom::X]);
+ sp_repr_set_svg_double(repr, "y1", (center - Geom::Point(width/2, 0))[Geom::Y]);
+ sp_repr_set_svg_double(repr, "x2", (center + Geom::Point(width/2, 0))[Geom::X]);
+ sp_repr_set_svg_double(repr, "y2", (center + Geom::Point(width/2, 0))[Geom::Y]);
}
// set the gradientUnits
@@ -341,15 +345,15 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Matrix bbox2user;
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
- if ( bbox && !bbox->isEmpty() ) {
- bbox2user = NR::Matrix(bbox->dimensions()[NR::X], 0,
- 0, bbox->dimensions()[NR::Y],
- bbox->min()[NR::X], bbox->min()[NR::Y]);
+ Geom::Matrix bbox2user;
+ Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
+ if ( bbox ) {
+ bbox2user = Geom::Matrix(bbox->dimensions()[Geom::X], 0,
+ 0, bbox->dimensions()[Geom::Y],
+ bbox->min()[Geom::X], bbox->min()[Geom::Y]);
} else {
// would be degenerate otherwise
- bbox2user = NR::identity();
+ bbox2user = Geom::identity();
}
/* skew is the additional transform, defined by the proportions of the item, that we need
@@ -366,8 +370,8 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
* gradient vector in user space due to application of the non-uniform scaling
* transformation from bounding box space to user space.
*/
- NR::Matrix skew = bbox2user;
- double exp = NR::expansion(skew);
+ Geom::Matrix skew = bbox2user;
+ double exp = skew.descrim();
skew[0] /= exp;
skew[1] /= exp;
skew[2] /= exp;
@@ -385,40 +389,40 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// Matrix to convert points to userspace coords; postmultiply by inverse of skew so
// as to cancel it out when it's applied to the gradient during rendering
- NR::Matrix point_convert = bbox2user * skew.inverse();
+ Geom::Matrix point_convert = bbox2user * skew.inverse();
if (SP_IS_RADIALGRADIENT(gr)) {
SPRadialGradient *rg = SP_RADIALGRADIENT(gr);
// original points in the bbox coords
- NR::Point c_b = NR::Point(rg->cx.computed, rg->cy.computed);
- NR::Point f_b = NR::Point(rg->fx.computed, rg->fy.computed);
+ Geom::Point c_b = Geom::Point(rg->cx.computed, rg->cy.computed);
+ Geom::Point f_b = Geom::Point(rg->fx.computed, rg->fy.computed);
double r_b = rg->r.computed;
// converted points in userspace coords
- NR::Point c_u = c_b * point_convert;
- NR::Point f_u = f_b * point_convert;
- double r_u = r_b * NR::expansion(point_convert);
-
- sp_repr_set_svg_double(repr, "cx", c_u[NR::X]);
- sp_repr_set_svg_double(repr, "cy", c_u[NR::Y]);
- sp_repr_set_svg_double(repr, "fx", f_u[NR::X]);
- sp_repr_set_svg_double(repr, "fy", f_u[NR::Y]);
+ Geom::Point c_u = c_b * point_convert;
+ Geom::Point f_u = f_b * point_convert;
+ double r_u = r_b * point_convert.descrim();
+
+ sp_repr_set_svg_double(repr, "cx", c_u[Geom::X]);
+ sp_repr_set_svg_double(repr, "cy", c_u[Geom::Y]);
+ sp_repr_set_svg_double(repr, "fx", f_u[Geom::X]);
+ sp_repr_set_svg_double(repr, "fy", f_u[Geom::Y]);
sp_repr_set_svg_double(repr, "r", r_u);
} else {
SPLinearGradient *lg = SP_LINEARGRADIENT(gr);
- NR::Point p1_b = NR::Point(lg->x1.computed, lg->y1.computed);
- NR::Point p2_b = NR::Point(lg->x2.computed, lg->y2.computed);
+ Geom::Point p1_b = Geom::Point(lg->x1.computed, lg->y1.computed);
+ Geom::Point p2_b = Geom::Point(lg->x2.computed, lg->y2.computed);
- NR::Point p1_u = p1_b * point_convert;
- NR::Point p2_u = p2_b * point_convert;
+ Geom::Point p1_u = p1_b * point_convert;
+ Geom::Point p2_u = p2_b * point_convert;
- sp_repr_set_svg_double(repr, "x1", p1_u[NR::X]);
- sp_repr_set_svg_double(repr, "y1", p1_u[NR::Y]);
- sp_repr_set_svg_double(repr, "x2", p2_u[NR::X]);
- sp_repr_set_svg_double(repr, "y2", p2_u[NR::Y]);
+ sp_repr_set_svg_double(repr, "x1", p1_u[Geom::X]);
+ sp_repr_set_svg_double(repr, "y1", p1_u[Geom::Y]);
+ sp_repr_set_svg_double(repr, "x2", p2_u[Geom::X]);
+ sp_repr_set_svg_double(repr, "y2", p2_u[Geom::Y]);
}
// set the gradientUnits
@@ -439,7 +443,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
}
void
-sp_gradient_transform_multiply(SPGradient *gradient, NR::Matrix postmul, bool set)
+sp_gradient_transform_multiply(SPGradient *gradient, Geom::Matrix postmul, bool set)
{
if (set) {
gradient->gradientTransform = postmul;
sp_get_stop_i(SPGradient *gradient, guint stop_i)
{
SPStop *stop = sp_first_stop (gradient);
+
+ // if this is valid but weird gradient without an offset-zero stop element,
+ // inkscape has created a handle for the start of gradient anyway,
+ // so when it asks for stop N that corresponds to stop element N-1
+ if (stop->offset != 0)
+ stop_i --;
for (guint i=0; i < stop_i; i++) {
if (!stop) return NULL;
@@ -809,7 +819,7 @@ Set the position of point point_type of the gradient applied to item (either fil
p_w (in desktop coordinates). Write_repr if you want the change to become permanent.
*/
void
-sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::Point p_w, bool fill_or_stroke, bool write_repr, bool scale)
+sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, Geom::Point p_w, bool fill_or_stroke, bool write_repr, bool scale)
{
SPGradient *gradient = sp_item_gradient (item, fill_or_stroke);
@@ -818,8 +828,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
gradient = sp_gradient_convert_to_userspace (gradient, item, fill_or_stroke? "fill" : "stroke");
- NR::Matrix i2d = sp_item_i2d_affine (item);
- NR::Point p = p_w * i2d.inverse();
+ Geom::Matrix i2d (sp_item_i2d_affine (item));
+ Geom::Point p = p_w * i2d.inverse();
p *= (gradient->gradientTransform).inverse();
// now p is in gradient's original coordinates
@@ -830,11 +840,11 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
switch (point_type) {
case POINT_LG_BEGIN:
if (scale) {
- lg->x2.computed += (lg->x1.computed - p[NR::X]);
- lg->y2.computed += (lg->y1.computed - p[NR::Y]);
+ lg->x2.computed += (lg->x1.computed - p[Geom::X]);
+ lg->y2.computed += (lg->y1.computed - p[Geom::Y]);
}
- lg->x1.computed = p[NR::X];
- lg->y1.computed = p[NR::Y];
+ lg->x1.computed = p[Geom::X];
+ lg->y1.computed = p[Geom::Y];
if (write_repr) {
if (scale) {
sp_repr_set_svg_double(repr, "x2", lg->x2.computed);
@@ -848,11 +858,11 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
break;
case POINT_LG_END:
if (scale) {
- lg->x1.computed += (lg->x2.computed - p[NR::X]);
- lg->y1.computed += (lg->y2.computed - p[NR::Y]);
+ lg->x1.computed += (lg->x2.computed - p[Geom::X]);
+ lg->y1.computed += (lg->y2.computed - p[Geom::Y]);
}
- lg->x2.computed = p[NR::X];
- lg->y2.computed = p[NR::Y];
+ lg->x2.computed = p[Geom::X];
+ lg->y2.computed = p[Geom::Y];
if (write_repr) {
if (scale) {
sp_repr_set_svg_double(repr, "x1", lg->x1.computed);
@@ -867,7 +877,7 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
case POINT_LG_MID:
{
// using X-coordinates only to determine the offset, assuming p has been snapped to the vector from begin to end.
- double offset = get_offset_between_points (p, NR::Point(lg->x1.computed, lg->y1.computed), NR::Point(lg->x2.computed, lg->y2.computed));
+ double offset = get_offset_between_points (p, Geom::Point(lg->x1.computed, lg->y1.computed), Geom::Point(lg->x2.computed, lg->y2.computed));
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (lg, false);
sp_gradient_ensure_vector(lg);
lg->vector.stops.at(point_i).offset = offset;
@@ -885,21 +895,21 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
} else if (SP_IS_RADIALGRADIENT(gradient)) {
SPRadialGradient *rg = SP_RADIALGRADIENT(gradient);
- NR::Point c (rg->cx.computed, rg->cy.computed);
- NR::Point c_w = c * gradient->gradientTransform * i2d; // now in desktop coords
- if ((point_type == POINT_RG_R1 || point_type == POINT_RG_R2) && NR::L2 (p_w - c_w) < 1e-3) {
+ Geom::Point c (rg->cx.computed, rg->cy.computed);
+ Geom::Point c_w = c * gradient->gradientTransform * i2d; // now in desktop coords
+ if ((point_type == POINT_RG_R1 || point_type == POINT_RG_R2) && Geom::L2 (p_w - c_w) < 1e-3) {
// prevent setting a radius too close to the center
return;
}
- NR::Matrix new_transform;
+ Geom::Matrix new_transform;
bool transform_set = false;
switch (point_type) {
case POINT_RG_CENTER:
- rg->fx.computed = p[NR::X] + (rg->fx.computed - rg->cx.computed);
- rg->fy.computed = p[NR::Y] + (rg->fy.computed - rg->cy.computed);
- rg->cx.computed = p[NR::X];
- rg->cy.computed = p[NR::Y];
+ rg->fx.computed = p[Geom::X] + (rg->fx.computed - rg->cx.computed);
+ rg->fy.computed = p[Geom::Y] + (rg->fy.computed - rg->cy.computed);
+ rg->cx.computed = p[Geom::X];
+ rg->cy.computed = p[Geom::Y];
if (write_repr) {
sp_repr_set_svg_double(repr, "fx", rg->fx.computed);
sp_repr_set_svg_double(repr, "fy", rg->fy.computed);
@@ -910,8 +920,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
break;
case POINT_RG_FOCUS:
- rg->fx.computed = p[NR::X];
- rg->fy.computed = p[NR::Y];
+ rg->fx.computed = p[Geom::X];
+ rg->fy.computed = p[Geom::Y];
if (write_repr) {
sp_repr_set_svg_double(repr, "fx", rg->fx.computed);
sp_repr_set_svg_double(repr, "fy", rg->fy.computed);
@@ -921,17 +931,17 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
break;
case POINT_RG_R1:
{
- NR::Point r1_w = (c + NR::Point(rg->r.computed, 0)) * gradient->gradientTransform * i2d;
- double r1_angle = NR::atan2(r1_w - c_w);
- double move_angle = NR::atan2(p_w - c_w) - r1_angle;
- double move_stretch = NR::L2(p_w - c_w) / NR::L2(r1_w - c_w);
-
- NR::Matrix move = NR::Matrix (NR::translate (-c_w)) *
- NR::Matrix (NR::rotate(-r1_angle)) *
- NR::Matrix (NR::scale(move_stretch, scale? move_stretch : 1)) *
- NR::Matrix (NR::rotate(r1_angle)) *
- NR::Matrix (NR::rotate(move_angle)) *
- NR::Matrix (NR::translate (c_w));
+ Geom::Point r1_w = (c + Geom::Point(rg->r.computed, 0)) * gradient->gradientTransform * i2d;
+ double r1_angle = Geom::atan2(r1_w - c_w);
+ double move_angle = Geom::atan2(p_w - c_w) - r1_angle;
+ double move_stretch = Geom::L2(p_w - c_w) / Geom::L2(r1_w - c_w);
+
+ Geom::Matrix move = Geom::Matrix (Geom::Translate (-c_w)) *
+ Geom::Matrix (Geom::Rotate(-r1_angle)) *
+ Geom::Matrix (Geom::Scale(move_stretch, scale? move_stretch : 1)) *
+ Geom::Matrix (Geom::Rotate(r1_angle)) *
+ Geom::Matrix (Geom::Rotate(move_angle)) *
+ Geom::Matrix (Geom::Translate (c_w));
new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
transform_set = true;
@@ -940,17 +950,17 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
case POINT_RG_R2:
{
- NR::Point r2_w = (c + NR::Point(0, -rg->r.computed)) * gradient->gradientTransform * i2d;
- double r2_angle = NR::atan2(r2_w - c_w);
- double move_angle = NR::atan2(p_w - c_w) - r2_angle;
- double move_stretch = NR::L2(p_w - c_w) / NR::L2(r2_w - c_w);
-
- NR::Matrix move = NR::Matrix (NR::translate (-c_w)) *
- NR::Matrix (NR::rotate(-r2_angle)) *
- NR::Matrix (NR::scale(move_stretch, scale? move_stretch : 1)) *
- NR::Matrix (NR::rotate(r2_angle)) *
- NR::Matrix (NR::rotate(move_angle)) *
- NR::Matrix (NR::translate (c_w));
+ Geom::Point r2_w = (c + Geom::Point(0, -rg->r.computed)) * gradient->gradientTransform * i2d;
+ double r2_angle = Geom::atan2(r2_w - c_w);
+ double move_angle = Geom::atan2(p_w - c_w) - r2_angle;
+ double move_stretch = Geom::L2(p_w - c_w) / Geom::L2(r2_w - c_w);
+
+ Geom::Matrix move = Geom::Matrix (Geom::Translate (-c_w)) *
+ Geom::Matrix (Geom::Rotate(-r2_angle)) *
+ Geom::Matrix (Geom::Scale(move_stretch, scale? move_stretch : 1)) *
+ Geom::Matrix (Geom::Rotate(r2_angle)) *
+ Geom::Matrix (Geom::Rotate(move_angle)) *
+ Geom::Matrix (Geom::Translate (c_w));
new_transform = gradient->gradientTransform * i2d * move * i2d.inverse();
transform_set = true;
@@ -959,8 +969,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
}
case POINT_RG_MID1:
{
- NR::Point start = NR::Point (rg->cx.computed, rg->cy.computed);
- NR::Point end = NR::Point (rg->cx.computed + rg->r.computed, rg->cy.computed);
+ Geom::Point start = Geom::Point (rg->cx.computed, rg->cy.computed);
+ Geom::Point end = Geom::Point (rg->cx.computed + rg->r.computed, rg->cy.computed);
double offset = get_offset_between_points (p, start, end);
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (rg, false);
sp_gradient_ensure_vector(rg);
@@ -975,8 +985,8 @@ sp_item_gradient_set_coords (SPItem *item, guint point_type, guint point_i, NR::
break;
}
case POINT_RG_MID2:
- NR::Point start = NR::Point (rg->cx.computed, rg->cy.computed);
- NR::Point end = NR::Point (rg->cx.computed, rg->cy.computed - rg->r.computed);
+ Geom::Point start = Geom::Point (rg->cx.computed, rg->cy.computed);
+ Geom::Point end = Geom::Point (rg->cx.computed, rg->cy.computed - rg->r.computed);
double offset = get_offset_between_points (p, start, end);
SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(rg, false);
sp_gradient_ensure_vector(rg);
@@ -1030,29 +1040,29 @@ Returns the position of point point_type of the gradient applied to item (either
in desktop coordinates.
*/
-NR::Point
+Geom::Point
sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool fill_or_stroke)
{
SPGradient *gradient = sp_item_gradient (item, fill_or_stroke);
- NR::Point p (0, 0);
+ Geom::Point p (0, 0);
if (!gradient)
- return p;
+ return from_2geom(p);
if (SP_IS_LINEARGRADIENT(gradient)) {
SPLinearGradient *lg = SP_LINEARGRADIENT(gradient);
switch (point_type) {
case POINT_LG_BEGIN:
- p = NR::Point (lg->x1.computed, lg->y1.computed);
+ p = Geom::Point (lg->x1.computed, lg->y1.computed);
break;
case POINT_LG_END:
- p = NR::Point (lg->x2.computed, lg->y2.computed);
+ p = Geom::Point (lg->x2.computed, lg->y2.computed);
break;
case POINT_LG_MID:
{
gdouble offset = lg->vector.stops.at(point_i).offset;
- p = (1-offset) * NR::Point(lg->x1.computed, lg->y1.computed) + offset * NR::Point(lg->x2.computed, lg->y2.computed);
+ p = (1-offset) * Geom::Point(lg->x1.computed, lg->y1.computed) + offset * Geom::Point(lg->x2.computed, lg->y2.computed);
}
break;
}
@@ -1060,27 +1070,27 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
SPRadialGradient *rg = SP_RADIALGRADIENT(gradient);
switch (point_type) {
case POINT_RG_CENTER:
- p = NR::Point (rg->cx.computed, rg->cy.computed);
+ p = Geom::Point (rg->cx.computed, rg->cy.computed);
break;
case POINT_RG_FOCUS:
- p = NR::Point (rg->fx.computed, rg->fy.computed);
+ p = Geom::Point (rg->fx.computed, rg->fy.computed);
break;
case POINT_RG_R1:
- p = NR::Point (rg->cx.computed + rg->r.computed, rg->cy.computed);
+ p = Geom::Point (rg->cx.computed + rg->r.computed, rg->cy.computed);
break;
case POINT_RG_R2:
- p = NR::Point (rg->cx.computed, rg->cy.computed - rg->r.computed);
+ p = Geom::Point (rg->cx.computed, rg->cy.computed - rg->r.computed);
break;
case POINT_RG_MID1:
{
gdouble offset = rg->vector.stops.at(point_i).offset;
- p = (1-offset) * NR::Point (rg->cx.computed, rg->cy.computed) + offset * NR::Point(rg->cx.computed + rg->r.computed, rg->cy.computed);
+ p = (1-offset) * Geom::Point (rg->cx.computed, rg->cy.computed) + offset * Geom::Point(rg->cx.computed + rg->r.computed, rg->cy.computed);
}
break;
case POINT_RG_MID2:
{
gdouble offset = rg->vector.stops.at(point_i).offset;
- p = (1-offset) * NR::Point (rg->cx.computed, rg->cy.computed) + offset * NR::Point(rg->cx.computed, rg->cy.computed - rg->r.computed);
+ p = (1-offset) * Geom::Point (rg->cx.computed, rg->cy.computed) + offset * Geom::Point(rg->cx.computed, rg->cy.computed - rg->r.computed);
}
break;
}
@@ -1088,15 +1098,15 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
if (SP_GRADIENT(gradient)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
+ Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine
if (bbox) {
- p *= NR::Matrix(bbox->dimensions()[NR::X], 0,
- 0, bbox->dimensions()[NR::Y],
- bbox->min()[NR::X], bbox->min()[NR::Y]);
+ p *= Geom::Matrix(bbox->dimensions()[Geom::X], 0,
+ 0, bbox->dimensions()[Geom::Y],
+ bbox->min()[Geom::X], bbox->min()[Geom::Y]);
}
}
- p *= NR::Matrix(gradient->gradientTransform) * sp_item_i2d_affine(item);
- return p;
+ p *= Geom::Matrix(gradient->gradientTransform) * (Geom::Matrix)sp_item_i2d_affine(item);
+ return from_2geom(p);
}