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();
// 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);
> 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 columns( ); rows();
unsigned int cols_before = effectedImage.
unsigned int rows_before = effectedImage.
applyEffect (&effectedImage );
float cols_ratio = (float)rows_before / effectedImage. columns( ); rows();
float rows_ratio = (float)cols_before / effectedImage.
// The effect changed the image size, let's change the SVG height and width
printf( "Image %i: height reduced by %f", i, rows_ratio);
if (cols_ratio != 1 and rows_ratio != 1) {
printf(", width reduced by %f\n", cols_ratio);
/* new_width / 100.0, new_height / 100.0); scale_rel (item, scale);
// 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(
sp_item_
*/
}