summaryrefslogtreecommitdiffstats
path: root/src/gradient-drag.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2012-12-16 05:41:25 +0000
committer~suv <suv-sf@users.sourceforge.net>2012-12-16 05:41:25 +0000
commit7ec903c9898f872dbd9426ed7a62e1969fdb7be7 (patch)
treea306139e829118a83516af02279c9eafd3440eaa /src/gradient-drag.cpp
parentHershey Text: whitespace; py: docstring, modeline; inx: fix attribute value (diff)
parentTranslations.Spanish translation update by Lucas Vieites. (diff)
downloadinkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.tar.gz
inkscape-7ec903c9898f872dbd9426ed7a62e1969fdb7be7.zip
merge from trunk (r11955)
(bzr r11687.1.3)
Diffstat (limited to 'src/gradient-drag.cpp')
-rw-r--r--src/gradient-drag.cpp221
1 files changed, 116 insertions, 105 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index c72e47350..904c3b349 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -132,7 +132,7 @@ static void gr_drag_sel_modified(Inkscape::Selection */*selection*/, guint /*fla
* skip), and fill the \a style with the averaged color of all draggables of the selected dragger, if
* any.
*/
-int gr_drag_style_query(SPStyle *style, int property, gpointer data)
+static int gr_drag_style_query(SPStyle *style, int property, gpointer data)
{
GrDrag *drag = (GrDrag *) data;
@@ -2080,28 +2080,33 @@ void GrDrag::updateDraggers()
if (style && (style->fill.isPaintserver())) {
SPPaintServer *server = style->getFillPaintServer();
- if ( server && server->isSolid() ) {
- // Suppress "gradientness" of solid paint
- } else if ( SP_IS_LINEARGRADIENT(server) ) {
- addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_FILL );
- } else if ( SP_IS_RADIALGRADIENT(server) ) {
- addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_FILL );
- } else if ( SP_IS_MESHGRADIENT(server) ) {
- addDraggersMesh( SP_MESHGRADIENT(server), item, Inkscape::FOR_FILL );
+ if ( server && SP_IS_GRADIENT( server ) ) {
+ if ( server->isSolid()
+ || (SP_GRADIENT(server)->getVector() && SP_GRADIENT(server)->getVector()->isSolid())) {
+ // Suppress "gradientness" of solid paint
+ } else if ( SP_IS_LINEARGRADIENT(server) ) {
+ addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_FILL );
+ } else if ( SP_IS_RADIALGRADIENT(server) ) {
+ addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_FILL );
+ } else if ( SP_IS_MESHGRADIENT(server) ) {
+ addDraggersMesh( SP_MESHGRADIENT(server), item, Inkscape::FOR_FILL );
+ }
}
-
}
if (style && (style->stroke.isPaintserver())) {
SPPaintServer *server = style->getStrokePaintServer();
- if ( server && server->isSolid() ) {
- // Suppress "gradientness" of solid paint
- } else if ( SP_IS_LINEARGRADIENT(server) ) {
- addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_STROKE );
- } else if ( SP_IS_RADIALGRADIENT(server) ) {
- addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_STROKE );
- } else if ( SP_IS_MESHGRADIENT(server) ) {
- addDraggersMesh( SP_MESHGRADIENT(server), item, Inkscape::FOR_STROKE );
+ if ( server && SP_IS_GRADIENT( server ) ) {
+ if ( server->isSolid()
+ || (SP_GRADIENT(server)->getVector() && SP_GRADIENT(server)->getVector()->isSolid())) {
+ // Suppress "gradientness" of solid paint
+ } else if ( SP_IS_LINEARGRADIENT(server) ) {
+ addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_STROKE );
+ } else if ( SP_IS_RADIALGRADIENT(server) ) {
+ addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_STROKE );
+ } else if ( SP_IS_MESHGRADIENT(server) ) {
+ addDraggersMesh( SP_MESHGRADIENT(server), item, Inkscape::FOR_STROKE );
+ }
}
}
}
@@ -2145,58 +2150,61 @@ void GrDrag::updateLines()
if (style && (style->fill.isPaintserver())) {
SPPaintServer *server = item->style->getFillPaintServer();
- if ( server && server->isSolid() ) {
- // Suppress "gradientness" of solid paint
- } else if ( SP_IS_LINEARGRADIENT(server) ) {
- addLine(item, getGradientCoords(item, POINT_LG_BEGIN, 0, Inkscape::FOR_FILL), getGradientCoords(item, POINT_LG_END, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
- } else if ( SP_IS_RADIALGRADIENT(server) ) {
- Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_FILL);
- addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
- addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
- } else if ( SP_IS_MESHGRADIENT(server) ) {
-
- SPMeshGradient *mg = SP_MESHGRADIENT(server);
-
- guint rows = mg->array.patch_rows();
- guint columns = mg->array.patch_columns();
- for ( guint i = 0; i < rows; ++i ) {
- for ( guint j = 0; j < columns; ++j ) {
-
- std::vector<Geom::Point> h;
-
- SPMeshPatchI patch( &(mg->array.nodes), i, j );
-
- // Top line
- h = patch.getPointsForSide( 0 );
- for( guint p = 0; p < 4; ++p ) {
- h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
- }
- addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_FILL );
-
- // Right line
- if( j == columns - 1 ) {
- h = patch.getPointsForSide( 1 );
+ if ( server && SP_IS_GRADIENT( server ) ) {
+ if ( server->isSolid()
+ || (SP_GRADIENT(server)->getVector() && SP_GRADIENT(server)->getVector()->isSolid())) {
+ // Suppress "gradientness" of solid paint
+ } else if ( SP_IS_LINEARGRADIENT(server) ) {
+ addLine(item, getGradientCoords(item, POINT_LG_BEGIN, 0, Inkscape::FOR_FILL), getGradientCoords(item, POINT_LG_END, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
+ } else if ( SP_IS_RADIALGRADIENT(server) ) {
+ Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_FILL);
+ addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
+ addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
+ } else if ( SP_IS_MESHGRADIENT(server) ) {
+
+ SPMeshGradient *mg = SP_MESHGRADIENT(server);
+
+ guint rows = mg->array.patch_rows();
+ guint columns = mg->array.patch_columns();
+ for ( guint i = 0; i < rows; ++i ) {
+ for ( guint j = 0; j < columns; ++j ) {
+
+ std::vector<Geom::Point> h;
+
+ SPMeshPatchI patch( &(mg->array.nodes), i, j );
+
+ // Top line
+ h = patch.getPointsForSide( 0 );
for( guint p = 0; p < 4; ++p ) {
h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
}
addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_FILL );
- }
- // Bottom line
- if( i == rows - 1 ) {
- h = patch.getPointsForSide( 2 );
+ // Right line
+ if( j == columns - 1 ) {
+ h = patch.getPointsForSide( 1 );
+ for( guint p = 0; p < 4; ++p ) {
+ h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
+ }
+ addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_FILL );
+ }
+
+ // Bottom line
+ if( i == rows - 1 ) {
+ h = patch.getPointsForSide( 2 );
+ for( guint p = 0; p < 4; ++p ) {
+ h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
+ }
+ addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_FILL );
+ }
+
+ // Left line
+ h = patch.getPointsForSide( 3 );
for( guint p = 0; p < 4; ++p ) {
h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
}
addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_FILL );
}
-
- // Left line
- h = patch.getPointsForSide( 3 );
- for( guint p = 0; p < 4; ++p ) {
- h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
- }
- addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_FILL );
}
}
}
@@ -2204,61 +2212,64 @@ void GrDrag::updateLines()
if (style && (style->stroke.isPaintserver())) {
SPPaintServer *server = item->style->getStrokePaintServer();
- if ( server && server->isSolid() ) {
- // Suppress "gradientness" of solid paint
- } else if ( SP_IS_LINEARGRADIENT(server) ) {
- addLine(item, getGradientCoords(item, POINT_LG_BEGIN, 0, Inkscape::FOR_STROKE), getGradientCoords(item, POINT_LG_END, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
- } else if ( SP_IS_RADIALGRADIENT(server) ) {
- Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_STROKE);
- addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
- addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
- } else if ( SP_IS_MESHGRADIENT(server) ) {
-
- // MESH FIXME: TURN ROUTINE INTO FUNCTION AND CALL FOR BOTH FILL AND STROKE.
- SPMeshGradient *mg = SP_MESHGRADIENT(server);
-
- guint rows = mg->array.patch_rows();
- guint columns = mg->array.patch_columns();
- for ( guint i = 0; i < rows; ++i ) {
- for ( guint j = 0; j < columns; ++j ) {
-
- std::vector<Geom::Point> h;
-
- SPMeshPatchI patch( &(mg->array.nodes), i, j );
-
- // Top line
- h = patch.getPointsForSide( 0 );
- for( guint p = 0; p < 4; ++p ) {
- h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
- }
- addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_STROKE );
-
- // Right line
- if( j == columns - 1 ) {
- h = patch.getPointsForSide( 1 );
+ if ( server && SP_IS_GRADIENT( server ) ) {
+ if ( server->isSolid()
+ || (SP_GRADIENT(server)->getVector() && SP_GRADIENT(server)->getVector()->isSolid())) {
+ // Suppress "gradientness" of solid paint
+ } else if ( SP_IS_LINEARGRADIENT(server) ) {
+ addLine(item, getGradientCoords(item, POINT_LG_BEGIN, 0, Inkscape::FOR_STROKE), getGradientCoords(item, POINT_LG_END, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
+ } else if ( SP_IS_RADIALGRADIENT(server) ) {
+ Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_STROKE);
+ addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
+ addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
+ } else if ( SP_IS_MESHGRADIENT(server) ) {
+
+ // MESH FIXME: TURN ROUTINE INTO FUNCTION AND CALL FOR BOTH FILL AND STROKE.
+ SPMeshGradient *mg = SP_MESHGRADIENT(server);
+
+ guint rows = mg->array.patch_rows();
+ guint columns = mg->array.patch_columns();
+ for ( guint i = 0; i < rows; ++i ) {
+ for ( guint j = 0; j < columns; ++j ) {
+
+ std::vector<Geom::Point> h;
+
+ SPMeshPatchI patch( &(mg->array.nodes), i, j );
+
+ // Top line
+ h = patch.getPointsForSide( 0 );
for( guint p = 0; p < 4; ++p ) {
h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
}
addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_STROKE );
- }
- // Bottom line
- if( i == rows - 1 ) {
- h = patch.getPointsForSide( 2 );
+ // Right line
+ if( j == columns - 1 ) {
+ h = patch.getPointsForSide( 1 );
+ for( guint p = 0; p < 4; ++p ) {
+ h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
+ }
+ addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_STROKE );
+ }
+
+ // Bottom line
+ if( i == rows - 1 ) {
+ h = patch.getPointsForSide( 2 );
+ for( guint p = 0; p < 4; ++p ) {
+ h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
+ }
+ addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_STROKE );
+ }
+
+ // Left line
+ h = patch.getPointsForSide( 3 );
for( guint p = 0; p < 4; ++p ) {
h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
}
addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_STROKE );
}
-
- // Left line
- h = patch.getPointsForSide( 3 );
- for( guint p = 0; p < 4; ++p ) {
- h[p] *= Geom::Affine(mg->gradientTransform) * (Geom::Affine)item->i2dt_affine();
- }
- addCurve (item, h[0], h[1], h[2], h[3], Inkscape::FOR_STROKE );
- }
- }
+ }
+ }
}
}
}