2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-24 22:05:25 +00:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-24 22:05:25 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-24 22:05:25 +00: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
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2000-12-16 21:37:03 +00:00
|
|
|
|
2000-02-16 20:44:39 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 01:58:39 +02:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-09 20:24:04 +00:00
|
|
|
#include <gegl.h>
|
2000-12-16 21:37:03 +00:00
|
|
|
|
2018-05-24 10:21:21 -04:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2001-05-09 22:34:59 +00:00
|
|
|
#include "core-types.h"
|
|
|
|
|
2018-05-24 10:21:21 -04:00
|
|
|
#include "gegl/gimp-gegl-loops.h"
|
|
|
|
|
2025-07-07 15:43:07 +02:00
|
|
|
#include "path/gimppath.h"
|
2013-11-21 21:43:28 +01:00
|
|
|
|
2001-07-07 12:17:23 +00:00
|
|
|
#include "gimp.h"
|
2001-02-01 18:44:22 +00:00
|
|
|
#include "gimpchannel.h"
|
2006-06-06 22:48:57 +00:00
|
|
|
#include "gimpguide.h"
|
2001-05-09 02:32:03 +00:00
|
|
|
#include "gimpimage.h"
|
2015-08-30 01:29:46 +02:00
|
|
|
#include "gimpimage-color-profile.h"
|
2003-12-09 20:20:45 +00:00
|
|
|
#include "gimpimage-colormap.h"
|
2001-04-18 19:14:20 +00:00
|
|
|
#include "gimpimage-duplicate.h"
|
2003-12-09 20:20:45 +00:00
|
|
|
#include "gimpimage-grid.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-28 17:51:06 +00:00
|
|
|
#include "gimpimage-guides.h"
|
2013-11-21 21:43:28 +01:00
|
|
|
#include "gimpimage-metadata.h"
|
2010-02-03 23:42:32 +01:00
|
|
|
#include "gimpimage-private.h"
|
2010-02-08 11:11:33 +01:00
|
|
|
#include "gimpimage-undo.h"
|
2005-03-04 16:34:59 +00:00
|
|
|
#include "gimpimage-sample-points.h"
|
2010-08-08 17:50:08 +02:00
|
|
|
#include "gimpitemstack.h"
|
2001-02-01 18:44:22 +00:00
|
|
|
#include "gimplayer.h"
|
2010-08-08 17:50:08 +02:00
|
|
|
#include "gimplayermask.h"
|
2016-05-20 16:46:26 +02:00
|
|
|
#include "gimplayer-floating-selection.h"
|
2001-07-09 19:48:30 +00:00
|
|
|
#include "gimpparasitelist.h"
|
2007-01-30 10:34:59 +00:00
|
|
|
#include "gimpsamplepoint.h"
|
2001-07-05 16:21:36 +00:00
|
|
|
|
1998-01-22 07:02:57 +00:00
|
|
|
|
2014-07-07 23:56:56 +02:00
|
|
|
static void gimp_image_duplicate_resolution (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_save_source_file (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_colormap (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static GimpItem * gimp_image_duplicate_item (GimpItem *item,
|
|
|
|
GimpImage *new_image);
|
2020-04-04 02:49:51 +02:00
|
|
|
static GList * gimp_image_duplicate_layers (GimpImage *image,
|
2014-07-07 23:56:56 +02:00
|
|
|
GimpImage *new_image);
|
2020-04-04 02:49:51 +02:00
|
|
|
static GList * gimp_image_duplicate_channels (GimpImage *image,
|
2014-07-07 23:56:56 +02:00
|
|
|
GimpImage *new_image);
|
2024-07-11 00:07:44 +00:00
|
|
|
static GList * gimp_image_duplicate_paths (GimpImage *image,
|
2014-07-07 23:56:56 +02:00
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_floating_sel (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_mask (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_components (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_guides (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_sample_points (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_grid (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_metadata (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_quick_mask (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
|
|
|
static void gimp_image_duplicate_parasites (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
2015-08-30 01:29:46 +02:00
|
|
|
static void gimp_image_duplicate_color_profile (GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
2025-01-20 18:28:36 +00:00
|
|
|
static void gimp_image_duplicate_simulation_profile
|
|
|
|
(GimpImage *image,
|
|
|
|
GimpImage *new_image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
|
|
|
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
GimpImage *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_duplicate (GimpImage *image)
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
{
|
2006-03-28 17:08:36 +00:00
|
|
|
GimpImage *new_image;
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *active_layers;
|
|
|
|
GList *active_channels;
|
2024-07-11 00:07:44 +00:00
|
|
|
GList *active_path;
|
2003-12-09 20:20:45 +00:00
|
|
|
|
2006-03-28 17:08:36 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2001-04-18 19:14:20 +00:00
|
|
|
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_set_busy_until_idle (image->gimp);
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
|
|
|
/* Create a new image */
|
2006-03-28 17:08:36 +00:00
|
|
|
new_image = gimp_create_image (image->gimp,
|
2007-12-25 16:21:40 +00:00
|
|
|
gimp_image_get_width (image),
|
|
|
|
gimp_image_get_height (image),
|
2012-05-07 21:57:33 +02:00
|
|
|
gimp_image_get_base_type (image),
|
2012-04-22 17:31:32 +02:00
|
|
|
gimp_image_get_precision (image),
|
2006-08-29 09:55:34 +00:00
|
|
|
FALSE);
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_disable (new_image);
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2009-05-01 17:04:06 +02:00
|
|
|
/* Store the source uri to be used by the save dialog */
|
2014-07-07 23:56:56 +02:00
|
|
|
gimp_image_duplicate_save_source_file (image, new_image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
|
|
|
/* Copy resolution information */
|
|
|
|
gimp_image_duplicate_resolution (image, new_image);
|
|
|
|
|
2015-08-30 01:29:46 +02:00
|
|
|
/* Copy parasites first so we have a color profile */
|
|
|
|
gimp_image_duplicate_parasites (image, new_image);
|
|
|
|
gimp_image_duplicate_color_profile (image, new_image);
|
|
|
|
|
2025-01-20 18:28:36 +00:00
|
|
|
/* Copy the simulation profile settings */
|
|
|
|
gimp_image_duplicate_simulation_profile (image, new_image);
|
|
|
|
|
Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.
libgimp:
- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
NON_LINEAR and PERCPTUAL for each encoding, matching the babl
encoding variants RGB, R'G'B' and R~G~B~.
- gimp_color_transform_can_gegl_copy() now returns TRUE if both
profiles can return a babl space, increasing the amount of fast babl
color conversions significantly.
- TODO: no solution yet for getting libgimp drawable proxy buffers in
the right format with space.
plug-ins:
- follow the GimpPrecision change.
- TODO: everything else unchanged and partly broken or sub-optimal,
like setting a new image's color profile too late.
app:
- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
replacement for all "linear" booleans.
- change gimp-babl functions to take babl spaces and GimpTRCType
parameters and support all sorts of new perceptual ~ formats.
- a lot of places changed in the early days of goat invasion didn't
take advantage of gimp-babl utility functions and constructed
formats manually. They all needed revisiting and many now use much
simpler code calling gimp-babl API.
- change gimp_babl_format_get_color_profile() to really extract a
newly allocated color profile from the format, and add
gimp_babl_get_builtin_color_profile() which does the same as
gimp_babl_format_get_color_profile() did before. Visited all callers
to decide whether they are looking for the format's actual profile,
or for one of the builtin profiles, simplifying code that only needs
builtin profiles.
- drawables have a new get_space_api(), get_linear() is now get_trc().
- images now have a "layer space" and an API to get it,
gimp_image_get_layer_format() returns formats in that space.
- an image's layer space is created from the image's color profile,
change gimpimage-color-profile to deal with that correctly
- change many babl_format() calls to babl_format_with_space() and take
the space from passed formats or drawables
- add function gimp_layer_fix_format_space() which replaces the
layer's buffer with one that has the image's layer format, but
doesn't change pixel values
- use gimp_layer_fix_format_space() to make sure layers loaded from
XCF and created by plug-ins have the right space when added to the
image, because it's impossible to always assign the right space upon
layer creation
- "assign color profile" and "discard color profile" now require use
of gimp_layer_fix_format_space() too because the profile is now
embedded in all formats via the space. Add
gimp_image_assign_color_profile() which does all that and call it
instead of a simple gimp_image_set_color_profile(), also from the
PDB set-color-profile functions, which are essentially "assign" and
"discard" calls.
- generally, make sure a new image's color profile is set before
adding layers to it, gimp_image_set_color_profile() is more than
before considered know-what-you-are-doing API.
- take special precaution in all places that call
gimp_drawable_convert_type(), we now must pass a new_profile from
all callers that convert layers within the same image (such as
image_convert_type, image_convert_precision), because the layer's
new space can't be determined from the image's layer format during
the call.
- change all "linear" properties to "trc", in all config objects like
for levels and curves, in the histogram, in the widgets. This results
in some GUI that now has three choices instead of two.
TODO: we might want to reduce that back to two later.
- keep "linear" boolean properties around as compat if needed for file
pasring, but always convert the parsed parsed boolean to
GimpTRCType.
- TODO: the image's "enable color management" switch is currently
broken, will fix that in another commit.
2018-07-21 14:23:01 +02:00
|
|
|
/* Copy the colormap if necessary */
|
|
|
|
gimp_image_duplicate_colormap (image, new_image);
|
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
/* Copy the layers */
|
2020-04-04 02:49:51 +02:00
|
|
|
active_layers = gimp_image_duplicate_layers (image, new_image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
|
|
|
/* Copy the channels */
|
2020-04-04 02:49:51 +02:00
|
|
|
active_channels = gimp_image_duplicate_channels (image, new_image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2024-07-12 06:16:25 +00:00
|
|
|
/* Copy any path */
|
2024-07-11 00:07:44 +00:00
|
|
|
active_path = gimp_image_duplicate_paths (image, new_image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2010-08-08 17:50:08 +02:00
|
|
|
/* Copy floating layer */
|
|
|
|
gimp_image_duplicate_floating_sel (image, new_image);
|
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
/* Copy the selection mask */
|
|
|
|
gimp_image_duplicate_mask (image, new_image);
|
|
|
|
|
2024-07-12 06:16:25 +00:00
|
|
|
/* Set active layer, active channel, active path */
|
2020-04-04 02:49:51 +02:00
|
|
|
if (active_layers)
|
|
|
|
gimp_image_set_selected_layers (new_image, active_layers);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
if (active_channels)
|
|
|
|
gimp_image_set_selected_channels (new_image, active_channels);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
if (active_path)
|
|
|
|
gimp_image_set_selected_paths (new_image, active_path);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2009-08-25 16:25:26 +02:00
|
|
|
/* Copy state of all color components */
|
2008-11-26 07:20:04 +00:00
|
|
|
gimp_image_duplicate_components (image, new_image);
|
|
|
|
|
|
|
|
/* Copy any guides */
|
|
|
|
gimp_image_duplicate_guides (image, new_image);
|
|
|
|
|
|
|
|
/* Copy any sample points */
|
|
|
|
gimp_image_duplicate_sample_points (image, new_image);
|
|
|
|
|
|
|
|
/* Copy the grid */
|
|
|
|
gimp_image_duplicate_grid (image, new_image);
|
|
|
|
|
2013-11-21 21:43:28 +01:00
|
|
|
/* Copy the metadata */
|
|
|
|
gimp_image_duplicate_metadata (image, new_image);
|
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
/* Copy the quick mask info */
|
|
|
|
gimp_image_duplicate_quick_mask (image, new_image);
|
|
|
|
|
|
|
|
gimp_image_undo_enable (new_image);
|
|
|
|
|
2020-03-23 22:29:34 +02:00
|
|
|
/* Explicitly mark image as dirty, so that its dirty time is set */
|
|
|
|
gimp_image_dirty (new_image, GIMP_DIRTY_ALL);
|
|
|
|
|
2025-03-14 00:44:07 +01:00
|
|
|
/* XXX Without flushing the duplicated image, we had at least one case
|
|
|
|
* where it wouldn't properly render the image (with empty
|
|
|
|
* pass-through groups with layer effects, which I think is because we
|
|
|
|
* have code believing the group is smaller that it really is, because
|
|
|
|
* of the specificity of pass-through groups). See #13057.
|
|
|
|
* So I'm not entirely happy of calling this here, which feels more
|
|
|
|
* like a workaround than a real fix. But it will do for now.
|
|
|
|
*/
|
|
|
|
gimp_image_flush (new_image);
|
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
return new_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_image_duplicate_resolution (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
|
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
gimp_image_set_resolution (new_image, xres, yres);
|
|
|
|
gimp_image_set_unit (new_image, gimp_image_get_unit (image));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-07-07 23:56:56 +02:00
|
|
|
gimp_image_duplicate_save_source_file (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
2008-11-26 07:20:04 +00:00
|
|
|
{
|
2014-07-07 23:56:56 +02:00
|
|
|
GFile *file = gimp_image_get_file (image);
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
g_object_set_data_full (G_OBJECT (new_image), "gimp-image-source-file",
|
|
|
|
g_object_ref (file),
|
|
|
|
(GDestroyNotify) g_object_unref);
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2006-08-29 09:55:34 +00:00
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_colormap (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2012-05-07 21:57:33 +02:00
|
|
|
if (gimp_image_get_base_type (new_image) == GIMP_INDEXED)
|
2019-11-08 10:50:32 +01:00
|
|
|
gimp_image_set_colormap_palette (new_image,
|
|
|
|
gimp_image_get_colormap_palette (image),
|
|
|
|
FALSE);
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2003-12-09 20:20:45 +00:00
|
|
|
|
2010-08-08 18:00:08 +02:00
|
|
|
static GimpItem *
|
|
|
|
gimp_image_duplicate_item (GimpItem *item,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
GimpItem *new_item;
|
|
|
|
|
|
|
|
new_item = gimp_item_convert (item, new_image,
|
|
|
|
G_TYPE_FROM_INSTANCE (item));
|
|
|
|
|
|
|
|
/* Make sure the copied item doesn't say: "<old item> copy" */
|
|
|
|
gimp_object_set_name (GIMP_OBJECT (new_item),
|
|
|
|
gimp_object_get_name (item));
|
|
|
|
|
|
|
|
return new_item;
|
|
|
|
}
|
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
static GList *
|
2010-08-08 17:50:08 +02:00
|
|
|
gimp_image_duplicate_layers (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
2008-11-26 07:20:04 +00:00
|
|
|
{
|
2020-06-26 00:09:12 +02:00
|
|
|
GList *new_selected_layers = NULL;
|
|
|
|
GList *selected_paths = NULL;
|
|
|
|
GList *selected_layers;
|
|
|
|
GimpItemStack *new_item_stack;
|
|
|
|
GList *list;
|
|
|
|
gint count;
|
2020-04-04 02:49:51 +02:00
|
|
|
|
|
|
|
selected_layers = gimp_image_get_selected_layers (image);
|
1999-10-03 18:54:54 +00:00
|
|
|
|
2020-06-26 00:09:12 +02:00
|
|
|
for (list = selected_layers; list; list = list->next)
|
|
|
|
selected_paths = g_list_prepend (selected_paths,
|
|
|
|
gimp_item_get_path (list->data));
|
|
|
|
|
2009-08-25 16:25:26 +02:00
|
|
|
for (list = gimp_image_get_layer_iter (image), count = 0;
|
2001-02-19 13:06:09 +00:00
|
|
|
list;
|
2002-10-08 13:25:50 +00:00
|
|
|
list = g_list_next (list))
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
{
|
2025-05-28 17:28:01 +02:00
|
|
|
GimpLayer *layer = list->data;
|
|
|
|
GimpLayer *new_layer;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2010-08-08 17:50:08 +02:00
|
|
|
if (gimp_layer_is_floating_sel (layer))
|
|
|
|
continue;
|
|
|
|
|
2010-08-08 18:00:08 +02:00
|
|
|
new_layer = GIMP_LAYER (gimp_image_duplicate_item (GIMP_ITEM (layer),
|
|
|
|
new_image));
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-10-08 13:25:50 +00:00
|
|
|
/* Make sure that if the layer has a layer mask,
|
2003-12-09 20:20:45 +00:00
|
|
|
* its name isn't screwed up
|
|
|
|
*/
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
if (new_layer->mask)
|
2002-10-08 13:25:50 +00:00
|
|
|
gimp_object_set_name (GIMP_OBJECT (new_layer->mask),
|
2009-08-31 22:47:18 +02:00
|
|
|
gimp_object_get_name (layer->mask));
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2010-08-08 17:50:08 +02:00
|
|
|
gimp_image_add_layer (new_image, new_layer,
|
|
|
|
NULL, count++, FALSE);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2020-06-26 00:09:12 +02:00
|
|
|
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_layers (new_image));
|
|
|
|
for (list = selected_paths; list; list = list->next)
|
|
|
|
new_selected_layers = g_list_prepend (new_selected_layers,
|
|
|
|
gimp_item_stack_get_item_by_path (new_item_stack, list->data));
|
|
|
|
|
|
|
|
g_list_free_full (selected_paths, (GDestroyNotify) g_list_free);
|
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
return new_selected_layers;
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
static GList *
|
2010-08-08 17:50:08 +02:00
|
|
|
gimp_image_duplicate_channels (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
2008-11-26 07:20:04 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *new_selected_channels = NULL;
|
|
|
|
GList *selected_channels;
|
|
|
|
GList *list;
|
|
|
|
gint count;
|
|
|
|
|
|
|
|
selected_channels = gimp_image_get_selected_channels (image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2009-08-25 16:25:26 +02:00
|
|
|
for (list = gimp_image_get_channel_iter (image), count = 0;
|
2001-02-19 13:06:09 +00:00
|
|
|
list;
|
2002-10-08 13:25:50 +00:00
|
|
|
list = g_list_next (list))
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2009-08-03 19:21:51 +02:00
|
|
|
GimpChannel *channel = list->data;
|
|
|
|
GimpChannel *new_channel;
|
2003-09-28 20:47:14 +00:00
|
|
|
|
2010-08-08 18:00:08 +02:00
|
|
|
new_channel = GIMP_CHANNEL (gimp_image_duplicate_item (GIMP_ITEM (channel),
|
|
|
|
new_image));
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
if (g_list_find (selected_channels, channel))
|
|
|
|
new_selected_channels = g_list_prepend (new_selected_channels, new_channel);
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2009-08-03 19:21:51 +02:00
|
|
|
gimp_image_add_channel (new_image, new_channel,
|
2009-08-25 16:25:26 +02:00
|
|
|
NULL, count++, FALSE);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
return new_selected_channels;
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
|
|
|
|
2020-04-04 02:49:51 +02:00
|
|
|
static GList *
|
2024-07-11 00:07:44 +00:00
|
|
|
gimp_image_duplicate_paths (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
2008-11-26 07:20:04 +00:00
|
|
|
{
|
2024-07-11 00:07:44 +00:00
|
|
|
GList *new_selected_path = NULL;
|
|
|
|
GList *selected_path;
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *list;
|
|
|
|
gint count;
|
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
selected_path = gimp_image_get_selected_paths (image);
|
2008-11-26 07:20:04 +00:00
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
for (list = gimp_image_get_path_iter (image), count = 0;
|
2003-09-28 20:47:14 +00:00
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
2024-07-12 06:16:25 +00:00
|
|
|
GimpPath *path = list->data;
|
|
|
|
GimpPath *new_path;
|
2003-09-28 20:47:14 +00:00
|
|
|
|
2024-07-12 06:16:25 +00:00
|
|
|
new_path = GIMP_PATH (gimp_image_duplicate_item (GIMP_ITEM (path),
|
|
|
|
new_image));
|
2003-09-28 20:47:14 +00:00
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
if (g_list_find (selected_path, path))
|
|
|
|
new_selected_path = g_list_prepend (new_selected_path, new_path);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
2003-09-28 20:47:14 +00:00
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
gimp_image_add_path (new_image, new_path,
|
|
|
|
NULL, count++, FALSE);
|
2003-09-28 20:47:14 +00:00
|
|
|
}
|
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
return new_selected_path;
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2001-02-25 14:37:12 +00:00
|
|
|
|
2010-08-08 17:50:08 +02:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_floating_sel (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
GimpLayer *floating_sel;
|
|
|
|
GimpDrawable *floating_sel_drawable;
|
|
|
|
GList *floating_sel_path;
|
|
|
|
GimpItemStack *new_item_stack;
|
|
|
|
GimpLayer *new_floating_sel;
|
|
|
|
GimpDrawable *new_floating_sel_drawable;
|
|
|
|
|
|
|
|
floating_sel = gimp_image_get_floating_selection (image);
|
|
|
|
|
|
|
|
if (! floating_sel)
|
|
|
|
return;
|
|
|
|
|
|
|
|
floating_sel_drawable = gimp_layer_get_floating_sel_drawable (floating_sel);
|
|
|
|
|
|
|
|
if (GIMP_IS_LAYER_MASK (floating_sel_drawable))
|
|
|
|
{
|
|
|
|
GimpLayer *layer;
|
|
|
|
|
|
|
|
layer = gimp_layer_mask_get_layer (GIMP_LAYER_MASK (floating_sel_drawable));
|
|
|
|
|
|
|
|
floating_sel_path = gimp_item_get_path (GIMP_ITEM (layer));
|
|
|
|
|
|
|
|
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_layers (new_image));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
floating_sel_path = gimp_item_get_path (GIMP_ITEM (floating_sel_drawable));
|
|
|
|
|
|
|
|
if (GIMP_IS_LAYER (floating_sel_drawable))
|
|
|
|
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_layers (new_image));
|
|
|
|
else
|
|
|
|
new_item_stack = GIMP_ITEM_STACK (gimp_image_get_channels (new_image));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* adjust path[0] for the floating layer missing in new_image */
|
|
|
|
floating_sel_path->data =
|
|
|
|
GUINT_TO_POINTER (GPOINTER_TO_UINT (floating_sel_path->data) - 1);
|
|
|
|
|
|
|
|
if (GIMP_IS_LAYER (floating_sel_drawable))
|
|
|
|
{
|
2010-08-08 18:00:08 +02:00
|
|
|
new_floating_sel =
|
|
|
|
GIMP_LAYER (gimp_image_duplicate_item (GIMP_ITEM (floating_sel),
|
|
|
|
new_image));
|
2010-08-08 17:50:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* can't use gimp_item_convert() for floating selections of channels
|
|
|
|
* or layer masks because they maybe don't have a normal layer's type
|
|
|
|
*/
|
2010-08-08 18:00:08 +02:00
|
|
|
new_floating_sel =
|
|
|
|
GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (floating_sel),
|
|
|
|
G_TYPE_FROM_INSTANCE (floating_sel)));
|
2010-08-08 17:50:08 +02:00
|
|
|
gimp_item_set_image (GIMP_ITEM (new_floating_sel), new_image);
|
2010-08-08 18:00:08 +02:00
|
|
|
|
|
|
|
gimp_object_set_name (GIMP_OBJECT (new_floating_sel),
|
|
|
|
gimp_object_get_name (floating_sel));
|
2010-08-08 17:50:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the copied layer doesn't say: "<old layer> copy" */
|
|
|
|
gimp_object_set_name (GIMP_OBJECT (new_floating_sel),
|
|
|
|
gimp_object_get_name (floating_sel));
|
|
|
|
|
|
|
|
new_floating_sel_drawable =
|
|
|
|
GIMP_DRAWABLE (gimp_item_stack_get_item_by_path (new_item_stack,
|
|
|
|
floating_sel_path));
|
|
|
|
|
|
|
|
if (GIMP_IS_LAYER_MASK (floating_sel_drawable))
|
|
|
|
new_floating_sel_drawable =
|
|
|
|
GIMP_DRAWABLE (gimp_layer_get_mask (GIMP_LAYER (new_floating_sel_drawable)));
|
|
|
|
|
|
|
|
floating_sel_attach (new_floating_sel, new_floating_sel_drawable);
|
|
|
|
|
|
|
|
g_list_free (floating_sel_path);
|
|
|
|
}
|
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_mask (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2012-03-15 11:45:27 +01:00
|
|
|
GimpDrawable *mask;
|
|
|
|
GimpDrawable *new_mask;
|
|
|
|
|
|
|
|
mask = GIMP_DRAWABLE (gimp_image_get_mask (image));
|
|
|
|
new_mask = GIMP_DRAWABLE (gimp_image_get_mask (new_image));
|
|
|
|
|
2018-05-24 10:21:21 -04:00
|
|
|
gimp_gegl_buffer_copy (gimp_drawable_get_buffer (mask), NULL, GEGL_ABYSS_NONE,
|
|
|
|
gimp_drawable_get_buffer (new_mask), NULL);
|
2012-03-15 11:45:27 +01:00
|
|
|
|
|
|
|
GIMP_CHANNEL (new_mask)->bounds_known = FALSE;
|
|
|
|
GIMP_CHANNEL (new_mask)->boundary_known = FALSE;
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2001-02-25 14:37:12 +00:00
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_components (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2010-02-04 09:08:50 +01:00
|
|
|
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
GimpImagePrivate *new_private = GIMP_IMAGE_GET_PRIVATE (new_image);
|
|
|
|
gint count;
|
2003-09-28 20:47:14 +00:00
|
|
|
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
for (count = 0; count < MAX_CHANNELS; count++)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2010-02-04 09:08:50 +01:00
|
|
|
new_private->visible[count] = private->visible[count];
|
|
|
|
new_private->active[count] = private->active[count];
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_image_duplicate_guides (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
GList *list;
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2009-08-02 17:44:05 +02:00
|
|
|
for (list = gimp_image_get_guides (image);
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2006-06-07 15:49:59 +00:00
|
|
|
GimpGuide *guide = list->data;
|
|
|
|
gint position = gimp_guide_get_position (guide);
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
|
2006-06-07 15:49:59 +00:00
|
|
|
switch (gimp_guide_get_orientation (guide))
|
2006-04-12 12:49:29 +00:00
|
|
|
{
|
|
|
|
case GIMP_ORIENTATION_HORIZONTAL:
|
2006-06-07 15:49:59 +00:00
|
|
|
gimp_image_add_hguide (new_image, position, FALSE);
|
2006-04-12 12:49:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_ORIENTATION_VERTICAL:
|
2006-06-07 15:49:59 +00:00
|
|
|
gimp_image_add_vguide (new_image, position, FALSE);
|
2006-04-12 12:49:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_error ("Unknown guide orientation.\n");
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2001-01-15 04:37:01 +00:00
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_sample_points (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = gimp_image_get_sample_points (image);
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
2005-03-04 16:34:59 +00:00
|
|
|
{
|
|
|
|
GimpSamplePoint *sample_point = list->data;
|
2016-01-04 22:06:27 +01:00
|
|
|
gint x;
|
|
|
|
gint y;
|
2005-03-04 16:34:59 +00:00
|
|
|
|
2016-01-04 22:06:27 +01:00
|
|
|
gimp_sample_point_get_position (sample_point, &x, &y);
|
|
|
|
|
|
|
|
gimp_image_add_sample_point_at_pos (new_image, x, y, FALSE);
|
2005-03-04 16:34:59 +00:00
|
|
|
}
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2005-03-04 16:34:59 +00:00
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_grid (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2010-02-03 22:16:02 +01:00
|
|
|
if (gimp_image_get_grid (image))
|
|
|
|
gimp_image_set_grid (new_image, gimp_image_get_grid (image), FALSE);
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
2003-09-28 20:47:14 +00:00
|
|
|
|
2013-11-21 21:43:28 +01:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_metadata (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
GimpMetadata *metadata = gimp_image_get_metadata (image);
|
|
|
|
|
|
|
|
if (metadata)
|
|
|
|
{
|
|
|
|
metadata = gimp_metadata_duplicate (metadata);
|
|
|
|
gimp_image_set_metadata (new_image, metadata, FALSE);
|
|
|
|
g_object_unref (metadata);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_quick_mask (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2010-02-04 09:49:45 +01:00
|
|
|
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
GimpImagePrivate *new_private = GIMP_IMAGE_GET_PRIVATE (new_image);
|
|
|
|
|
|
|
|
new_private->quick_mask_state = private->quick_mask_state;
|
|
|
|
new_private->quick_mask_inverted = private->quick_mask_inverted;
|
2024-02-13 18:00:46 +01:00
|
|
|
new_private->quick_mask_color = gegl_color_duplicate (private->quick_mask_color);
|
2008-11-26 07:20:04 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2008-11-26 07:20:04 +00:00
|
|
|
static void
|
|
|
|
gimp_image_duplicate_parasites (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2010-02-03 23:42:32 +01:00
|
|
|
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
GimpImagePrivate *new_private = GIMP_IMAGE_GET_PRIVATE (new_image);
|
|
|
|
|
|
|
|
if (private->parasites)
|
2002-03-22 15:21:18 +00:00
|
|
|
{
|
2010-02-03 23:42:32 +01:00
|
|
|
g_object_unref (new_private->parasites);
|
|
|
|
new_private->parasites = gimp_parasite_list_copy (private->parasites);
|
2002-03-22 15:21:18 +00:00
|
|
|
}
|
gave parasite undo a MISC_UNDO class for now so it compiles
* app/gimpdrawable.c: gave parasite undo a MISC_UNDO class for now
so it compiles
* app/tools_cmds.c: fix crop invoker to give correct args to
crop_image
* app/color_cmds.c: s/GRAY/GRAY_LUT/g;
* app/brush_select.[ch]: removed PDB procs, export brush_active_dialogs,
brush_select_dialog, s/active_dialogs/brush_active_dialogs/
* app/gimage_cmds.[ch]
* app/channel_ops.[ch]: removed channel ops PDB procs, moved duplicate
function from gimage_cmds to channel_ops, export offset and duplicate
* app/gimpbrushlist.[ch]: removed PDB procs
* app/gradient.[ch]: removed PDB procs,
* app/gradient_header.h: exported G_SAMPLE, GradSelect, num_gradients,
grad_active_dialogs, gradient_select_dialog
* app/gradient_select.c: removed PDB procs,
s/active_dialogs/grad_active_dialogs/
* app/patterns.[ch]: removed PDB procs
* app/pattern_select.[ch]: removed PDB procs,
s/active_dialogs/pattern_active_dialogs/
* app/procedural_db.c: removed PDB procs and supporting functions
* app/procedrual_db.h: fiddled with enums
* app/channel_cmds.[ch]
* app/drawable_cmds.[ch]
* app/parasite_cmds.[ch]: pdbgenned now, removed header files
* app/gimpparasite.c: minor cleanup
* app/internal_procs.c: use pdbgen stuff
* app/tools_cmds.c
* app/text_tool_cmds.c: updated from pdbgen
* app/brushes_cmds.c
* app/brush_select_cmds.c
* app/gradient_cmds.c
* app/gradient_select_cmds.c
* app/patterns_cmds.c
* app/pattern_select_cmds.c
* app/procedural_db_cmds.c: new pdbgen files
* app/Makefile.am: file shuffle (see above)
-Yosh
1999-04-23 20:54:02 +00:00
|
|
|
}
|
2015-08-30 01:29:46 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_image_duplicate_color_profile (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
2018-10-07 16:16:21 +02:00
|
|
|
GimpColorProfile *profile = gimp_image_get_color_profile (image);
|
|
|
|
GimpColorProfile *hidden = _gimp_image_get_hidden_profile (image);
|
2015-08-30 01:29:46 +02:00
|
|
|
|
2018-10-07 16:16:21 +02:00
|
|
|
gimp_image_set_color_profile (new_image, profile, NULL);
|
|
|
|
_gimp_image_set_hidden_profile (new_image, hidden, FALSE);
|
2015-08-30 01:29:46 +02:00
|
|
|
}
|
2025-01-20 18:28:36 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_image_duplicate_simulation_profile (GimpImage *image,
|
|
|
|
GimpImage *new_image)
|
|
|
|
{
|
|
|
|
GimpColorProfile *profile;
|
|
|
|
GimpColorRenderingIntent intent;
|
|
|
|
gboolean bpc;
|
|
|
|
|
|
|
|
profile = gimp_image_get_simulation_profile (image);
|
|
|
|
intent = gimp_image_get_simulation_intent (image);
|
|
|
|
bpc = gimp_image_get_simulation_bpc (image);
|
|
|
|
|
|
|
|
gimp_image_set_simulation_profile (new_image, profile);
|
|
|
|
gimp_image_set_simulation_intent (new_image, intent);
|
|
|
|
gimp_image_set_simulation_bpc (new_image, bpc);
|
|
|
|
}
|