2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1998-06-28 18:39:58 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1998-06-28 18:39:58 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1998-06-28 18:39:58 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1998-06-28 18:39:58 +08:00
|
|
|
*/
|
2000-12-11 11:33:25 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core-types.h"
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "gimp.h"
|
2008-11-03 04:46:57 +08:00
|
|
|
#include "gimpcontainer.h"
|
2006-06-07 06:48:57 +08:00
|
|
|
#include "gimpguide.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "gimpimage.h"
|
2003-10-06 20:17:11 +08:00
|
|
|
#include "gimpimage-guides.h"
|
2007-12-04 19:30:31 +08:00
|
|
|
#include "gimpimage-item-list.h"
|
2005-03-05 00:34:59 +08:00
|
|
|
#include "gimpimage-sample-points.h"
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
#include "gimpimage-scale.h"
|
2003-02-13 19:23:50 +08:00
|
|
|
#include "gimpimage-undo.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimpimage-undo-push.h"
|
2001-02-02 02:44:22 +08:00
|
|
|
#include "gimplayer.h"
|
2004-08-11 02:47:21 +08:00
|
|
|
#include "gimpprogress.h"
|
2007-12-04 19:30:31 +08:00
|
|
|
#include "gimpprojection.h"
|
2007-01-30 18:34:59 +08:00
|
|
|
#include "gimpsamplepoint.h"
|
2007-02-27 17:39:31 +08:00
|
|
|
#include "gimpsubprogress.h"
|
2001-07-05 03:31:35 +08:00
|
|
|
|
2007-12-04 19:30:31 +08:00
|
|
|
#include "gimp-log.h"
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2003-02-13 19:23:50 +08:00
|
|
|
|
comment typo fix, plus add %D* to default image-title-format string, so
Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org>
* gimprc.in: comment typo fix, plus add %D* to default
image-title-format string, so people get a '*' in the titlebar
if their image is dirty.
* app/fileops.c: initialise filename before using it.
* app/gdisplay.c: empty parameter list () is K&R - should be
stronger (void) in ANSI C.
* app/gimpdrawable.c: gimp_drawable_{dirty,clean} functions
removed - no one uses them anyway. Parasite undo type is
proper parasite undo type, not MISC_UNDO.
* app/gimpdrawableP.h: drawable dirty bit removed.
* app/gimpimage.c: don't change the resolution if there's no
difference from the old one. Call gdisplay_shrink_wrap() to
re-calculate scale factors and refresh the display on
resolution change. Layer undo doesn't have sub-types
anymore, uses main UndoType instead.
* app/layer.h: Remove LayerUndoType
* app/qmask.c: fix qmask undo so it actually works.
* app/undo.h: new types for undo_push_layer{,_mask} and
undo_push_qmask.
* app/undo.c: change way group boundaries are represented:
each Undo has a group_boundary boolean set to TRUE if this is
the start or the end of a group, and the type of the Undo is
the group's type. Within a group, each Undo keeps its own
type. This allows pop funcs and free funcs to do
type-specific things (eg needed by layer and channel stuff).
Don't maintain per-drawable dirty flags anymore. Floating
sel to layer and layer rename now uses meaningful undo types.
* app/undo_types.h: more specific undo types:
LAYER_{ADD,REMOVE}_UNDO, LAYER_MASK_{ADD,REMOVE}_UNDO,
LAYER_RENAME_UNDO, and PARASITE_{ATTACH,DETACH}_UNDO.
* app/undo_history.c: oops - undo stack was being placed into gtk
list in wrong order.
* app/edit_selection.c: push more descriptive LAYER_DISPLACE_UNDO
rather than MISC_UNDO.
* app/layers_dialog.c: better tagging of undo types
1999-10-02 02:43:24 +08:00
|
|
|
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_scale (GimpImage *image,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint new_width,
|
|
|
|
gint new_height,
|
2002-02-12 10:31:45 +08:00
|
|
|
GimpInterpolationType interpolation_type,
|
2004-08-11 02:47:21 +08:00
|
|
|
GimpProgress *progress)
|
2001-11-28 11:08:03 +08:00
|
|
|
{
|
2007-02-27 19:03:18 +08:00
|
|
|
GimpProgress *sub_progress;
|
2009-08-02 23:44:05 +08:00
|
|
|
GList *all_layers;
|
|
|
|
GList *all_channels;
|
|
|
|
GList *all_vectors;
|
2007-02-27 17:39:31 +08:00
|
|
|
GList *list;
|
|
|
|
gint old_width;
|
|
|
|
gint old_height;
|
2008-08-03 19:35:53 +08:00
|
|
|
gint offset_x;
|
|
|
|
gint offset_y;
|
2007-02-28 16:57:17 +08:00
|
|
|
gdouble img_scale_w = 1.0;
|
|
|
|
gdouble img_scale_h = 1.0;
|
2007-02-27 19:03:18 +08:00
|
|
|
gint progress_steps;
|
2007-02-28 16:57:17 +08:00
|
|
|
gint progress_current = 0;
|
2001-11-28 11:08:03 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (image));
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
g_return_if_fail (new_width > 0 && new_height > 0);
|
2004-08-11 02:47:21 +08:00
|
|
|
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
2001-08-12 03:53:35 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_set_busy (image->gimp);
|
2001-08-12 03:53:35 +08:00
|
|
|
|
2007-02-27 19:03:18 +08:00
|
|
|
sub_progress = gimp_sub_progress_new (progress);
|
2007-02-27 17:39:31 +08:00
|
|
|
|
2009-08-02 23:44:05 +08:00
|
|
|
all_layers = gimp_image_get_layer_list (image);
|
|
|
|
all_channels = gimp_image_get_channel_list (image);
|
|
|
|
all_vectors = gimp_image_get_vectors_list (image);
|
|
|
|
|
|
|
|
progress_steps = (g_list_length (all_layers) +
|
|
|
|
g_list_length (all_channels) +
|
|
|
|
g_list_length (all_vectors) +
|
2007-02-27 19:03:18 +08:00
|
|
|
1 /* selection */);
|
1998-06-28 18:39:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_object_freeze_notify (G_OBJECT (image));
|
2004-07-14 20:12:50 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_SCALE,
|
2010-06-08 19:24:11 +08:00
|
|
|
C_("undo-type", "Scale Image"));
|
2000-12-29 00:19:55 +08:00
|
|
|
|
2007-12-26 00:21:40 +08:00
|
|
|
old_width = gimp_image_get_width (image);
|
|
|
|
old_height = gimp_image_get_height (image);
|
2007-02-28 16:57:17 +08:00
|
|
|
img_scale_w = (gdouble) new_width / (gdouble) old_width;
|
|
|
|
img_scale_h = (gdouble) new_height / (gdouble) old_height;
|
2003-09-03 18:19:47 +08:00
|
|
|
|
2008-08-03 19:35:53 +08:00
|
|
|
offset_x = (old_width - new_width) / 2;
|
|
|
|
offset_y = (old_height - new_height) / 2;
|
|
|
|
|
|
|
|
/* Push the image size to the stack */
|
2008-08-29 03:12:03 +08:00
|
|
|
gimp_image_undo_push_image_size (image,
|
|
|
|
NULL,
|
|
|
|
offset_x,
|
|
|
|
offset_y,
|
|
|
|
new_width,
|
|
|
|
new_height);
|
2008-08-03 19:35:53 +08:00
|
|
|
|
2012-02-24 07:26:14 +08:00
|
|
|
/* Set the new width and height early, so below image item setters
|
|
|
|
* (esp. guides and sample points) don't choke about moving stuff
|
|
|
|
* out of the image
|
|
|
|
*/
|
2006-03-29 01:08:36 +08:00
|
|
|
g_object_set (image,
|
2004-07-14 20:12:50 +08:00
|
|
|
"width", new_width,
|
|
|
|
"height", new_height,
|
|
|
|
NULL);
|
|
|
|
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
/* Scale all channels */
|
2009-08-02 23:44:05 +08:00
|
|
|
for (list = all_channels; list; list = g_list_next (list))
|
2001-02-05 06:10:54 +08:00
|
|
|
{
|
2007-02-28 16:57:17 +08:00
|
|
|
GimpItem *item = list->data;
|
2001-04-13 22:50:43 +08:00
|
|
|
|
2007-02-27 19:10:17 +08:00
|
|
|
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (sub_progress),
|
|
|
|
progress_current++, progress_steps);
|
2007-02-27 17:39:31 +08:00
|
|
|
|
2004-02-09 08:09:20 +08:00
|
|
|
gimp_item_scale (item,
|
|
|
|
new_width, new_height, 0, 0,
|
2007-02-27 17:39:31 +08:00
|
|
|
interpolation_type, sub_progress);
|
2003-05-09 08:38:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Scale all vectors */
|
2009-08-02 23:44:05 +08:00
|
|
|
for (list = all_vectors; list; list = g_list_next (list))
|
2003-05-09 08:38:51 +08:00
|
|
|
{
|
2007-02-28 16:57:17 +08:00
|
|
|
GimpItem *item = list->data;
|
2003-05-09 08:38:51 +08:00
|
|
|
|
2007-02-27 19:10:17 +08:00
|
|
|
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (sub_progress),
|
|
|
|
progress_current++, progress_steps);
|
2007-02-27 19:03:18 +08:00
|
|
|
|
2004-02-09 08:09:20 +08:00
|
|
|
gimp_item_scale (item,
|
|
|
|
new_width, new_height, 0, 0,
|
2007-02-27 17:39:31 +08:00
|
|
|
interpolation_type, sub_progress);
|
2001-08-11 22:39:19 +08:00
|
|
|
}
|
|
|
|
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
/* Don't forget the selection mask! */
|
2007-02-27 19:10:17 +08:00
|
|
|
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (sub_progress),
|
|
|
|
progress_current++, progress_steps);
|
2007-02-27 17:39:31 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_item_scale (GIMP_ITEM (gimp_image_get_mask (image)),
|
2004-02-09 08:09:20 +08:00
|
|
|
new_width, new_height, 0, 0,
|
2007-02-27 17:39:31 +08:00
|
|
|
interpolation_type, sub_progress);
|
2003-06-04 00:42:46 +08:00
|
|
|
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
/* Scale all layers */
|
2009-08-02 23:44:05 +08:00
|
|
|
for (list = all_layers; list; list = g_list_next (list))
|
2001-08-11 22:39:19 +08:00
|
|
|
{
|
2007-02-28 16:57:17 +08:00
|
|
|
GimpItem *item = list->data;
|
2001-01-10 08:36:54 +08:00
|
|
|
|
2007-02-27 19:10:17 +08:00
|
|
|
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (sub_progress),
|
|
|
|
progress_current++, progress_steps);
|
2007-02-27 17:39:31 +08:00
|
|
|
|
2009-08-25 21:46:53 +08:00
|
|
|
/* group layers are updated automatically */
|
|
|
|
if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
|
|
|
|
continue;
|
|
|
|
|
2004-02-09 08:09:20 +08:00
|
|
|
if (! gimp_item_scale_by_factors (item,
|
|
|
|
img_scale_w, img_scale_h,
|
2007-02-27 17:39:31 +08:00
|
|
|
interpolation_type, sub_progress))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
/* Since 0 < img_scale_w, img_scale_h, failure due to one or more
|
|
|
|
* vanishing scaled layer dimensions. Implicit delete implemented
|
|
|
|
* here. Upstream warning implemented in resize_check_layer_scaling(),
|
|
|
|
* which offers the user the chance to bail out.
|
|
|
|
*/
|
2009-08-02 23:44:05 +08:00
|
|
|
gimp_image_remove_layer (image, GIMP_LAYER (item), TRUE, NULL);
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
}
|
2001-08-11 22:39:19 +08:00
|
|
|
}
|
2001-03-05 09:01:16 +08:00
|
|
|
|
2003-05-09 19:27:21 +08:00
|
|
|
/* Scale all Guides */
|
2009-08-28 01:31:55 +08:00
|
|
|
for (list = gimp_image_get_guides (image);
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
2001-08-11 22:39:19 +08:00
|
|
|
{
|
2006-06-07 23:49:59 +08:00
|
|
|
GimpGuide *guide = list->data;
|
|
|
|
gint position = gimp_guide_get_position (guide);
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2006-06-07 23:49:59 +08:00
|
|
|
switch (gimp_guide_get_orientation (guide))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
case GIMP_ORIENTATION_HORIZONTAL:
|
2012-02-24 07:26:14 +08:00
|
|
|
gimp_image_move_guide (image, guide,
|
|
|
|
(position * new_height) / old_height,
|
|
|
|
TRUE);
|
2003-05-09 19:27:21 +08:00
|
|
|
break;
|
2006-04-12 20:49:29 +08:00
|
|
|
|
|
|
|
case GIMP_ORIENTATION_VERTICAL:
|
2012-02-24 07:26:14 +08:00
|
|
|
gimp_image_move_guide (image, guide,
|
|
|
|
(position * new_width) / old_width,
|
|
|
|
TRUE);
|
2006-04-12 20:49:29 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2001-01-10 08:36:54 +08:00
|
|
|
}
|
2001-02-05 06:10:54 +08:00
|
|
|
|
2005-03-05 00:34:59 +08:00
|
|
|
/* Scale all sample points */
|
2008-07-31 14:41:38 +08:00
|
|
|
for (list = gimp_image_get_sample_points (image);
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
2005-03-05 00:34:59 +08:00
|
|
|
{
|
|
|
|
GimpSamplePoint *sample_point = list->data;
|
|
|
|
|
2012-02-24 07:26:14 +08:00
|
|
|
gimp_image_move_sample_point (image, sample_point,
|
|
|
|
sample_point->x * new_width / old_width,
|
|
|
|
sample_point->y * new_height / old_height,
|
|
|
|
TRUE);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_group_end (image);
|
2001-06-18 21:10:03 +08:00
|
|
|
|
2009-08-02 23:44:05 +08:00
|
|
|
g_list_free (all_layers);
|
|
|
|
g_list_free (all_channels);
|
|
|
|
g_list_free (all_vectors);
|
|
|
|
|
2007-02-27 19:03:18 +08:00
|
|
|
g_object_unref (sub_progress);
|
2007-02-27 17:39:31 +08:00
|
|
|
|
2008-08-29 03:12:03 +08:00
|
|
|
gimp_image_size_changed_detailed (image,
|
|
|
|
-offset_x,
|
|
|
|
-offset_y,
|
|
|
|
old_width,
|
|
|
|
old_height);
|
2008-08-03 19:35:53 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_object_thaw_notify (G_OBJECT (image));
|
2001-05-15 19:25:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_unset_busy (image->gimp);
|
1998-06-28 18:39:58 +08:00
|
|
|
}
|
|
|
|
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
/**
|
2003-12-09 05:56:22 +08:00
|
|
|
* gimp_image_scale_check:
|
2006-03-29 01:08:36 +08:00
|
|
|
* @image: A #GimpImage.
|
2004-01-07 00:46:03 +08:00
|
|
|
* @new_width: The new width.
|
|
|
|
* @new_height: The new height.
|
2004-07-14 18:31:59 +08:00
|
|
|
* @max_memsize: The maximum new memory size.
|
2004-01-07 00:46:03 +08:00
|
|
|
* @new_memsize: The new memory size.
|
2003-09-03 18:19:47 +08:00
|
|
|
*
|
2006-03-29 01:08:36 +08:00
|
|
|
* Inventory the layer list in image and check that it may be
|
2003-12-09 05:56:22 +08:00
|
|
|
* scaled to @new_height and @new_width without problems.
|
2003-09-03 18:19:47 +08:00
|
|
|
*
|
2003-12-09 19:49:47 +08:00
|
|
|
* Return value: #GIMP_IMAGE_SCALE_OK if scaling the image will shrink none
|
|
|
|
* of its layers completely away, and the new image size
|
2004-07-14 18:31:59 +08:00
|
|
|
* is smaller than @max_memsize.
|
2003-12-09 19:49:47 +08:00
|
|
|
* #GIMP_IMAGE_SCALE_TOO_SMALL if scaling would remove some
|
2003-12-09 05:56:22 +08:00
|
|
|
* existing layers.
|
2003-12-09 19:49:47 +08:00
|
|
|
* #GIMP_IMAGE_SCALE_TOO_BIG if the new image size would
|
2003-12-09 05:56:22 +08:00
|
|
|
* exceed the maximum specified in the preferences.
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
**/
|
2003-12-09 05:56:22 +08:00
|
|
|
GimpImageScaleCheckType
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_scale_check (const GimpImage *image,
|
2003-12-09 05:56:22 +08:00
|
|
|
gint new_width,
|
2003-12-09 20:56:22 +08:00
|
|
|
gint new_height,
|
2004-07-14 18:31:59 +08:00
|
|
|
gint64 max_memsize,
|
2003-12-09 20:56:22 +08:00
|
|
|
gint64 *new_memsize)
|
1998-06-28 18:39:58 +08:00
|
|
|
{
|
2007-12-04 19:30:31 +08:00
|
|
|
GList *drawables;
|
2009-08-02 23:44:05 +08:00
|
|
|
GList *all_layers;
|
2003-12-09 20:56:22 +08:00
|
|
|
GList *list;
|
|
|
|
gint64 current_size;
|
2003-12-10 05:12:05 +08:00
|
|
|
gint64 scalable_size;
|
2007-12-04 19:30:31 +08:00
|
|
|
gint64 scaled_size;
|
2003-12-09 20:56:22 +08:00
|
|
|
gint64 undo_size;
|
|
|
|
gint64 redo_size;
|
2003-12-10 05:12:05 +08:00
|
|
|
gint64 fixed_size;
|
2003-12-09 20:56:22 +08:00
|
|
|
gint64 new_size;
|
2003-12-09 05:56:22 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_IMAGE_SCALE_TOO_SMALL);
|
2003-12-09 20:56:22 +08:00
|
|
|
g_return_val_if_fail (new_memsize != NULL, GIMP_IMAGE_SCALE_TOO_SMALL);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
current_size = gimp_object_get_memsize (GIMP_OBJECT (image), NULL);
|
2003-12-09 20:56:22 +08:00
|
|
|
|
2003-12-10 05:12:05 +08:00
|
|
|
/* the part of the image's memsize that scales linearly with the image */
|
2007-12-04 19:30:31 +08:00
|
|
|
drawables = gimp_image_item_list_get_list (image, NULL,
|
|
|
|
GIMP_ITEM_TYPE_LAYERS |
|
|
|
|
GIMP_ITEM_TYPE_CHANNELS,
|
|
|
|
GIMP_ITEM_SET_ALL);
|
2009-08-28 01:41:14 +08:00
|
|
|
|
|
|
|
gimp_image_item_list_filter (NULL, drawables, TRUE, FALSE);
|
|
|
|
|
2007-12-26 00:21:40 +08:00
|
|
|
drawables = g_list_prepend (drawables, gimp_image_get_mask (image));
|
2007-12-04 19:30:31 +08:00
|
|
|
|
|
|
|
scalable_size = 0;
|
|
|
|
scaled_size = 0;
|
|
|
|
|
|
|
|
for (list = drawables; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GimpDrawable *drawable = list->data;
|
2008-11-03 08:09:01 +08:00
|
|
|
gdouble width = gimp_item_get_width (GIMP_ITEM (drawable));
|
|
|
|
gdouble height = gimp_item_get_height (GIMP_ITEM (drawable));
|
2007-12-04 19:30:31 +08:00
|
|
|
|
|
|
|
scalable_size +=
|
|
|
|
gimp_drawable_estimate_memsize (drawable,
|
|
|
|
width, height);
|
|
|
|
|
|
|
|
scaled_size +=
|
|
|
|
gimp_drawable_estimate_memsize (drawable,
|
|
|
|
width * new_width /
|
|
|
|
gimp_image_get_width (image),
|
|
|
|
height * new_height /
|
|
|
|
gimp_image_get_height (image));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (drawables);
|
|
|
|
|
|
|
|
scalable_size +=
|
2012-05-08 03:57:33 +08:00
|
|
|
gimp_projection_estimate_memsize (gimp_image_get_base_type (image),
|
2007-12-04 19:30:31 +08:00
|
|
|
gimp_image_get_width (image),
|
|
|
|
gimp_image_get_height (image));
|
|
|
|
|
|
|
|
scaled_size +=
|
2012-05-08 03:57:33 +08:00
|
|
|
gimp_projection_estimate_memsize (gimp_image_get_base_type (image),
|
2007-12-04 19:30:31 +08:00
|
|
|
new_width, new_height);
|
|
|
|
|
|
|
|
GIMP_LOG (IMAGE_SCALE,
|
|
|
|
"scalable_size = %"G_GINT64_FORMAT" scaled_size = %"G_GINT64_FORMAT,
|
|
|
|
scalable_size, scaled_size);
|
2001-07-05 03:31:35 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
undo_size = gimp_object_get_memsize (GIMP_OBJECT (gimp_image_get_undo_stack (image)), NULL);
|
|
|
|
redo_size = gimp_object_get_memsize (GIMP_OBJECT (gimp_image_get_redo_stack (image)), NULL);
|
2003-12-09 19:49:47 +08:00
|
|
|
|
2004-02-17 23:12:56 +08:00
|
|
|
/* the fixed part of the image's memsize w/o any undo information */
|
|
|
|
fixed_size = current_size - undo_size - redo_size - scalable_size;
|
2003-12-09 20:56:22 +08:00
|
|
|
|
2003-12-10 05:12:05 +08:00
|
|
|
/* calculate the new size, which is: */
|
2007-12-04 19:30:31 +08:00
|
|
|
new_size = (fixed_size + /* the fixed part */
|
|
|
|
scaled_size); /* plus the part that scales... */
|
|
|
|
|
|
|
|
GIMP_LOG (IMAGE_SCALE,
|
|
|
|
"old_size = %"G_GINT64_FORMAT" new_size = %"G_GINT64_FORMAT,
|
|
|
|
current_size - undo_size - redo_size, new_size);
|
2003-12-09 19:49:47 +08:00
|
|
|
|
2003-12-09 20:56:22 +08:00
|
|
|
*new_memsize = new_size;
|
|
|
|
|
2004-07-14 18:31:59 +08:00
|
|
|
if (new_size > current_size && new_size > max_memsize)
|
2003-12-09 19:49:47 +08:00
|
|
|
return GIMP_IMAGE_SCALE_TOO_BIG;
|
1998-06-28 18:39:58 +08:00
|
|
|
|
2009-08-02 23:44:05 +08:00
|
|
|
all_layers = gimp_image_get_layer_list (image);
|
|
|
|
|
|
|
|
for (list = all_layers; list; list = g_list_next (list))
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
{
|
2003-05-09 19:27:21 +08:00
|
|
|
GimpItem *item = list->data;
|
2001-07-11 20:39:49 +08:00
|
|
|
|
2009-08-25 21:46:53 +08:00
|
|
|
/* group layers are updated automatically */
|
|
|
|
if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
|
|
|
|
continue;
|
|
|
|
|
2003-05-08 22:54:04 +08:00
|
|
|
if (! gimp_item_check_scaling (item, new_width, new_height))
|
2009-08-02 23:44:05 +08:00
|
|
|
{
|
|
|
|
g_list_free (all_layers);
|
|
|
|
|
|
|
|
return GIMP_IMAGE_SCALE_TOO_SMALL;
|
|
|
|
}
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
}
|
1998-06-28 18:39:58 +08:00
|
|
|
|
2009-08-02 23:44:05 +08:00
|
|
|
g_list_free (all_layers);
|
|
|
|
|
2003-12-09 19:49:47 +08:00
|
|
|
return GIMP_IMAGE_SCALE_OK;
|
1998-06-28 18:39:58 +08:00
|
|
|
}
|