Commit e16c8a23 authored by Michael Natterer's avatar Michael Natterer 😴

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().
parent 497fb9b0
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 " \
......
......@@ -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)
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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) */
......
......@@ -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)
......
......@@ -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);
......
......@@ -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));
......
......@@ -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 */
......
......@@ -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)
{
......
......@@ -173,25 +173,6 @@ get_monitor_resolution_invoker (GimpProcedure *procedure,
return return_vals;
}
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,
......@@ -419,30 +400,6 @@ register_gimprc_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
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
*/
......
......@@ -334,6 +334,35 @@ image_get_precision_invoker (GimpProcedure *procedure,
return return_vals;
}
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,
......@@ -2998,6 +3027,36 @@ register_image_procs (GimpPDB *pdb)
gimp_pdb_register_procedure (pdb, procedure);
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
*/
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -208,36 +208,6 @@ gimp_get_monitor_resolution (gdouble *xres,
return success;
}
/**
* 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:
*
......
......@@ -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
......
......@@ -326,6 +326,38 @@ gimp_image_get_precision (gint32 image_ID)
return precision;
}
/**
* 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.
......
This diff is collapsed.
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -608,7 +608,8 @@ create_new_layer (gint32 image_ID,
layer_ID = gimp_layer_new (image_ID, layername, width, height,
gdtype,