Comment 9 for bug 517082

Revision history for this message
jazzynico (jazzynico) wrote :

> Does that make sense?

Yes, thanks. But I wonder if we really need all that. All the bitmap work is done in Crop::applyEffect, and I could also scale the object directly in the ImageMagic::Effect loop. Here's what I've started to do (far from being finished...):

    // Image size before effect
    unsigned int cols_before = effectedImage.columns();
    unsigned int rows_before = effectedImage.rows();

    applyEffect(&effectedImage);

    float cols_ratio = (float)rows_before / effectedImage.columns();
    float rows_ratio = (float)cols_before / effectedImage.rows();

    // The effect changed the image size, let's change the SVG height and width
    if (cols_ratio != 1 and rows_ratio != 1) {
        printf("Image %i: height reduced by %f", i, rows_ratio);
        printf(", width reduced by %f\n", cols_ratio);

   /*
   // From transformation.cpp
   SPItem *item = SP_ITEM(l->data);
   Geom::Scale scale (0,0);
   double new_width = scaleX;
   if (fabs(new_width) < 1e-6) new_width = 1e-6;
   double new_height = scaleY;
   if (fabs(new_height) < 1e-6) new_height = 1e-6;
   scale = Geom::Scale(new_width / 100.0, new_height / 100.0);
   sp_item_scale_rel (item, scale);
   */

   }