[gimp] Move the new "default_new_layer_mode" APIs to the image...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Move the new "default_new_layer_mode" APIs to the image...
- Date: Mon, 21 Aug 2017 18:19:32 +0000 (UTC)
commit e16c8a2352143446ef580a9db51d57c634ea2311
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 21 20:04:25 2017 +0200
Move the new "default_new_layer_mode" APIs to the image...
...in both the core and libgimp.
Images now know what the default mode for new layers is:
- NORMAL for empty images
- NORMAL for images with any non-legacy layer
- NORMAL_LEGAVY for images with only legacy layers
This changes behavior when layers are created from the UI, but *also*
when created by plug-ins (yes there is a compat issue here):
- Most (all?) single-layer file importers now create NORMAL layers
- Screenshot, Webpage etc also create NORMAL layers
Scripts that create images from scratch (logos etc) should not be
affected because they usually have NORMAL_LEGACY hardcoded.
3rd party plug-ins and scripts will also behave old-style unless they
get ported to gimp_image_get_default_new_layer_mode().
app/actions/layers-commands.c | 4 +-
app/config/gimpcoreconfig.c | 15 --
app/config/gimpcoreconfig.h | 1 -
app/config/gimprc-blurbs.h | 3 -
app/core/gimp-edit.c | 4 +-
app/core/gimpdrawable-transform.c | 4 +-
app/core/gimpimage-merge.c | 6 +-
app/core/gimpimage-new.c | 8 +-
app/core/gimpimage-private.h | 1 +
app/core/gimpimage.c | 64 +++++++
app/core/gimpimage.h | 5 +
app/core/gimplayer.c | 7 +-
app/core/gimpselection.c | 4 +-
app/display/gimpdisplayshell-dnd.c | 4 +-
app/pdb/gimprc-cmds.c | 43 -----
app/pdb/image-cmds.c | 59 ++++++
app/pdb/layer-cmds.c | 3 +-
app/tools/gimpwarptool.c | 5 +-
app/widgets/gimplayertreeview.c | 6 +-
libgimp/gimp.def | 2 +-
libgimp/gimpgimprc_pdb.c | 30 ---
libgimp/gimpgimprc_pdb.h | 23 +--
libgimp/gimpimage_pdb.c | 32 +++
libgimp/gimpimage_pdb.h | 325 ++++++++++++++++----------------
libgimp/gimpimagemetadata.c | 2 +-
plug-ins/common/animation-optimize.c | 4 +-
plug-ins/common/compose.c | 3 +-
plug-ins/common/decompose.c | 3 +-
plug-ins/common/edge-dog.c | 2 +-
plug-ins/common/file-cel.c | 6 +-
plug-ins/common/file-dicom.c | 3 +-
plug-ins/common/file-gbr.c | 3 +-
plug-ins/common/file-gegl.c | 3 +-
plug-ins/common/file-gif-load.c | 9 +-
plug-ins/common/file-gih.c | 3 +-
plug-ins/common/file-jp2-load.c | 3 +-
plug-ins/common/file-pat.c | 3 +-
plug-ins/common/file-pcx.c | 6 +-
plug-ins/common/file-pix.c | 3 +-
plug-ins/common/file-png.c | 3 +-
plug-ins/common/file-pnm.c | 3 +-
plug-ins/common/file-ps.c | 3 +-
plug-ins/common/file-raw-data.c | 3 +-
plug-ins/common/file-sunras.c | 3 +-
plug-ins/common/file-svg.c | 3 +-
plug-ins/common/file-tga.c | 3 +-
plug-ins/common/file-wmf.c | 3 +-
plug-ins/common/file-xbm.c | 2 +-
plug-ins/common/file-xmc.c | 6 +-
plug-ins/common/file-xpm.c | 2 +-
plug-ins/common/file-xwd.c | 3 +-
plug-ins/common/film.c | 3 +-
plug-ins/common/hot.c | 3 +-
plug-ins/common/smooth-palette.c | 3 +-
plug-ins/common/tile.c | 3 +-
plug-ins/common/warp.c | 6 +-
plug-ins/common/web-page.c | 3 +-
plug-ins/file-bmp/bmp-load.c | 3 +-
plug-ins/file-exr/file-exr.c | 3 +-
plug-ins/file-faxg3/faxg3.c | 3 +-
plug-ins/file-fits/fits.c | 3 +-
plug-ins/file-fli/fli-gimp.c | 3 +-
plug-ins/file-ico/ico-dialog.c | 6 +-
plug-ins/file-ico/ico-load.c | 3 +-
plug-ins/file-ico/ico-save.c | 3 +-
plug-ins/file-jpeg/jpeg-load.c | 6 +-
plug-ins/file-psd/psd-image-res-load.c | 3 +-
plug-ins/file-psd/psd-load.c | 6 +-
plug-ins/file-sgi/sgi.c | 3 +-
plug-ins/file-tiff/file-tiff-load.c | 6 +-
plug-ins/file-webp/file-webp-load.c | 2 +-
plug-ins/gfig/gfig-dialog.c | 3 +-
plug-ins/lighting/lighting-apply.c | 4 +-
plug-ins/map-object/map-object-apply.c | 2 +-
plug-ins/pagecurl/pagecurl.c | 3 +-
plug-ins/pygimp/pygimp-drawable.c | 4 +-
plug-ins/pygimp/pygimp-image.c | 2 +-
plug-ins/screenshot/screenshot-win32.c | 3 +-
plug-ins/screenshot/screenshot-x11.c | 3 +-
tools/pdbgen/pdb/gimprc.pdb | 22 ---
tools/pdbgen/pdb/image.pdb | 29 +++-
tools/pdbgen/pdb/layer.pdb | 3 +-
82 files changed, 510 insertions(+), 393 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index dccd072..4c3bf8c 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -396,7 +396,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
off_x = 0;
off_y = 0;
opacity = 1.0;
- mode = image->gimp->config->default_new_layer_mode;
+ mode = gimp_image_get_default_new_layer_mode (image);
}
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
@@ -442,7 +442,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action,
TRUE),
_("Visible"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode,
+ gimp_image_get_default_new_layer_mode (image),
profile);
gimp_image_add_layer (image, layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index 288a323..31dec43 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -58,7 +58,6 @@ enum
PROP_LANGUAGE,
PROP_INTERPOLATION_TYPE,
PROP_DEFAULT_THRESHOLD,
- PROP_DEFAULT_NEW_LAYER_MODE,
PROP_PLUG_IN_PATH,
PROP_MODULE_PATH,
PROP_INTERPRETER_PATH,
@@ -182,14 +181,6 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
0, 255, 15,
GIMP_PARAM_STATIC_STRINGS);
- GIMP_CONFIG_PROP_ENUM (object_class, PROP_DEFAULT_NEW_LAYER_MODE,
- "default-new-layer-mode",
- "Default new layer mode",
- DEFAULT_NEW_LAYER_MODE_BLURB,
- GIMP_TYPE_LAYER_MODE,
- GIMP_LAYER_MODE_NORMAL_LEGACY,
- GIMP_PARAM_STATIC_STRINGS);
-
path = gimp_config_build_plug_in_path ("plug-ins");
GIMP_CONFIG_PROP_PATH (object_class, PROP_PLUG_IN_PATH,
"plug-in-path",
@@ -762,9 +753,6 @@ gimp_core_config_set_property (GObject *object,
case PROP_DEFAULT_THRESHOLD:
core_config->default_threshold = g_value_get_int (value);
break;
- case PROP_DEFAULT_NEW_LAYER_MODE:
- core_config->default_new_layer_mode = g_value_get_enum (value);
- break;
case PROP_PLUG_IN_PATH:
g_free (core_config->plug_in_path);
core_config->plug_in_path = g_value_dup_string (value);
@@ -988,9 +976,6 @@ gimp_core_config_get_property (GObject *object,
case PROP_DEFAULT_THRESHOLD:
g_value_set_int (value, core_config->default_threshold);
break;
- case PROP_DEFAULT_NEW_LAYER_MODE:
- g_value_set_enum (value, core_config->default_new_layer_mode);
- break;
case PROP_PLUG_IN_PATH:
g_value_set_string (value, core_config->plug_in_path);
break;
diff --git a/app/config/gimpcoreconfig.h b/app/config/gimpcoreconfig.h
index bdb6147..2ef1df1 100644
--- a/app/config/gimpcoreconfig.h
+++ b/app/config/gimpcoreconfig.h
@@ -43,7 +43,6 @@ struct _GimpCoreConfig
gchar *language;
GimpInterpolationType interpolation_type;
gint default_threshold;
- GimpLayerMode default_new_layer_mode;
gchar *plug_in_path;
gchar *module_path;
gchar *interpreter_path;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 6f2e095..599b044 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -105,9 +105,6 @@ _("This is the distance in pixels where Guide and Grid snapping " \
#define SNAP_TO_PATH_BLURB \
"Snap to the active path by default in new image windows."
-#define DEFAULT_NEW_LAYER_MODE_BLURB \
-_("The default layer mode for newly created layers and images.")
-
#define DEFAULT_THRESHOLD_BLURB \
_("Tools such as fuzzy-select and bucket fill find regions based on a " \
"seed-fill algorithm. The seed fill starts at the initially selected " \
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 6a2ef5d..4ecbe13 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -28,8 +28,6 @@
#include "core-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "gegl/gimp-gegl-utils.h"
#include "gimp.h"
@@ -423,7 +421,7 @@ gimp_edit_paste (GimpImage *image,
floating_format,
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
}
if (! layer)
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index 3dc3f65..19113d1 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -30,8 +30,6 @@
#include "core-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "gegl/gimp-gegl-apply-operation.h"
#include "gegl/gimp-gegl-utils.h"
@@ -1015,7 +1013,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
gimp_drawable_get_format_with_alpha (drawable),
_("Transformation"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode,
+ gimp_image_get_default_new_layer_mode (image),
buffer_profile);
gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index f669576..893cf98 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -27,8 +27,6 @@
#include "core-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "gegl/gimp-babl-compat.h"
#include "gegl/gimp-gegl-apply-operation.h"
#include "gegl/gimp-gegl-nodes.h"
@@ -529,7 +527,7 @@ gimp_image_merge_layers (GimpImage *image,
gimp_image_get_layer_format (image, FALSE),
gimp_object_get_name (bottom_layer),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
if (! merge_layer)
{
@@ -559,7 +557,7 @@ gimp_image_merge_layers (GimpImage *image,
gimp_drawable_get_format_with_alpha (GIMP_DRAWABLE (bottom_layer)),
gimp_object_get_name (bottom_layer),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
if (! merge_layer)
{
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index b97f794..b14c54f 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -149,7 +149,7 @@ gimp_image_new_from_template (Gimp *gimp,
gimp_image_get_layer_format (image, has_alpha),
_("Background"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
gimp_drawable_fill (GIMP_DRAWABLE (layer),
context, gimp_template_get_fill_type (template));
@@ -225,7 +225,7 @@ gimp_image_new_from_drawable (Gimp *gimp,
gimp_item_set_visible (GIMP_ITEM (new_layer), TRUE, FALSE);
gimp_item_set_linked (GIMP_ITEM (new_layer), FALSE, FALSE);
gimp_layer_set_mode (new_layer,
- new_image->gimp->config->default_new_layer_mode,
+ gimp_image_get_default_new_layer_mode (new_image),
FALSE);
gimp_layer_set_opacity (new_layer, GIMP_OPACITY_OPAQUE, FALSE);
if (gimp_layer_can_lock_alpha (new_layer))
@@ -324,7 +324,7 @@ gimp_image_new_from_buffer (Gimp *gimp,
has_alpha),
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_add_layer (image, layer, NULL, 0, TRUE);
@@ -383,7 +383,7 @@ gimp_image_new_from_pixbuf (Gimp *gimp,
has_alpha),
layer_name,
GIMP_OPACITY_OPAQUE,
- new_image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (new_image));
gimp_image_add_layer (new_image, layer, NULL, 0, TRUE);
diff --git a/app/core/gimpimage-private.h b/app/core/gimpimage-private.h
index 262159b..1047ed3 100644
--- a/app/core/gimpimage-private.h
+++ b/app/core/gimpimage-private.h
@@ -49,6 +49,7 @@ struct _GimpImagePrivate
GimpUnit resolution_unit; /* resolution unit */
GimpImageBaseType base_type; /* base gimp_image type */
GimpPrecision precision; /* image's precision */
+ GimpLayerMode new_layer_mode; /* default mode of new layers */
guchar *colormap; /* colormap (for indexed) */
gint n_colors; /* # of colors (for indexed) */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 4f76a22..083c7c1 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -34,6 +34,8 @@
#include "config/gimpcoreconfig.h"
+#include "operations/layer-modes/gimp-layer-modes.h"
+
#include "gegl/gimp-babl.h"
#include "gimp.h"
@@ -699,6 +701,7 @@ gimp_image_init (GimpImage *image)
private->resolution_unit = GIMP_UNIT_INCH;
private->base_type = GIMP_RGB;
private->precision = GIMP_PRECISION_U8_GAMMA;
+ private->new_layer_mode = -1;
private->colormap = NULL;
private->n_colors = 0;
@@ -1850,6 +1853,63 @@ gimp_image_get_mask_format (GimpImage *image)
return gimp_babl_mask_format (gimp_image_get_precision (image));
}
+GimpLayerMode
+gimp_image_get_default_new_layer_mode (GimpImage *image)
+{
+ GimpImagePrivate *private;
+
+ g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_LAYER_MODE_NORMAL);
+
+ private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ if (private->new_layer_mode == -1)
+ {
+ GList *layers = gimp_image_get_layer_list (image);
+
+ if (layers)
+ {
+ GList *list;
+
+ for (list = layers; list; list = g_list_next (list))
+ {
+ GimpLayer *layer = list->data;
+ GimpLayerMode mode = gimp_layer_get_mode (layer);
+
+ if (! gimp_layer_mode_is_legacy (mode))
+ {
+ /* any non-legacy layer switches the mode to non-legacy
+ */
+ private->new_layer_mode = GIMP_LAYER_MODE_NORMAL;
+ break;
+ }
+ }
+
+ /* only if all layers are legacy, the mode is also legacy
+ */
+ if (! list)
+ private->new_layer_mode = GIMP_LAYER_MODE_NORMAL_LEGACY;
+
+ g_list_free (layers);
+ }
+ else
+ {
+ /* empty images are never considered legacy
+ */
+ private->new_layer_mode = GIMP_LAYER_MODE_NORMAL;
+ }
+ }
+
+ return private->new_layer_mode;
+}
+
+void
+gimp_image_unset_default_new_layer_mode (GimpImage *image)
+{
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+
+ GIMP_IMAGE_GET_PRIVATE (image)->new_layer_mode = -1;
+}
+
gint
gimp_image_get_ID (GimpImage *image)
{
@@ -4208,6 +4268,8 @@ gimp_image_add_layer (GimpImage *image,
&position))
return FALSE;
+ gimp_image_unset_default_new_layer_mode (image);
+
/* If there is a floating selection (and this isn't it!),
* make sure the insert position is greater than 0
*/
@@ -4257,6 +4319,8 @@ gimp_image_remove_layer (GimpImage *image,
private = GIMP_IMAGE_GET_PRIVATE (image);
+ gimp_image_unset_default_new_layer_mode (image);
+
if (gimp_drawable_get_floating_sel (GIMP_DRAWABLE (layer)))
{
if (! push_undo)
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index 81489a8..f72f634 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -128,6 +128,11 @@ const Babl * gimp_image_get_layer_format (GimpImage *image,
const Babl * gimp_image_get_channel_format (GimpImage *image);
const Babl * gimp_image_get_mask_format (GimpImage *image);
+GimpLayerMode gimp_image_get_default_new_layer_mode
+ (GimpImage *image);
+void gimp_image_unset_default_new_layer_mode
+ (GimpImage *image);
+
gint gimp_image_get_ID (GimpImage *image);
GimpImage * gimp_image_get_by_ID (Gimp *gimp,
gint id);
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 451ce45..0f9db02 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -2334,11 +2334,14 @@ gimp_layer_set_mode (GimpLayer *layer,
if (layer->mode != mode)
{
- if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
+ if (gimp_item_is_attached (GIMP_ITEM (layer)))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
- gimp_image_undo_push_layer_mode (image, NULL, layer);
+ gimp_image_unset_default_new_layer_mode (image);
+
+ if (push_undo)
+ gimp_image_undo_push_layer_mode (image, NULL, layer);
}
g_object_freeze_notify (G_OBJECT (layer));
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index f8a7774..4bfe1c2 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -25,8 +25,6 @@
#include "core-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-apply-operation.h"
@@ -893,7 +891,7 @@ gimp_selection_float (GimpSelection *selection,
gimp_drawable_get_format_with_alpha (drawable),
_("Floated Layer"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode,
+ gimp_image_get_default_new_layer_mode (image),
profile);
/* Set the offsets */
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 91a7e26..e45ac1b 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -27,8 +27,6 @@
#include "display-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "core/gimp.h"
#include "core/gimp-edit.h"
#include "core/gimpbuffer.h"
@@ -725,7 +723,7 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
gimp_image_get_layer_format (image, has_alpha),
_("Dropped Buffer"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
if (new_layer)
{
diff --git a/app/pdb/gimprc-cmds.c b/app/pdb/gimprc-cmds.c
index 2eea82a..7f4b502 100644
--- a/app/pdb/gimprc-cmds.c
+++ b/app/pdb/gimprc-cmds.c
@@ -174,25 +174,6 @@ get_monitor_resolution_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
-get_default_new_layer_mode_invoker (GimpProcedure *procedure,
- Gimp *gimp,
- GimpContext *context,
- GimpProgress *progress,
- const GimpValueArray *args,
- GError **error)
-{
- GimpValueArray *return_vals;
- gint32 mode = 0;
-
- mode = gimp->config->default_new_layer_mode;
-
- return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
- g_value_set_enum (gimp_value_array_index (return_vals, 1), mode);
-
- return return_vals;
-}
-
-static GimpValueArray *
get_theme_dir_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -420,30 +401,6 @@ register_gimprc_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
- * gimp-get-default-new-layer-mode
- */
- procedure = gimp_procedure_new (get_default_new_layer_mode_invoker);
- gimp_object_set_static_name (GIMP_OBJECT (procedure),
- "gimp-get-default-new-layer-mode");
- gimp_procedure_set_static_strings (procedure,
- "gimp-get-default-new-layer-mode",
- "Get the default mode for newly created layers.",
- "Returns the default mode for newly created layers.",
- "Michael Natterer <mitch gimp org>",
- "Michael Natterer",
- "2017",
- NULL);
- gimp_procedure_add_return_value (procedure,
- g_param_spec_enum ("mode",
- "mode",
- "The layer mode",
- GIMP_TYPE_LAYER_MODE,
- GIMP_LAYER_MODE_NORMAL,
- GIMP_PARAM_READWRITE));
- gimp_pdb_register_procedure (pdb, procedure);
- g_object_unref (procedure);
-
- /*
* gimp-get-theme-dir
*/
procedure = gimp_procedure_new (get_theme_dir_invoker);
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 29977b0..7c96937 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -335,6 +335,35 @@ image_get_precision_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+image_get_default_new_layer_mode_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 mode = 0;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ mode = gimp_image_get_default_new_layer_mode (image);
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ g_value_set_enum (gimp_value_array_index (return_vals, 1), mode);
+
+ return return_vals;
+}
+
+static GimpValueArray *
image_width_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -2999,6 +3028,36 @@ register_image_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-image-get-default-new-layer-mode
+ */
+ procedure = gimp_procedure_new (image_get_default_new_layer_mode_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-default-new-layer-mode");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-default-new-layer-mode",
+ "Get the default mode for newly created layers of this image.",
+ "Returns the default mode for newly created layers of this image.",
+ "Michael Natterer <mitch gimp org>",
+ "Michael Natterer",
+ "2017",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ g_param_spec_enum ("mode",
+ "mode",
+ "The layer mode",
+ GIMP_TYPE_LAYER_MODE,
+ GIMP_LAYER_MODE_NORMAL,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-image-width
*/
procedure = gimp_procedure_new (image_width_invoker);
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index 84014da..ddfb03b 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -32,7 +32,6 @@
#include "pdb-types.h"
-#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpgrouplayer.h"
@@ -183,7 +182,7 @@ layer_new_from_visible_invoker (GimpProcedure *procedure,
TRUE),
name,
GIMP_OPACITY_OPAQUE,
- gimp->config->default_new_layer_mode,
+ gimp_image_get_default_new_layer_mode (dest_image),
profile);
}
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 0ee09c8..1ccb3bb 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -29,8 +29,6 @@
#include "tools-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "gegl/gimp-gegl-apply-operation.h"
#include "core/gimp.h"
@@ -1108,7 +1106,8 @@ gimp_warp_tool_animate (GimpWarpTool *wt)
gimp_item_set_offset (GIMP_ITEM (layer), 0, 0);
gimp_item_set_visible (GIMP_ITEM (layer), TRUE, FALSE);
- gimp_layer_set_mode (layer, image->gimp->config->default_new_layer_mode, FALSE);
+ gimp_layer_set_mode (layer, gimp_image_get_default_new_layer_mode (image),
+ FALSE);
gimp_layer_set_opacity (layer, GIMP_OPACITY_OPAQUE, FALSE);
gimp_image_add_layer (image, layer, NULL, 0, FALSE);
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index bc0fcbd..e88e285 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -31,8 +31,6 @@
#include "widgets-types.h"
-#include "config/gimpcoreconfig.h"
-
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage-undo.h"
@@ -811,7 +809,7 @@ gimp_layer_tree_view_drop_pixbuf (GimpContainerTreeView *tree_view,
gimp_image_get_layer_format (image, TRUE),
_("Dropped Buffer"),
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_add_layer (image, new_layer, parent, index, TRUE);
@@ -853,7 +851,7 @@ gimp_layer_tree_view_item_new (GimpImage *image)
gimp_image_get_layer_format (image, TRUE),
NULL,
GIMP_OPACITY_OPAQUE,
- image->gimp->config->default_new_layer_mode);
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_add_layer (image, new_layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index f0d63d9..3c3ddc7 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -332,7 +332,6 @@ EXPORTS
gimp_gamma
gimp_get_color_configuration
gimp_get_default_comment
- gimp_get_default_new_layer_mode
gimp_get_default_unit
gimp_get_icon_theme_dir
gimp_get_module_load_inhibit
@@ -437,6 +436,7 @@ EXPORTS
gimp_image_get_colormap
gimp_image_get_component_active
gimp_image_get_component_visible
+ gimp_image_get_default_new_layer_mode
gimp_image_get_effective_color_profile
gimp_image_get_exported_uri
gimp_image_get_filename
diff --git a/libgimp/gimpgimprc_pdb.c b/libgimp/gimpgimprc_pdb.c
index 8f2cc5a..e595b58 100644
--- a/libgimp/gimpgimprc_pdb.c
+++ b/libgimp/gimpgimprc_pdb.c
@@ -209,36 +209,6 @@ gimp_get_monitor_resolution (gdouble *xres,
}
/**
- * gimp_get_default_new_layer_mode:
- *
- * Get the default mode for newly created layers.
- *
- * Returns the default mode for newly created layers.
- *
- * Returns: The layer mode.
- *
- * Since: 2.10
- **/
-GimpLayerMode
-gimp_get_default_new_layer_mode (void)
-{
- GimpParam *return_vals;
- gint nreturn_vals;
- GimpLayerMode mode = 0;
-
- return_vals = gimp_run_procedure ("gimp-get-default-new-layer-mode",
- &nreturn_vals,
- GIMP_PDB_END);
-
- if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
- mode = return_vals[1].data.d_int32;
-
- gimp_destroy_params (return_vals, nreturn_vals);
-
- return mode;
-}
-
-/**
* gimp_get_theme_dir:
*
* Get the directory of the current GUI theme.
diff --git a/libgimp/gimpgimprc_pdb.h b/libgimp/gimpgimprc_pdb.h
index 420d31f..4be14ca 100644
--- a/libgimp/gimpgimprc_pdb.h
+++ b/libgimp/gimpgimprc_pdb.h
@@ -32,18 +32,17 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gchar* gimp_gimprc_query (const gchar *token);
-gboolean gimp_gimprc_set (const gchar *token,
- const gchar *value);
-gchar* gimp_get_default_comment (void);
-GimpUnit gimp_get_default_unit (void);
-gboolean gimp_get_monitor_resolution (gdouble *xres,
- gdouble *yres);
-GimpLayerMode gimp_get_default_new_layer_mode (void);
-gchar* gimp_get_theme_dir (void);
-gchar* gimp_get_icon_theme_dir (void);
-G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
-gchar* gimp_get_module_load_inhibit (void);
+gchar* gimp_gimprc_query (const gchar *token);
+gboolean gimp_gimprc_set (const gchar *token,
+ const gchar *value);
+gchar* gimp_get_default_comment (void);
+GimpUnit gimp_get_default_unit (void);
+gboolean gimp_get_monitor_resolution (gdouble *xres,
+ gdouble *yres);
+gchar* gimp_get_theme_dir (void);
+gchar* gimp_get_icon_theme_dir (void);
+G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
+gchar* gimp_get_module_load_inhibit (void);
G_END_DECLS
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 773a719..4d6022b 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -327,6 +327,38 @@ gimp_image_get_precision (gint32 image_ID)
}
/**
+ * gimp_image_get_default_new_layer_mode:
+ * @image_ID: The image.
+ *
+ * Get the default mode for newly created layers of this image.
+ *
+ * Returns the default mode for newly created layers of this image.
+ *
+ * Returns: The layer mode.
+ *
+ * Since: 2.10
+ **/
+GimpLayerMode
+gimp_image_get_default_new_layer_mode (gint32 image_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ GimpLayerMode mode = 0;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-default-new-layer-mode",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ mode = return_vals[1].data.d_int32;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return mode;
+}
+
+/**
* gimp_image_width:
* @image_ID: The image.
*
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index 22f321c..f77d60c 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -32,172 +32,173 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_is_valid (gint32 image_ID);
-gint* gimp_image_list (gint *num_images);
-gint32 gimp_image_new (gint width,
- gint height,
- GimpImageBaseType type);
-gint32 gimp_image_new_with_precision (gint width,
- gint height,
- GimpImageBaseType type,
- GimpPrecision precision);
-gint32 gimp_image_duplicate (gint32 image_ID);
-gboolean gimp_image_delete (gint32 image_ID);
-GimpImageBaseType gimp_image_base_type (gint32 image_ID);
-GimpPrecision gimp_image_get_precision (gint32 image_ID);
-gint gimp_image_width (gint32 image_ID);
-gint gimp_image_height (gint32 image_ID);
+gboolean gimp_image_is_valid (gint32 image_ID);
+gint* gimp_image_list (gint *num_images);
+gint32 gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type);
+gint32 gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision);
+gint32 gimp_image_duplicate (gint32 image_ID);
+gboolean gimp_image_delete (gint32 image_ID);
+GimpImageBaseType gimp_image_base_type (gint32 image_ID);
+GimpPrecision gimp_image_get_precision (gint32 image_ID);
+GimpLayerMode gimp_image_get_default_new_layer_mode (gint32 image_ID);
+gint gimp_image_width (gint32 image_ID);
+gint gimp_image_height (gint32 image_ID);
GIMP_DEPRECATED_FOR(gimp_drawable_free_shadow)
-gboolean gimp_image_free_shadow (gint32 image_ID);
-gint* gimp_image_get_layers (gint32 image_ID,
- gint *num_layers);
-gint* gimp_image_get_channels (gint32 image_ID,
- gint *num_channels);
-gint* gimp_image_get_vectors (gint32 image_ID,
- gint *num_vectors);
-gint32 gimp_image_get_active_drawable (gint32 image_ID);
-gboolean gimp_image_unset_active_channel (gint32 image_ID);
-gint32 gimp_image_get_floating_sel (gint32 image_ID);
-gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
-gboolean gimp_image_pick_color (gint32 image_ID,
- gint32 drawable_ID,
- gdouble x,
- gdouble y,
- gboolean sample_merged,
- gboolean sample_average,
- gdouble average_radius,
- GimpRGB *color);
-gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
- gint x,
- gint y);
+gboolean gimp_image_free_shadow (gint32 image_ID);
+gint* gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers);
+gint* gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels);
+gint* gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors);
+gint32 gimp_image_get_active_drawable (gint32 image_ID);
+gboolean gimp_image_unset_active_channel (gint32 image_ID);
+gint32 gimp_image_get_floating_sel (gint32 image_ID);
+gint32 gimp_image_floating_sel_attached_to (gint32 image_ID);
+gboolean gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color);
+gint32 gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y);
GIMP_DEPRECATED_FOR(gimp_image_insert_layer)
-gboolean gimp_image_add_layer (gint32 image_ID,
- gint32 layer_ID,
- gint position);
-gboolean gimp_image_insert_layer (gint32 image_ID,
- gint32 layer_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_layer (gint32 image_ID,
- gint32 layer_ID);
+gboolean gimp_image_add_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint position);
+gboolean gimp_image_insert_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID);
GIMP_DEPRECATED_FOR(gimp_image_insert_channel)
-gboolean gimp_image_add_channel (gint32 image_ID,
- gint32 channel_ID,
- gint position);
-gboolean gimp_image_insert_channel (gint32 image_ID,
- gint32 channel_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_channel (gint32 image_ID,
- gint32 channel_ID);
+gboolean gimp_image_add_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint position);
+gboolean gimp_image_insert_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID);
GIMP_DEPRECATED_FOR(gimp_image_insert_vectors)
-gboolean gimp_image_add_vectors (gint32 image_ID,
- gint32 vectors_ID,
- gint position);
-gboolean gimp_image_insert_vectors (gint32 image_ID,
- gint32 vectors_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_vectors (gint32 image_ID,
- gint32 vectors_ID);
-gint gimp_image_get_item_position (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_raise_item (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_lower_item (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_raise_item_to_top (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_lower_item_to_bottom (gint32 image_ID,
- gint32 item_ID);
-gboolean gimp_image_reorder_item (gint32 image_ID,
- gint32 item_ID,
- gint32 parent_ID,
- gint position);
-gint32 gimp_image_flatten (gint32 image_ID);
-gint32 gimp_image_merge_visible_layers (gint32 image_ID,
- GimpMergeType merge_type);
-gint32 gimp_image_merge_down (gint32 image_ID,
- gint32 merge_layer_ID,
- GimpMergeType merge_type);
-G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
- gint *num_bytes);
-G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
- gint num_bytes,
- const guint8 *colormap);
-G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (gint32 image_ID);
-G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (gint32 image_ID,
- const gchar *metadata_string);
-gboolean gimp_image_clean_all (gint32 image_ID);
-gboolean gimp_image_is_dirty (gint32 image_ID);
-G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
- gint width,
- gint height,
- gint *actual_width,
- gint *actual_height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data);
-gint32 gimp_image_get_active_layer (gint32 image_ID);
-gboolean gimp_image_set_active_layer (gint32 image_ID,
- gint32 active_layer_ID);
-gint32 gimp_image_get_active_channel (gint32 image_ID);
-gboolean gimp_image_set_active_channel (gint32 image_ID,
- gint32 active_channel_ID);
-gint32 gimp_image_get_active_vectors (gint32 image_ID);
-gboolean gimp_image_set_active_vectors (gint32 image_ID,
- gint32 active_vectors_ID);
-gint32 gimp_image_get_selection (gint32 image_ID);
-gboolean gimp_image_get_component_active (gint32 image_ID,
- GimpChannelType component);
-gboolean gimp_image_set_component_active (gint32 image_ID,
- GimpChannelType component,
- gboolean active);
-gboolean gimp_image_get_component_visible (gint32 image_ID,
- GimpChannelType component);
-gboolean gimp_image_set_component_visible (gint32 image_ID,
- GimpChannelType component,
- gboolean visible);
-gchar* gimp_image_get_filename (gint32 image_ID);
-gboolean gimp_image_set_filename (gint32 image_ID,
- const gchar *filename);
-gchar* gimp_image_get_uri (gint32 image_ID);
-gchar* gimp_image_get_xcf_uri (gint32 image_ID);
-gchar* gimp_image_get_imported_uri (gint32 image_ID);
-gchar* gimp_image_get_exported_uri (gint32 image_ID);
-gchar* gimp_image_get_name (gint32 image_ID);
-gboolean gimp_image_get_resolution (gint32 image_ID,
- gdouble *xresolution,
- gdouble *yresolution);
-gboolean gimp_image_set_resolution (gint32 image_ID,
- gdouble xresolution,
- gdouble yresolution);
-GimpUnit gimp_image_get_unit (gint32 image_ID);
-gboolean gimp_image_set_unit (gint32 image_ID,
- GimpUnit unit);
-gint gimp_image_get_tattoo_state (gint32 image_ID);
-gboolean gimp_image_set_tattoo_state (gint32 image_ID,
- gint tattoo_state);
-gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
- gint tattoo);
-gint32 gimp_image_get_layer_by_name (gint32 image_ID,
- const gchar *name);
-gint32 gimp_image_get_channel_by_name (gint32 image_ID,
- const gchar *name);
-gint32 gimp_image_get_vectors_by_name (gint32 image_ID,
- const gchar *name);
-gboolean gimp_image_attach_parasite (gint32 image_ID,
- const GimpParasite *parasite);
-gboolean gimp_image_detach_parasite (gint32 image_ID,
- const gchar *name);
-GimpParasite* gimp_image_get_parasite (gint32 image_ID,
- const gchar *name);
-gchar** gimp_image_get_parasite_list (gint32 image_ID,
- gint *num_parasites);
+gboolean gimp_image_add_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint position);
+gboolean gimp_image_insert_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gint gimp_image_get_item_position (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item_to_top (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item_to_bottom (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_reorder_item (gint32 image_ID,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position);
+gint32 gimp_image_flatten (gint32 image_ID);
+gint32 gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type);
+gint32 gimp_image_merge_down (gint32 image_ID,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type);
+G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap);
+G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (gint32 image_ID,
+ const gchar *metadata_string);
+gboolean gimp_image_clean_all (gint32 image_ID);
+gboolean gimp_image_is_dirty (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gint32 gimp_image_get_active_layer (gint32 image_ID);
+gboolean gimp_image_set_active_layer (gint32 image_ID,
+ gint32 active_layer_ID);
+gint32 gimp_image_get_active_channel (gint32 image_ID);
+gboolean gimp_image_set_active_channel (gint32 image_ID,
+ gint32 active_channel_ID);
+gint32 gimp_image_get_active_vectors (gint32 image_ID);
+gboolean gimp_image_set_active_vectors (gint32 image_ID,
+ gint32 active_vectors_ID);
+gint32 gimp_image_get_selection (gint32 image_ID);
+gboolean gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active);
+gboolean gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ gboolean visible);
+gchar* gimp_image_get_filename (gint32 image_ID);
+gboolean gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename);
+gchar* gimp_image_get_uri (gint32 image_ID);
+gchar* gimp_image_get_xcf_uri (gint32 image_ID);
+gchar* gimp_image_get_imported_uri (gint32 image_ID);
+gchar* gimp_image_get_exported_uri (gint32 image_ID);
+gchar* gimp_image_get_name (gint32 image_ID);
+gboolean gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution);
+gboolean gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution);
+GimpUnit gimp_image_get_unit (gint32 image_ID);
+gboolean gimp_image_set_unit (gint32 image_ID,
+ GimpUnit unit);
+gint gimp_image_get_tattoo_state (gint32 image_ID);
+gboolean gimp_image_set_tattoo_state (gint32 image_ID,
+ gint tattoo_state);
+gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ gint tattoo);
+gint32 gimp_image_get_layer_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_channel_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_vectors_by_name (gint32 image_ID,
+ const gchar *name);
+gboolean gimp_image_attach_parasite (gint32 image_ID,
+ const GimpParasite *parasite);
+gboolean gimp_image_detach_parasite (gint32 image_ID,
+ const gchar *name);
+GimpParasite* gimp_image_get_parasite (gint32 image_ID,
+ const gchar *name);
+gchar** gimp_image_get_parasite_list (gint32 image_ID,
+ gint *num_parasites);
G_END_DECLS
diff --git a/libgimp/gimpimagemetadata.c b/libgimp/gimpimagemetadata.c
index 1526dba..d889811 100644
--- a/libgimp/gimpimagemetadata.c
+++ b/libgimp/gimpimagemetadata.c
@@ -661,7 +661,7 @@ gimp_image_metadata_load_thumbnail (GFile *file,
layer_ID = gimp_layer_new_from_pixbuf (image_ID, _("Background"),
pixbuf,
100.0,
- gimp_get_default_new_layer_mode (),
+ gimp_image_get_default_new_layer_mode (image_ID),
0.0, 0.0);
g_object_unref (pixbuf);
diff --git a/plug-ins/common/animation-optimize.c b/plug-ins/common/animation-optimize.c
index 82faf94..4db616f 100644
--- a/plug-ins/common/animation-optimize.c
+++ b/plug-ins/common/animation-optimize.c
@@ -642,7 +642,7 @@ do_optimizations (GimpRunMode run_mode,
width, height,
drawabletype_alpha,
100.0,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (new_image_id));
gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
@@ -1065,7 +1065,7 @@ do_optimizations (GimpRunMode run_mode,
bbox_bottom-bbox_top,
drawabletype_alpha,
100.0,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (new_image_id));
g_free (newlayer_name);
gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
diff --git a/plug-ins/common/compose.c b/plug-ins/common/compose.c
index de6ebef..46b3e4a 100644
--- a/plug-ins/common/compose.c
+++ b/plug-ins/common/compose.c
@@ -1021,7 +1021,8 @@ create_new_image (const gchar *filename,
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
*buffer = gimp_drawable_get_buffer (*layer_ID);
diff --git a/plug-ins/common/decompose.c b/plug-ins/common/decompose.c
index 4224d30..a6d2623 100644
--- a/plug-ins/common/decompose.c
+++ b/plug-ins/common/decompose.c
@@ -608,7 +608,8 @@ create_new_layer (gint32 image_ID,
layer_ID = gimp_layer_new (image_ID, layername, width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, position);
return layer_ID;
diff --git a/plug-ins/common/edge-dog.c b/plug-ins/common/edge-dog.c
index 04635a2..142ef07 100644
--- a/plug-ins/common/edge-dog.c
+++ b/plug-ins/common/edge-dog.c
@@ -993,7 +993,7 @@ preview_update_preview (GimpPreview *preview,
preview_id = gimp_layer_new (image_id, "preview", width, height,
gimp_drawable_type (drawable->drawable_id),
100,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (image_id));
preview_drawable = gimp_drawable_get (preview_id);
gimp_image_insert_layer (image_id, preview_id, -1, 0);
gimp_layer_set_offsets (preview_id, 0, 0);
diff --git a/plug-ins/common/file-cel.c b/plug-ins/common/file-cel.c
index 7e4bae5..401d3bf 100644
--- a/plug-ins/common/file-cel.c
+++ b/plug-ins/common/file-cel.c
@@ -440,11 +440,13 @@ load_image (const gchar *file,
if (bpp == 32)
layer = gimp_layer_new (image, _("Background"), width, height,
GIMP_RGBA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
else
layer = gimp_layer_new (image, _("Background"), width, height,
GIMP_INDEXEDA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_insert_layer (image, layer, -1, 0);
gimp_layer_set_offsets (layer, offx, offy);
diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c
index 54666e6..64904fc 100644
--- a/plug-ins/common/file-dicom.c
+++ b/plug-ins/common/file-dicom.c
@@ -612,7 +612,8 @@ load_image (const gchar *filename,
dicominfo->width, dicominfo->height,
(dicominfo->samples_per_pixel >= 3 ?
GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index d7cb18f..b8933e7 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -622,7 +622,8 @@ load_image (GFile *file,
layer_ID = gimp_layer_new (image_ID, name, bh.width, bh.height,
image_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
g_free (name);
diff --git a/plug-ins/common/file-gegl.c b/plug-ins/common/file-gegl.c
index 0d0756f..1d8bf2e 100644
--- a/plug-ins/common/file-gegl.c
+++ b/plug-ins/common/file-gegl.c
@@ -414,7 +414,8 @@ load_image (const gchar *filename,
_("Background"),
width, height,
image_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
dest_buf = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c
index f46cbc3..831ec97 100644
--- a/plug-ins/common/file-gif-load.c
+++ b/plug-ins/common/file-gif-load.c
@@ -989,14 +989,16 @@ ReadImage (FILE *fd,
layer_ID = gimp_layer_new (*image_ID, framename,
len, height,
GIMP_INDEXED_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (*image_ID));
}
else
{
layer_ID = gimp_layer_new (*image_ID, framename,
len, height,
GIMP_INDEXEDA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (*image_ID));
alpha_frame=TRUE;
}
@@ -1081,7 +1083,8 @@ ReadImage (FILE *fd,
len, height,
promote_to_rgb ?
GIMP_RGBA_IMAGE : GIMP_INDEXEDA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (*image_ID));
alpha_frame = TRUE;
g_free (framename);
}
diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c
index 5df0d89..cbe990f 100644
--- a/plug-ins/common/file-gih.c
+++ b/plug-ins/common/file-gih.c
@@ -628,7 +628,8 @@ gih_load_one_brush (GInputStream *input,
layer_ID = gimp_layer_new (image_ID, name,
bh.width, bh.height,
image_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
g_free (name);
if (layer_ID != -1)
diff --git a/plug-ins/common/file-jp2-load.c b/plug-ins/common/file-jp2-load.c
index fcc028a..0de1905 100644
--- a/plug-ins/common/file-jp2-load.c
+++ b/plug-ins/common/file-jp2-load.c
@@ -395,7 +395,8 @@ load_image (const gchar *filename,
_("Background"),
width, height,
image_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
index 5f0534a..51622ec 100644
--- a/plug-ins/common/file-pat.c
+++ b/plug-ins/common/file-pat.c
@@ -441,7 +441,8 @@ load_image (GFile *file,
layer_ID = gimp_layer_new (image_ID, name, ph.width, ph.height,
image_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
g_free (name);
diff --git a/plug-ins/common/file-pcx.c b/plug-ins/common/file-pcx.c
index 0f8e618..283ebac 100644
--- a/plug-ins/common/file-pcx.c
+++ b/plug-ins/common/file-pcx.c
@@ -444,14 +444,16 @@ load_image (const gchar *filename,
image= gimp_image_new (width, height, GIMP_RGB);
layer= gimp_layer_new (image, _("Background"), width, height,
GIMP_RGB_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
}
else
{
image= gimp_image_new (width, height, GIMP_INDEXED);
layer= gimp_layer_new (image, _("Background"), width, height,
GIMP_INDEXED_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
}
gimp_image_set_filename (image, filename);
diff --git a/plug-ins/common/file-pix.c b/plug-ins/common/file-pix.c
index aa5910a..4fc376d 100644
--- a/plug-ins/common/file-pix.c
+++ b/plug-ins/common/file-pix.c
@@ -400,7 +400,8 @@ load_image (GFile *file,
layer_ID = gimp_layer_new (image_ID, _("Background"),
width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index d055929..57556aa 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -1064,7 +1064,8 @@ load_image (const gchar *filename,
layer = gimp_layer_new (image, _("Background"), width, height,
layer_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_insert_layer (image, layer, -1, 0);
file_format = gimp_drawable_get_format (layer);
diff --git a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c
index c77af36..fadd035 100644
--- a/plug-ins/common/file-pnm.c
+++ b/plug-ins/common/file-pnm.c
@@ -686,7 +686,8 @@ load_image (GFile *file,
pnminfo->xres, pnminfo->yres,
(pnminfo->np >= 3 ?
GIMP_RGB_IMAGE : GIMP_GRAY_IMAGE),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c
index 51fcd9c..ca634f4 100644
--- a/plug-ins/common/file-ps.c
+++ b/plug-ins/common/file-ps.c
@@ -1915,7 +1915,8 @@ create_new_image (const gchar *filename,
tmp = g_strdup_printf (_("Page %d"), pagenum);
*layer_ID = gimp_layer_new (image_ID, tmp, width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
g_free (tmp);
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index db57628..800c578 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -1160,7 +1160,8 @@ load_image (const gchar *filename,
layer_id = gimp_layer_new (data->image_id, _("Background"),
runtime->image_width, runtime->image_height,
ltype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (data->image_id));
gimp_image_insert_layer (data->image_id, layer_id, -1, 0);
data->buffer = gimp_drawable_get_buffer (layer_id);
diff --git a/plug-ins/common/file-sunras.c b/plug-ins/common/file-sunras.c
index c9d861c..16eda60 100644
--- a/plug-ins/common/file-sunras.c
+++ b/plug-ins/common/file-sunras.c
@@ -1048,7 +1048,8 @@ create_new_image (const gchar *filename,
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
*buffer = gimp_drawable_get_buffer (*layer_ID);
diff --git a/plug-ins/common/file-svg.c b/plug-ins/common/file-svg.c
index 81a80e7..0456f21 100644
--- a/plug-ins/common/file-svg.c
+++ b/plug-ins/common/file-svg.c
@@ -347,7 +347,8 @@ load_image (const gchar *filename,
load_vals.resolution, load_vals.resolution);
layer = gimp_layer_new_from_pixbuf (image, _("Rendered SVG"), pixbuf,
- 100, gimp_get_default_new_layer_mode (),
+ 100,
+ gimp_image_get_default_new_layer_mode (image),
0.0, 1.0);
gimp_image_insert_layer (image, layer, -1, 0);
diff --git a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c
index 635a4b9..ef0babf 100644
--- a/plug-ins/common/file-tga.c
+++ b/plug-ins/common/file-tga.c
@@ -1092,7 +1092,8 @@ ReadImage (FILE *fp,
_("Background"),
info->width, info->height,
dtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
diff --git a/plug-ins/common/file-wmf.c b/plug-ins/common/file-wmf.c
index 828a9a0..072ddc1 100644
--- a/plug-ins/common/file-wmf.c
+++ b/plug-ins/common/file-wmf.c
@@ -998,7 +998,8 @@ load_image (const gchar *filename,
_("Rendered WMF"),
width, height,
GIMP_RGBA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
buffer = gimp_drawable_get_buffer (layer);
diff --git a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c
index 6867432..90584b5 100644
--- a/plug-ins/common/file-xbm.c
+++ b/plug-ins/common/file-xbm.c
@@ -905,7 +905,7 @@ load_image (const gchar *filename,
width, height,
GIMP_INDEXED_IMAGE,
100,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c
index b682aac..cae84be 100644
--- a/plug-ins/common/file-xmc.c
+++ b/plug-ins/common/file-xmc.c
@@ -728,7 +728,8 @@ load_image (const gchar *filename,
layer_ID = gimp_layer_new (image_ID, framename, width, height,
GIMP_RGBA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
/* Adjust layer position to let hotspot sit on the same point. */
@@ -952,7 +953,8 @@ load_thumbnail (const gchar *filename,
layer_ID = gimp_layer_new (image_ID, NULL, width, height,
GIMP_RGBA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
diff --git a/plug-ins/common/file-xpm.c b/plug-ins/common/file-xpm.c
index b9f896d..5d85ab2 100644
--- a/plug-ins/common/file-xpm.c
+++ b/plug-ins/common/file-xpm.c
@@ -482,7 +482,7 @@ parse_image (gint32 image_ID,
xpm_image->height,
GIMP_RGBA_IMAGE,
100,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c
index 1bf1f28..81fb765 100644
--- a/plug-ins/common/file-xwd.c
+++ b/plug-ins/common/file-xwd.c
@@ -1272,7 +1272,8 @@ create_new_image (const gchar *filename,
*layer_ID = gimp_layer_new (image_ID, "Background", width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
*buffer = gimp_drawable_get_buffer (*layer_ID);
diff --git a/plug-ins/common/film.c b/plug-ins/common/film.c
index 9fcb57a..352b53f 100644
--- a/plug-ins/common/film.c
+++ b/plug-ins/common/film.c
@@ -744,7 +744,8 @@ create_new_image (const gchar *filename,
gimp_image_undo_disable (image_ID);
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
gdtype,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
if (drawable)
diff --git a/plug-ins/common/hot.c b/plug-ins/common/hot.c
index 3c92e6b..f6dbf9c 100644
--- a/plug-ins/common/hot.c
+++ b/plug-ins/common/hot.c
@@ -350,7 +350,8 @@ pluginCore (piArgs *argp)
nl = gimp_layer_new (argp->image, name, width, height,
GIMP_RGBA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (argp->image));
ndrw = gimp_drawable_get (nl);
gimp_drawable_fill (nl, GIMP_FILL_TRANSPARENT);
gimp_image_insert_layer (argp->image, nl, -1, 0);
diff --git a/plug-ins/common/smooth-palette.c b/plug-ins/common/smooth-palette.c
index b4c48ae..6a42904 100644
--- a/plug-ins/common/smooth-palette.c
+++ b/plug-ins/common/smooth-palette.c
@@ -258,7 +258,8 @@ smooth_palette (gint32 drawable_id,
*layer_id = gimp_layer_new (new_image_id, _("Background"),
config.width, config.height,
gimp_drawable_type (drawable_id),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (new_image_id));
gimp_image_insert_layer (new_image_id, *layer_id, -1, 0);
diff --git a/plug-ins/common/tile.c b/plug-ins/common/tile.c
index 8a8f8d3..177da16 100644
--- a/plug-ins/common/tile.c
+++ b/plug-ins/common/tile.c
@@ -354,7 +354,8 @@ tile (gint32 image_id,
*new_layer_id = gimp_layer_new (*new_image_id, _("Background"),
dst_width, dst_height,
gimp_drawable_type (drawable_id),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (*new_image_id));
if (*new_layer_id == -1)
return;
diff --git a/plug-ins/common/warp.c b/plug-ins/common/warp.c
index 36b4034..53788d3 100644
--- a/plug-ins/common/warp.c
+++ b/plug-ins/common/warp.c
@@ -941,12 +941,14 @@ diff (GimpDrawable *drawable,
xlayer_id = gimp_layer_new (new_image_id, "Warp_X_Vectors",
width, height,
GIMP_RGB_IMAGE,
- 100.0, gimp_get_default_new_layer_mode ());
+ 100.0,
+ gimp_image_get_default_new_layer_mode (new_image_id));
ylayer_id = gimp_layer_new (new_image_id, "Warp_Y_Vectors",
width, height,
GIMP_RGB_IMAGE,
- 100.0, gimp_get_default_new_layer_mode ());
+ 100.0,
+ gimp_image_get_default_new_layer_mode (new_image_id));
draw_yd = gimp_drawable_get (ylayer_id);
draw_xd = gimp_drawable_get (xlayer_id);
diff --git a/plug-ins/common/web-page.c b/plug-ins/common/web-page.c
index 6f75739..410a639 100644
--- a/plug-ins/common/web-page.c
+++ b/plug-ins/common/web-page.c
@@ -535,7 +535,8 @@ webpage_capture (void)
gimp_image_undo_disable (image);
layer = gimp_layer_new_from_pixbuf (image, _("Webpage"),
webpagevals.pixbuf,
- 100, gimp_get_default_new_layer_mode (),
+ 100,
+ gimp_image_get_default_new_layer_mode (image),
0.0, 1.0);
gimp_image_insert_layer (image, layer, -1, 0);
gimp_image_undo_enable (image);
diff --git a/plug-ins/file-bmp/bmp-load.c b/plug-ins/file-bmp/bmp-load.c
index 80d621c..63d0f00 100644
--- a/plug-ins/file-bmp/bmp-load.c
+++ b/plug-ins/file-bmp/bmp-load.c
@@ -733,7 +733,8 @@ ReadImage (FILE *fd,
image = gimp_image_new (width, height, base_type);
layer = gimp_layer_new (image, _("Background"),
width, height,
- image_type, 100, gimp_get_default_new_layer_mode ());
+ image_type, 100,
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_set_filename (image, filename);
diff --git a/plug-ins/file-exr/file-exr.c b/plug-ins/file-exr/file-exr.c
index c2be5da..fa9480c 100644
--- a/plug-ins/file-exr/file-exr.c
+++ b/plug-ins/file-exr/file-exr.c
@@ -256,7 +256,8 @@ load_image (const gchar *filename,
gimp_image_set_filename (image, filename);
layer = gimp_layer_new (image, _("Background"), width, height,
- layer_type, 100, gimp_get_default_new_layer_mode ());
+ layer_type, 100,
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_insert_layer (image, layer, -1, 0);
buffer = gimp_drawable_get_buffer (layer);
diff --git a/plug-ins/file-faxg3/faxg3.c b/plug-ins/file-faxg3/faxg3.c
index 82468c1..50a6ec1 100644
--- a/plug-ins/file-faxg3/faxg3.c
+++ b/plug-ins/file-faxg3/faxg3.c
@@ -526,7 +526,8 @@ emitgimp (gint hcol,
hcol,
row,
GIMP_GRAY_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, 0);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/file-fits/fits.c b/plug-ins/file-fits/fits.c
index 84dbffb..02ccaf3 100644
--- a/plug-ins/file-fits/fits.c
+++ b/plug-ins/file-fits/fits.c
@@ -527,7 +527,8 @@ create_new_image (const gchar *filename,
gimp_image_undo_disable (image_ID);
*layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
- dtype, 100, gimp_get_default_new_layer_mode ());
+ dtype, 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, *layer_ID, -1, 0);
*buffer = gimp_drawable_get_buffer (*layer_ID);
diff --git a/plug-ins/file-fli/fli-gimp.c b/plug-ins/file-fli/fli-gimp.c
index 5d24eb7..56fdd2b 100644
--- a/plug-ins/file-fli/fli-gimp.c
+++ b/plug-ins/file-fli/fli-gimp.c
@@ -565,7 +565,8 @@ load_image (const gchar *filename,
layer_ID = gimp_layer_new (image_id, name_buf,
fli_header.width, fli_header.height,
GIMP_INDEXED_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_id));
g_free (name_buf);
buffer = gimp_drawable_get_buffer (layer_ID);
diff --git a/plug-ins/file-ico/ico-dialog.c b/plug-ins/file-ico/ico-dialog.c
index 3d2c1e9..8038d0f 100644
--- a/plug-ins/file-ico/ico-dialog.c
+++ b/plug-ins/file-ico/ico-dialog.c
@@ -288,7 +288,8 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
tmp_layer = gimp_layer_new (tmp_image, "temporary", w, h,
gimp_drawable_type (layer),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (tmp_image));
gimp_image_insert_layer (tmp_image, tmp_layer, -1, 0);
buffer = gimp_drawable_get_buffer (layer);
@@ -388,7 +389,8 @@ ico_dialog_update_icon_preview (GtkWidget *dialog,
tmp_layer = gimp_layer_new (tmp_image, "temporary", w, h,
gimp_drawable_type (layer),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (tmp_image));
gimp_image_insert_layer (tmp_image, tmp_layer, -1, 0);
buffer = gimp_drawable_get_buffer (layer);
diff --git a/plug-ins/file-ico/ico-load.c b/plug-ins/file-ico/ico-load.c
index 70b8b4b..f3410df 100644
--- a/plug-ins/file-ico/ico-load.c
+++ b/plug-ins/file-ico/ico-load.c
@@ -634,7 +634,8 @@ ico_load_layer (FILE *fp,
g_snprintf (name, sizeof (name), _("Icon #%i"), icon_num+1);
layer = gimp_layer_new (image, name, width, height,
GIMP_RGBA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_insert_layer (image, layer, -1, icon_num);
buffer = gimp_drawable_get_buffer (layer);
diff --git a/plug-ins/file-ico/ico-save.c b/plug-ins/file-ico/ico-save.c
index 9e0f243..d599788 100644
--- a/plug-ins/file-ico/ico-save.c
+++ b/plug-ins/file-ico/ico-save.c
@@ -628,7 +628,8 @@ ico_image_get_reduced_buf (guint32 layer,
tmp_layer = gimp_layer_new (tmp_image, "tmp", w, h,
gimp_drawable_type (layer),
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (tmp_image));
gimp_image_insert_layer (tmp_image, tmp_layer, -1, 0);
tmp = gimp_drawable_get_buffer (tmp_layer);
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index b8e5a40..527b960 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -232,7 +232,8 @@ load_image (const gchar *filename,
cinfo.output_width,
cinfo.output_height,
layer_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (preview_image_ID));
layer_ID = preview_layer_ID;
}
else
@@ -241,7 +242,8 @@ load_image (const gchar *filename,
cinfo.output_width,
cinfo.output_height,
layer_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_ID));
}
if (! preview)
diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c
index afc9460..b59c700 100644
--- a/plug-ins/file-psd/psd-image-res-load.c
+++ b/plug-ins/file-psd/psd-image-res-load.c
@@ -1034,7 +1034,8 @@ load_resource_1033 (const PSDimageres *res_a,
cinfo.output_width,
cinfo.output_height,
GIMP_RGB_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_id));
buffer = gimp_drawable_get_buffer (layer_id);
format = babl_format ("R'G'B' u8");
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 0c4af56..9cb8eea 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1431,7 +1431,8 @@ add_layers (gint32 image_id,
layer_id = gimp_layer_new (image_id, lyr_a[lidx]->name,
img_a->columns, img_a->rows,
image_type,
- 0, gimp_get_default_new_layer_mode ());
+ 0,
+ gimp_image_get_default_new_layer_mode (image_id));
g_free (lyr_a[lidx]->name);
gimp_image_insert_layer (image_id, layer_id, parent_group_id, 0);
gimp_drawable_fill (layer_id, GIMP_FILL_TRANSPARENT);
@@ -1784,7 +1785,8 @@ add_merged_image (gint32 image_id,
layer_id = gimp_layer_new (image_id, _("Background"),
img_a->columns, img_a->rows,
image_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_id));
gimp_image_insert_layer (image_id, layer_id, -1, 0);
buffer = gimp_drawable_get_buffer (layer_id);
gegl_buffer_set (buffer,
diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c
index b9078f6..69377a1 100644
--- a/plug-ins/file-sgi/sgi.c
+++ b/plug-ins/file-sgi/sgi.c
@@ -410,7 +410,8 @@ load_image (const gchar *filename,
layer = gimp_layer_new (image, _("Background"), sgip->xsize, sgip->ysize,
layer_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
gimp_image_insert_layer (image, layer, -1, 0);
/*
diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c
index 310c26f..ff844d0 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -913,7 +913,8 @@ load_image (GFile *file,
layer = gimp_layer_new (image, name,
cols, rows,
layer_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
}
else
{
@@ -927,7 +928,8 @@ load_image (GFile *file,
layer = gimp_layer_new (image, name,
cols, rows,
layer_type,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image));
g_free (name);
}
diff --git a/plug-ins/file-webp/file-webp-load.c b/plug-ins/file-webp/file-webp-load.c
index d39ee1d..fcfdc79 100644
--- a/plug-ins/file-webp/file-webp-load.c
+++ b/plug-ins/file-webp/file-webp-load.c
@@ -55,7 +55,7 @@ create_layer (gint32 image_ID,
width, height,
GIMP_RGBA_IMAGE,
100,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (image_ID));
gimp_image_insert_layer (image_ID, layer_ID, -1, position);
diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c
index 7b50593..73b14cb 100644
--- a/plug-ins/gfig/gfig-dialog.c
+++ b/plug-ins/gfig/gfig-dialog.c
@@ -248,7 +248,8 @@ gfig_dialog (void)
newlayer = gimp_layer_new (gfig_context->image_id, "GFig",
img_width, img_height,
img_type,
- 100.0, gimp_get_default_new_layer_mode ());
+ 100.0,
+ gimp_image_get_default_new_layer_mode (gfig_context->image_id));
gimp_drawable_fill (newlayer, GIMP_FILL_TRANSPARENT);
gimp_image_insert_layer (gfig_context->image_id, newlayer, -1, -1);
gfig_context->drawable_id = newlayer;
diff --git a/plug-ins/lighting/lighting-apply.c b/plug-ins/lighting/lighting-apply.c
index 1c69e36..26e47e7 100644
--- a/plug-ins/lighting/lighting-apply.c
+++ b/plug-ins/lighting/lighting-apply.c
@@ -55,7 +55,7 @@ compute_image (void)
width, height,
GIMP_RGBA_IMAGE,
100.0,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (new_image_id));
}
else
{
@@ -66,7 +66,7 @@ compute_image (void)
width, height,
GIMP_RGB_IMAGE,
100.0,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (new_image_id));
}
gimp_image_insert_layer (new_image_id, new_layer_id, -1, 0);
diff --git a/plug-ins/map-object/map-object-apply.c b/plug-ins/map-object/map-object-apply.c
index 2ea2593..c13616c 100644
--- a/plug-ins/map-object/map-object-apply.c
+++ b/plug-ins/map-object/map-object-apply.c
@@ -259,7 +259,7 @@ compute_image (void)
GIMP_RGBA_IMAGE :
GIMP_RGB_IMAGE,
100.0,
- gimp_get_default_new_layer_mode ());
+ gimp_image_get_default_new_layer_mode (new_image_id));
insert_layer = TRUE;
output_drawable = gimp_drawable_get (new_layer_id);
diff --git a/plug-ins/pagecurl/pagecurl.c b/plug-ins/pagecurl/pagecurl.c
index c034037..d1c3cd2 100644
--- a/plug-ins/pagecurl/pagecurl.c
+++ b/plug-ins/pagecurl/pagecurl.c
@@ -721,7 +721,8 @@ do_curl_effect (gint32 drawable_id)
true_sel_height,
color_image ?
GIMP_RGBA_IMAGE : GIMP_GRAYA_IMAGE,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (image_id));
gimp_image_insert_layer (image_id, curl_layer_id,
gimp_item_get_parent (drawable_id),
diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c
index 0a30d85..48333b7 100644
--- a/plug-ins/pygimp/pygimp-drawable.c
+++ b/plug-ins/pygimp/pygimp-drawable.c
@@ -1913,7 +1913,7 @@ lay_init(PyGimpLayer *self, PyObject *args, PyObject *kwargs)
unsigned int width, height;
GimpImageType type = GIMP_RGB_IMAGE;
double opacity = 100.0;
- GimpLayerMode mode = gimp_get_default_new_layer_mode ();
+ GimpLayerMode mode = GIMP_LAYER_MODE_NORMAL;
if (!PyArg_ParseTuple(args, "O!sii|idi:gimp.Layer.__init__",
@@ -2071,7 +2071,7 @@ grouplay_init(PyGimpLayer *self, PyObject *args, PyObject *kwargs)
char *name = "Layer Group";
GimpImageType type = GIMP_RGB_IMAGE;
double opacity = 100.0;
- GimpLayerMode mode = gimp_get_default_new_layer_mode ();
+ GimpLayerMode mode = GIMP_LAYER_MODE_NORMAL;
if (!PyArg_ParseTuple(args, "O!|sdi:gimp.Layer.__init__",
diff --git a/plug-ins/pygimp/pygimp-image.c b/plug-ins/pygimp/pygimp-image.c
index e90264a..69098ca 100644
--- a/plug-ins/pygimp/pygimp-image.c
+++ b/plug-ins/pygimp/pygimp-image.c
@@ -131,7 +131,7 @@ img_new_layer(PyGimpImage *self, PyObject *args, PyObject *kwargs)
gboolean alpha = TRUE;
int pos = -1;
double opacity = 100.0;
- GimpLayerMode mode = gimp_get_default_new_layer_mode ();
+ GimpLayerMode mode = GIMP_LAYER_MODE_NORMAL;
GimpFillType fill_mode = -1;
static char *kwlist[] = { "name", "width", "height", "offset_x", "offset_y",
diff --git a/plug-ins/screenshot/screenshot-win32.c b/plug-ins/screenshot/screenshot-win32.c
index 646a894..98cc348 100644
--- a/plug-ins/screenshot/screenshot-win32.c
+++ b/plug-ins/screenshot/screenshot-win32.c
@@ -257,7 +257,8 @@ sendBMPToGimp(HBITMAP hBMP, HDC hDC, RECT rect)
layer_id = gimp_layer_new (new_image_id, _("Background"),
ROUND4 (width), height,
layerType,
- 100, gimp_get_default_new_layer_mode ());
+ 100,
+ gimp_image_get_default_new_layer_mode (new_image_id));
gimp_image_insert_layer (new_image_id, layer_id, -1, 0);
/* make rectangle */
diff --git a/plug-ins/screenshot/screenshot-x11.c b/plug-ins/screenshot/screenshot-x11.c
index 22131b6..aa49db3 100644
--- a/plug-ins/screenshot/screenshot-x11.c
+++ b/plug-ins/screenshot/screenshot-x11.c
@@ -465,7 +465,8 @@ add_cursor_image (gint32 image,
layer = gimp_layer_new (image, _("Mouse Pointer"),
cursor->width, cursor->height,
GIMP_RGBA_IMAGE,
- 100.0, gimp_get_default_new_layer_mode ());
+ 100.0,
+ gimp_image_get_default_new_layer_mode (image));
buffer = gimp_drawable_get_buffer (layer);
diff --git a/tools/pdbgen/pdb/gimprc.pdb b/tools/pdbgen/pdb/gimprc.pdb
index 1ea3293..70e339a 100644
--- a/tools/pdbgen/pdb/gimprc.pdb
+++ b/tools/pdbgen/pdb/gimprc.pdb
@@ -170,27 +170,6 @@ CODE
);
}
-sub get_default_new_layer_mode {
- $blurb = 'Get the default mode for newly created layers.';
- $help = 'Returns the default mode for newly created layers.';
-
- &mitch_pdb_misc('2017', '2.10');
-
- @outargs = (
- { name => 'mode', type => 'enum GimpLayerMode',
- default => 'GIMP_LAYER_MODE_NORMAL',
- desc => 'The layer mode' }
- );
-
- %invoke = (
- code => <<'CODE'
-{
- mode = gimp->config->default_new_layer_mode;
-}
-CODE
- );
-}
-
sub get_theme_dir {
$blurb = 'Get the directory of the current GUI theme.';
$help = 'Returns a copy of the current GUI theme dir.';
@@ -290,7 +269,6 @@ CODE
get_default_comment
get_default_unit
get_monitor_resolution
- get_default_new_layer_mode
get_theme_dir
get_icon_theme_dir
get_color_configuration
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index 5f5617c..8397f82 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -1317,6 +1317,32 @@ CODE
);
}
+sub image_get_default_new_layer_mode {
+ $blurb = 'Get the default mode for newly created layers of this image.';
+ $help = 'Returns the default mode for newly created layers of this image.';
+
+ &mitch_pdb_misc('2017', '2.10');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' }
+ );
+
+ @outargs = (
+ { name => 'mode', type => 'enum GimpLayerMode',
+ default => 'GIMP_LAYER_MODE_NORMAL',
+ desc => 'The layer mode' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ mode = gimp_image_get_default_new_layer_mode (image);
+}
+CODE
+ );
+}
+
sub image_get_colormap {
$blurb = "Returns the image's colormap";
@@ -2839,6 +2865,7 @@ CODE
image_duplicate image_delete
image_base_type
image_get_precision
+ image_get_default_new_layer_mode
image_width image_height
image_free_shadow
image_get_layers
@@ -2892,7 +2919,7 @@ CODE
# image_add_layer_mask and image_remove_layer_mask.
# If adding or removing functions, make sure the range below is
# updated correctly!
-%exports = (app => [@procs], lib => [@procs[0..37,40..80]]);
+%exports = (app => [@procs], lib => [@procs[0..38,41..81]]);
$desc = 'Image';
$doc_title = 'gimpimage';
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index 5c813a9..915c20e 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -156,7 +156,7 @@ HELP
TRUE),
name,
GIMP_OPACITY_OPAQUE,
- gimp->config->default_new_layer_mode,
+ gimp_image_get_default_new_layer_mode (dest_image),
profile);
}
CODE
@@ -1357,7 +1357,6 @@ CODE
@headers = qw(<cairo.h>
"libgimpbase/gimpbase.h"
"libgimpcolor/gimpcolor.h"
- "config/gimpcoreconfig.h"
"core/gimp.h"
"core/gimpimage-color-profile.h"
"core/gimpimage-undo.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]