+void resize_journal_items_by(GList *itemlist, double scaling_x, double scaling_y,
+ double offset_x, double offset_y)
+{
+ struct Item *item;
+ GList *list;
+ double mean_scaling, temp;
+ double *pt, *wid;
+ GnomeCanvasGroup *group;
+ int i;
+
+ /* geometric mean of x and y scalings = rescaling for stroke widths
+ and for text font sizes */
+ mean_scaling = sqrt(fabs(scaling_x * scaling_y));
+
+ for (list = itemlist; list != NULL; list = list->next) {
+ item = (struct Item *)list->data;
+ if (item->type == ITEM_STROKE) {
+ item->brush.thickness = item->brush.thickness * mean_scaling;
+ for (i=0, pt=item->path->coords; i<item->path->num_points; i++, pt+=2) {
+ pt[0] = pt[0]*scaling_x + offset_x;
+ pt[1] = pt[1]*scaling_y + offset_y;
+ }
+ if (item->brush.variable_width)
+ for (i=0, wid=item->widths; i<item->path->num_points-1; i++, wid++)
+ *wid = *wid * mean_scaling;
+
+ item->bbox.left = item->bbox.left*scaling_x + offset_x;
+ item->bbox.right = item->bbox.right*scaling_x + offset_x;
+ item->bbox.top = item->bbox.top*scaling_y + offset_y;
+ item->bbox.bottom = item->bbox.bottom*scaling_y + offset_y;
+ if (item->bbox.left > item->bbox.right) {
+ temp = item->bbox.left;
+ item->bbox.left = item->bbox.right;
+ item->bbox.right = temp;
+ }
+ if (item->bbox.top > item->bbox.bottom) {
+ temp = item->bbox.top;
+ item->bbox.top = item->bbox.bottom;
+ item->bbox.bottom = temp;
+ }
+ }
+ if (item->type == ITEM_TEXT) {
+ /* must scale about NW corner -- all other points of the text box
+ are font- and zoom-dependent, so scaling about center of text box
+ couldn't be undone properly. FIXME? */
+ item->font_size *= mean_scaling;
+ item->bbox.left = item->bbox.left*scaling_x + offset_x;
+ item->bbox.top = item->bbox.top*scaling_y + offset_y;
+ }
+ // redraw the item
+ if (item->canvas_item!=NULL) {
+ group = (GnomeCanvasGroup *) item->canvas_item->parent;
+ gtk_object_destroy(GTK_OBJECT(item->canvas_item));
+ make_canvas_item_one(group, item);
+ }
+ }
+}
+