~christoffer-holmstedt/inkscape/test_git-bzr-ng

« back to all changes in this revision

Viewing changes to src/gradient-drag.cpp

  • Committer: tavmjong-free
  • Date: 2015-03-01 08:57:53 UTC
  • Revision ID: tavmjong@free.fr-20150301085753-6govems6ksac5sps
Rename <meshGradient> to <mesh>, <meshRow> to <meshrow>, <meshPatch> to <meshpatch>.
Remove experimental smoothing types. Add new smoothing 'type' attribute with bicubic smoothing option.
Per SVG WG decission at Sydney 2015 face-to-face meeting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include "knot.h"
44
44
#include "sp-linear-gradient.h"
45
45
#include "sp-radial-gradient.h"
46
 
#include "sp-mesh-gradient.h"
 
46
#include "sp-mesh.h"
47
47
#include "sp-mesh-row.h"
48
48
#include "sp-mesh-patch.h"
49
49
#include "gradient-chemistry.h"
414
414
                    //r1_knot = false;
415
415
                }
416
416
            }
417
 
        } else if (SP_IS_MESHGRADIENT(gradient)) {
 
417
        } else if (SP_IS_MESH(gradient)) {
418
418
 
419
419
            // add_stop_near_point()
420
420
            // Find out which curve pointer is over and use that curve to determine
422
422
            // This is silly as we already should know which line we are over...
423
423
            // but that information is not saved (sp_gradient_context_is_over_line).
424
424
 
425
 
            SPMeshGradient *mg = SP_MESHGRADIENT(gradient);
 
425
            SPMesh *mg = SP_MESH(gradient);
426
426
            Geom::Affine transform = Geom::Affine(mg->gradientTransform)*(Geom::Affine)item->i2dt_affine();
427
427
 
428
428
            guint rows    = mg->array.patch_rows();
550
550
 
551
551
        } else {
552
552
 
553
 
            SPMeshGradient *mg = SP_MESHGRADIENT(gradient);
 
553
            SPMesh *mg = SP_MESH(gradient);
554
554
 
555
555
            if( divide_row > -1 ) {
556
556
                mg->array.split_row( divide_row, divide_coord );
559
559
            }
560
560
 
561
561
            // Update repr
562
 
            sp_meshgradient_repr_write( mg );
 
562
            sp_mesh_repr_write( mg );
563
563
            mg->array.built = false;
564
564
            mg->ensureArray();
565
565
            // How do we do this?
1349
1349
 
1350
1350
                // Must be a mesh gradient
1351
1351
                SPGradient *gradient = getGradient(draggable->item, draggable->fill_or_stroke);
1352
 
                if ( !SP_IS_MESHGRADIENT( gradient ) ) continue;
 
1352
                if ( !SP_IS_MESH( gradient ) ) continue;
1353
1353
 
1354
1354
                selected_corners[ gradient ].push_back( draggable->point_i );
1355
1355
            }
1374
1374
 
1375
1375
        // Must be a mesh gradient
1376
1376
        SPGradient *gradient = getGradient(item, fill_or_stroke);
1377
 
        if ( !SP_IS_MESHGRADIENT( gradient ) ) continue;
1378
 
        SPMeshGradient *mg = SP_MESHGRADIENT( gradient );
 
1377
        if ( !SP_IS_MESH( gradient ) ) continue;
 
1378
        SPMesh *mg = SP_MESH( gradient );
1379
1379
 
1380
1380
        // pc_old is the old corner position in desktop coordinates, we need it in gradient coordinate.
1381
1381
        gradient = sp_gradient_convert_to_userspace (gradient, item, (fill_or_stroke == Inkscape::FOR_FILL) ? "fill" : "stroke");
1958
1958
/**
1959
1959
 *Add draggers for the mesh gradient mg on item
1960
1960
 */
1961
 
void GrDrag::addDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::PaintTarget fill_or_stroke)
 
1961
void GrDrag::addDraggersMesh(SPMesh *mg, SPItem *item, Inkscape::PaintTarget fill_or_stroke)
1962
1962
{
1963
1963
    std::vector< std::vector< SPMeshNode* > > nodes = mg->array.nodes;
1964
1964
 
1977
1977
    // Make sure we have at least one patch defined.
1978
1978
    if( mg->array.patch_rows() == 0 || mg->array.patch_columns() == 0 ) {
1979
1979
 
1980
 
        std::cout << "Empty Mesh Gradient, No Draggers to Add" << std::endl;
 
1980
        std::cout << "Empty Mesh, No Draggers to Add" << std::endl;
1981
1981
        return;
1982
1982
    }
1983
1983
 
2032
2032
                    }
2033
2033
 
2034
2034
                    default:
2035
 
                        std::cout << "Bad Mesh Gradient draggable type" << std::endl;
 
2035
                        std::cout << "Bad Mesh draggable type" << std::endl;
2036
2036
                        break;
2037
2037
                }
2038
2038
            }
2097
2097
                    addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_FILL );
2098
2098
                } else if ( SP_IS_RADIALGRADIENT(server) ) {
2099
2099
                    addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_FILL );
2100
 
                } else if ( SP_IS_MESHGRADIENT(server) ) {
2101
 
                    addDraggersMesh(   SP_MESHGRADIENT(server),   item, Inkscape::FOR_FILL );
 
2100
                } else if ( SP_IS_MESH(server) ) {
 
2101
                    addDraggersMesh(   SP_MESH(server),           item, Inkscape::FOR_FILL );
2102
2102
                }
2103
2103
            }
2104
2104
        }
2113
2113
                    addDraggersLinear( SP_LINEARGRADIENT(server), item, Inkscape::FOR_STROKE );
2114
2114
                } else if ( SP_IS_RADIALGRADIENT(server) ) {
2115
2115
                    addDraggersRadial( SP_RADIALGRADIENT(server), item, Inkscape::FOR_STROKE );
2116
 
                } else if ( SP_IS_MESHGRADIENT(server) ) {
2117
 
                    addDraggersMesh(   SP_MESHGRADIENT(server),   item, Inkscape::FOR_STROKE );
 
2116
                } else if ( SP_IS_MESH(server) ) {
 
2117
                    addDraggersMesh(   SP_MESH(server),           item, Inkscape::FOR_STROKE );
2118
2118
                }
2119
2119
            }
2120
2120
        }
2169
2169
                    Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_FILL);
2170
2170
                    addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
2171
2171
                    addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_FILL), Inkscape::FOR_FILL);
2172
 
                } else if ( SP_IS_MESHGRADIENT(server) ) {
 
2172
                } else if ( SP_IS_MESH(server) ) {
2173
2173
 
2174
 
                    SPMeshGradient *mg = SP_MESHGRADIENT(server);
 
2174
                    SPMesh *mg = SP_MESH(server);
2175
2175
 
2176
2176
                    guint rows    = mg->array.patch_rows();
2177
2177
                    guint columns = mg->array.patch_columns();
2231
2231
                    Geom::Point center = getGradientCoords(item, POINT_RG_CENTER, 0, Inkscape::FOR_STROKE);
2232
2232
                    addLine(item, center, getGradientCoords(item, POINT_RG_R1, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
2233
2233
                    addLine(item, center, getGradientCoords(item, POINT_RG_R2, 0, Inkscape::FOR_STROKE), Inkscape::FOR_STROKE);
2234
 
                } else if ( SP_IS_MESHGRADIENT(server) ) {
 
2234
                } else if ( SP_IS_MESH(server) ) {
2235
2235
 
2236
2236
                    // MESH FIXME: TURN ROUTINE INTO FUNCTION AND CALL FOR BOTH FILL AND STROKE.
2237
 
                    SPMeshGradient *mg = SP_MESHGRADIENT(server);
 
2237
                    SPMesh *mg = SP_MESH(server);
2238
2238
 
2239
2239
                    guint rows    = mg->array.patch_rows();
2240
2240
                    guint columns = mg->array.patch_columns();