Commit 765c2cfe authored by Michael Natterer's avatar Michael Natterer 😴

app: replace GimpDraable's type by a Babl format

and change gimp_drawable_new() and all gimp_layer_new() variants to
take formats instead of types.
parent cab21271
......@@ -357,11 +357,12 @@ debug_show_image_graph (GimpImage *source_image)
FALSE);
gimp_image_set_uri (new_image, new_name);
layer = gimp_layer_new_from_buffer (buffer,
new_image,
GIMP_RGBA_IMAGE,
new_name,
1.0,
GIMP_NORMAL_MODE);
new_image,
gimp_image_get_format (new_image,
GIMP_RGBA_IMAGE),
new_name,
1.0,
GIMP_NORMAL_MODE);
gimp_image_add_layer (new_image, layer, NULL, 0, FALSE);
gimp_create_display (gimp, new_image, GIMP_UNIT_PIXEL, 1.0);
......
......@@ -340,11 +340,12 @@ edit_paste_as_new_layer_cmd_callback (GtkAction *action,
if (buffer)
{
GimpLayer *layer;
GimpLayer *layer;
GimpImageType type = gimp_image_base_type_with_alpha (image);
layer = gimp_layer_new_from_buffer (gimp_buffer_get_buffer (buffer),
image,
gimp_image_base_type_with_alpha (image),
gimp_image_get_format (image, type),
_("Clipboard"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
g_object_unref (buffer);
......
......@@ -272,6 +272,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
GimpLayer *new_layer;
gint width, height;
gint off_x, off_y;
GimpImageType type;
gdouble opacity;
GimpLayerModeEffects mode;
return_if_no_image (image, data);
......@@ -319,8 +320,10 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
_("New Layer"));
type = gimp_image_base_type_with_alpha (image);
new_layer = gimp_layer_new (image, width, height,
gimp_image_base_type_with_alpha (image),
gimp_image_get_format (image, type),
layer_name,
opacity, mode);
......@@ -341,18 +344,21 @@ void
layers_new_from_visible_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GimpPickable *pickable;
GimpImage *image;
GimpLayer *layer;
GimpPickable *pickable;
GimpImageType type;
return_if_no_image (image, data);
pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
gimp_pickable_flush (pickable);
type = gimp_image_base_type_with_alpha (image);
layer = gimp_layer_new_from_buffer (gimp_pickable_get_buffer (pickable),
image,
gimp_image_base_type_with_alpha (image),
gimp_image_get_format (image, type),
_("Visible"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......@@ -973,7 +979,8 @@ layers_new_layer_response (GtkWidget *widget,
{
if (response_id == GTK_RESPONSE_OK)
{
GimpLayer *layer;
GimpLayer *layer;
GimpImageType type;
if (layer_name)
g_free (layer_name);
......@@ -990,10 +997,12 @@ layers_new_layer_response (GtkWidget *widget,
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (dialog->size_se),
1));
type = gimp_image_base_type_with_alpha (dialog->image);
layer = gimp_layer_new (dialog->image,
dialog->xsize,
dialog->ysize,
gimp_image_base_type_with_alpha (dialog->image),
gimp_image_get_format (dialog->image, type),
layer_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -181,7 +181,8 @@ gimp_edit_paste (GimpImage *image,
type = gimp_image_base_type_with_alpha (image);
layer = gimp_layer_new_from_buffer (gimp_buffer_get_buffer (paste),
image, type,
image,
gimp_image_get_format (image, type),
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -1608,10 +1608,12 @@ gimp_channel_new (GimpImage *image,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
channel = GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_CHANNEL,
image, name,
0, 0, width, height,
GIMP_GRAY_IMAGE));
channel =
GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_CHANNEL,
image, name,
0, 0, width, height,
gimp_image_get_format (image,
GIMP_GRAY_IMAGE)));
if (color)
channel->color = *color;
......
......@@ -20,7 +20,7 @@
struct _GimpDrawablePrivate
{
GimpImageType type; /* type of drawable */
const Babl *format; /* format of drawable */
TileManager *tiles; /* tiles for drawable data */
TileManager *shadow; /* shadow buffer tiles */
......
......@@ -1018,7 +1018,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
{
layer =
gimp_layer_new_from_buffer (buffer, image,
gimp_drawable_type_with_alpha (drawable),
gimp_drawable_get_format_with_alpha (drawable),
_("Transformation"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -260,8 +260,6 @@ gimp_drawable_init (GimpDrawable *drawable)
drawable->private = G_TYPE_INSTANCE_GET_PRIVATE (drawable,
GIMP_TYPE_DRAWABLE,
GimpDrawablePrivate);
drawable->private->type = -1;
}
/* sorry for the evil casts */
......@@ -429,9 +427,9 @@ gimp_drawable_duplicate (GimpItem *item,
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GimpDrawable *new_drawable = GIMP_DRAWABLE (new_item);
GimpImageType image_type = gimp_drawable_type (drawable);
const Babl *format = gimp_drawable_get_format (drawable);
new_drawable->private->type = image_type;
new_drawable->private->format = format;
if (new_drawable->private->tiles)
tile_manager_unref (new_drawable->private->tiles);
......@@ -823,8 +821,9 @@ gimp_drawable_real_set_tiles (GimpDrawable *drawable,
if (drawable->private->tiles)
tile_manager_unref (drawable->private->tiles);
drawable->private->tiles = tiles;
drawable->private->type = type;
drawable->private->tiles = tiles;
drawable->private->format = gimp_image_get_format (gimp_item_get_image (item),
type);
if (drawable->private->buffer)
{
......@@ -1188,22 +1187,23 @@ gimp_drawable_new (GType type,
gint offset_y,
gint width,
gint height,
GimpImageType image_type)
const Babl *format)
{
GimpDrawable *drawable;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (g_type_is_a (type, GIMP_TYPE_DRAWABLE), NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
g_return_val_if_fail (format != NULL, NULL);
drawable = GIMP_DRAWABLE (gimp_item_new (type,
image, name,
offset_x, offset_y,
width, height));
drawable->private->type = image_type;
drawable->private->tiles = tile_manager_new (width, height,
gimp_drawable_bytes (drawable));
drawable->private->format = format;
drawable->private->tiles = tile_manager_new (width, height,
gimp_drawable_bytes (drawable));
return drawable;
}
......@@ -1813,8 +1813,7 @@ gimp_drawable_get_format (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
return gimp_image_get_format (gimp_item_get_image (GIMP_ITEM (drawable)),
gimp_drawable_type (drawable));
return drawable->private->format;
}
const Babl *
......@@ -1840,15 +1839,37 @@ gimp_drawable_has_alpha (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_drawable_type (drawable));
return babl_format_has_alpha (drawable->private->format);
}
GimpImageType
gimp_drawable_type (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
return drawable->private->type;
format = drawable->private->format;
if (format == babl_format ("Y u8"))
return GIMP_GRAY_IMAGE;
else if (format == babl_format ("YA u8"))
return GIMP_GRAYA_IMAGE;
else if (format == babl_format ("RGB u8"))
return GIMP_RGB_IMAGE;
else if (format == babl_format ("RGBA u8"))
return GIMP_RGBA_IMAGE;
else
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
if (format == gimp_image_get_format (image, GIMP_INDEXED_IMAGE))
return GIMP_INDEXED_IMAGE;
if (format == gimp_image_get_format (image, GIMP_INDEXEDA_IMAGE))
return GIMP_INDEXEDA_IMAGE;
}
g_return_val_if_reached (-1);
}
GimpImageType
......@@ -1896,31 +1917,33 @@ gimp_drawable_bytes (const GimpDrawable *drawable)
{
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
return GIMP_IMAGE_TYPE_BYTES (drawable->private->type);
return babl_format_get_bytes_per_pixel (drawable->private->format);
}
gint
gimp_drawable_bytes_with_alpha (const GimpDrawable *drawable)
{
GimpImageType type;
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
type = GIMP_IMAGE_TYPE_WITH_ALPHA (gimp_drawable_type (drawable));
format = gimp_image_get_format_with_alpha (gimp_item_get_image (GIMP_ITEM (drawable)),
gimp_drawable_type (drawable));
return GIMP_IMAGE_TYPE_BYTES (type);
return babl_format_get_bytes_per_pixel (format);
}
gint
gimp_drawable_bytes_without_alpha (const GimpDrawable *drawable)
{
GimpImageType type;
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
type = GIMP_IMAGE_TYPE_WITHOUT_ALPHA (gimp_drawable_type (drawable));
format = gimp_image_get_format_without_alpha (gimp_item_get_image (GIMP_ITEM (drawable)),
gimp_drawable_type (drawable));
return GIMP_IMAGE_TYPE_BYTES (type);
return babl_format_get_bytes_per_pixel (format);
}
const guchar *
......
......@@ -123,7 +123,7 @@ GimpDrawable * gimp_drawable_new (GType type,
gint offset_y,
gint width,
gint height,
GimpImageType image_type);
const Babl *format);
gint64 gimp_drawable_estimate_memsize (const GimpDrawable *drawable,
gint width,
......
......@@ -846,10 +846,11 @@ gimp_group_layer_convert_type (GimpDrawable *drawable,
new_type = GIMP_IMAGE_TYPE_WITH_ALPHA (new_type);
/* FIXME: find a better way to do this: need to set the drawable's
* type to the new values so the projection will create its tiles
* format to the new values so the projection will create its tiles
* with the right depth
*/
drawable->private->type = new_type;
drawable->private->format = gimp_image_get_format (gimp_item_get_image (GIMP_ITEM (drawable)),
new_type);
gimp_projectable_structure_changed (GIMP_PROJECTABLE (drawable));
......@@ -935,7 +936,8 @@ gimp_group_layer_new (GimpImage *image)
group = GIMP_GROUP_LAYER (gimp_drawable_new (GIMP_TYPE_GROUP_LAYER,
image, NULL,
0, 0, 1, 1,
type));
gimp_image_get_format (image,
type)));
if (gimp_image_get_projection (image)->use_gegl)
GET_PRIVATE (group)->projection->use_gegl = TRUE;
......
......@@ -527,7 +527,7 @@ gimp_image_merge_layers (GimpImage *image,
type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (image));
merge_layer = gimp_layer_new (image, (x2 - x1), (y2 - y1),
type,
gimp_image_get_format (image, type),
gimp_object_get_name (layer),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (! merge_layer)
......@@ -557,7 +557,7 @@ gimp_image_merge_layers (GimpImage *image,
merge_layer =
gimp_layer_new (image, (x2 - x1), (y2 - y1),
gimp_drawable_type_with_alpha (GIMP_DRAWABLE (layer)),
gimp_drawable_get_format_with_alpha (GIMP_DRAWABLE (layer)),
"merged layer",
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -136,7 +136,8 @@ gimp_image_new_from_template (Gimp *gimp,
break;
}
layer = gimp_layer_new (image, width, height, type,
layer = gimp_layer_new (image, width, height,
gimp_image_get_format (image, type),
_("Background"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......@@ -297,7 +298,8 @@ gimp_image_new_from_buffer (Gimp *gimp,
}
layer = gimp_layer_new_from_buffer (gimp_buffer_get_buffer (paste),
image, type,
image,
gimp_image_get_format (image, type),
_("Pasted Layer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......@@ -341,7 +343,9 @@ gimp_image_new_from_pixbuf (Gimp *gimp,
gimp_image_undo_disable (new_image);
layer = gimp_layer_new_from_pixbuf (pixbuf, new_image, image_type,
layer = gimp_layer_new_from_pixbuf (pixbuf, new_image,
gimp_image_get_format (new_image,
image_type),
layer_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -1080,7 +1080,7 @@ GimpLayer *
gimp_layer_new (GimpImage *image,
gint width,
gint height,
GimpImageType type,
const Babl *format,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode)
......@@ -1090,11 +1090,12 @@ gimp_layer_new (GimpImage *image,
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
g_return_val_if_fail (format != NULL, NULL);
layer = GIMP_LAYER (gimp_drawable_new (GIMP_TYPE_LAYER,
image, name,
0, 0, width, height,
type));
format));
opacity = CLAMP (opacity, GIMP_OPACITY_TRANSPARENT, GIMP_OPACITY_OPAQUE);
......@@ -1122,7 +1123,7 @@ gimp_layer_new (GimpImage *image,
GimpLayer *
gimp_layer_new_from_buffer (GeglBuffer *buffer,
GimpImage *dest_image,
GimpImageType type,
const Babl *format,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode)
......@@ -1132,12 +1133,16 @@ gimp_layer_new_from_buffer (GeglBuffer *buffer,
g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
g_return_val_if_fail (format != NULL, NULL);
/* do *not* use the buffer's format because this function gets
* buffers of any format passed, and converts them
*/
layer = gimp_layer_new (dest_image,
gegl_buffer_get_width (buffer),
gegl_buffer_get_height (buffer),
type, name,
opacity, mode);
format,
name, opacity, mode);
dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
gegl_buffer_copy (buffer, NULL, dest, NULL);
......@@ -1163,7 +1168,7 @@ gimp_layer_new_from_buffer (GeglBuffer *buffer,
GimpLayer *
gimp_layer_new_from_pixbuf (GdkPixbuf *pixbuf,
GimpImage *dest_image,
GimpImageType type,
const Babl *format,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode)
......@@ -1173,12 +1178,11 @@ gimp_layer_new_from_pixbuf (GdkPixbuf *pixbuf,
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
g_return_val_if_fail (GIMP_IMAGE_TYPE_BASE_TYPE (type) ==
gimp_image_base_type (dest_image), NULL);
g_return_val_if_fail (format != NULL, NULL);
buffer = gimp_pixbuf_create_buffer (pixbuf);
layer = gimp_layer_new_from_buffer (buffer, dest_image, type,
layer = gimp_layer_new_from_buffer (buffer, dest_image, format,
name, opacity, mode);
g_object_unref (buffer);
......
......@@ -78,20 +78,20 @@ GType gimp_layer_get_type (void) G_GNUC_CONST;
GimpLayer * gimp_layer_new (GimpImage *image,
gint width,
gint height,
GimpImageType type,
const Babl *format,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode);
GimpLayer * gimp_layer_new_from_buffer (GeglBuffer *buffer,
GimpImage *dest_image,
GimpImageType type,
const Babl *format,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode);
GimpLayer * gimp_layer_new_from_pixbuf (GdkPixbuf *pixbuf,
GimpImage *dest_image,
GimpImageType type,
const Babl *format,
const gchar *name,
gdouble opacity,
GimpLayerModeEffects mode);
......
......@@ -148,7 +148,8 @@ gimp_layer_mask_new (GimpImage *image,
layer_mask = GIMP_LAYER_MASK (gimp_drawable_new (GIMP_TYPE_LAYER_MASK,
image, name,
0, 0, width, height,
GIMP_GRAY_IMAGE));
gimp_image_get_format (image,
GIMP_GRAY_IMAGE)));
/* set the layer_mask color and opacity */
gimp_channel_set_color (GIMP_CHANNEL (layer_mask), color, FALSE);
......
......@@ -527,7 +527,8 @@ gimp_selection_new (GimpImage *image,
channel = GIMP_CHANNEL (gimp_drawable_new (GIMP_TYPE_SELECTION,
image, NULL,
0, 0, width, height,
GIMP_GRAY_IMAGE));
gimp_image_get_format (image,
GIMP_GRAY_IMAGE)));
gimp_channel_set_color (channel, &black, FALSE);
gimp_channel_set_show_masked (channel, TRUE);
......@@ -827,7 +828,7 @@ gimp_selection_float (GimpSelection *selection,
* a channel or layer mask
*/
layer = gimp_layer_new_from_buffer (buffer, image,
gimp_drawable_type_with_alpha (drawable),
gimp_drawable_get_format_with_alpha (drawable),
_("Floated Layer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -677,7 +677,8 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
}
new_layer =
gimp_layer_new_from_pixbuf (pixbuf, image, image_type,
gimp_layer_new_from_pixbuf (pixbuf, image,
gimp_image_get_format (image, image_type),
_("Dropped Buffer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......
......@@ -75,8 +75,9 @@ layer_new_invoker (GimpProcedure *procedure,
if (success)
{
layer = gimp_layer_new (image, width, height, type, name,
opacity / 100.0, mode);
layer = gimp_layer_new (image, width, height,
gimp_image_get_format (image, type),
name, opacity / 100.0, mode);
if (! layer)
success = FALSE;
......@@ -112,13 +113,16 @@ layer_new_from_visible_invoker (GimpProcedure *procedure,
if (success)
{
GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
GimpImageType type;
gimp_pickable_flush (pickable);
type = gimp_image_base_type_with_alpha (dest_image);
layer = gimp_layer_new_from_buffer (gimp_pickable_get_buffer (pickable),
dest_image,
gimp_image_base_type_with_alpha (dest_image),
gimp_image_get_format (dest_image, type),
name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
}
......
......@@ -126,7 +126,7 @@ gimp_test_utils_create_image (Gimp *gimp,
layer = gimp_layer_new (image,
width,
height,
GIMP_RGBA_IMAGE,
gimp_image_get_format (image, GIMP_RGBA_IMAGE),
"layer1",
1.0,
GIMP_NORMAL_MODE);
......
......@@ -194,8 +194,8 @@ gimp_text_layer_from_layer (GimpLayer *layer,
drawable = GIMP_DRAWABLE (text_layer);
drawable->private->type = gimp_drawable_type (GIMP_DRAWABLE (layer));
drawable->private->tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (layer));
drawable->private->format = gimp_drawable_get_format (GIMP_DRAWABLE (layer));
drawable->private->tiles = gimp_drawable_get_tiles (GIMP_DRAWABLE (layer));
GIMP_DRAWABLE (layer)->private->tiles = NULL;
gimp_layer_set_opacity (GIMP_LAYER (text_layer),
......
......@@ -393,7 +393,8 @@ gimp_text_layer_new (GimpImage *image,
layer = GIMP_TEXT_LAYER (gimp_drawable_new (GIMP_TYPE_TEXT_LAYER,
image, NULL,
0, 0, 1, 1,
type));
gimp_image_get_format (image,
type)));
gimp_text_layer_set_text (layer, text);
......
......@@ -790,15 +790,18 @@ gimp_layer_tree_view_drop_pixbuf (GimpContainerTreeView *tree_view,
GimpImage *image = gimp_item_tree_view_get_image (item_view);
GimpLayer *new_layer;
GimpLayer *parent;
GimpImageType type;
gint index;
type = gimp_image_base_type_with_alpha (image);
index = gimp_item_tree_view_get_drop_index (item_view, dest_viewable,
drop_pos,
(GimpViewable **) &parent);
new_layer =
gimp_layer_new_from_pixbuf (pixbuf, image,
gimp_image_base_type_with_alpha (image),
gimp_image_get_format (image, type),
_("Dropped Buffer"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
......@@ -831,15 +834,18 @@ gimp_layer_tree_view_set_image (GimpItemTreeView *view,
static GimpItem *
gimp_layer_tree_view_item_new (GimpImage *image)
{
GimpLayer *new_layer;
GimpLayer *new_layer;
GimpImageType type;
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
_("New Layer"));
type = gimp_image_base_type_with_alpha (image);
new_layer = gimp_layer_new (image,
gimp_image_get_width (image),
gimp_image_get_height (image),
gimp_image_base_type_with_alpha (image),
gimp_image_get_format (image, type),
NULL, 1.0, GIMP_NORMAL_MODE);
gimp_image_add_layer (image, new_layer,
......
......@@ -865,8 +865,8 @@ xcf_load_layer_props (XcfInfo *info,
gimp_object_set_name (GIMP_OBJECT (group),
gimp_object_get_name (*layer));
GIMP_DRAWABLE (group)->private->type =
gimp_drawable_type (GIMP_DRAWABLE (*layer));
GIMP_DRAWABLE (group)->private->format =
gimp_drawable_get_format (GIMP_DRAWABLE (*layer));
g_object_ref_sink (*layer);
g_object_unref (*layer);
......@@ -1108,7 +1108,8 @@ xcf_load_layer (XcfInfo *info,
/* create a new layer */
layer = gimp_layer_new (image, width, height,
type, name, 255, GIMP_NORMAL_MODE);
gimp_image_get_format (image, type),
name, 255, GIMP_NORMAL_MODE);
g_free (name);
if (! layer)
return NULL;
......
......@@ -55,8 +55,9 @@ HELP
%invoke = (
code => <<'CODE'
{
layer = gimp_layer_new (image, width, height, type, name,
opacity / 100.0, mode);
layer = gimp_layer_new (image, width, height,
gimp_image_get_format (image, type),
name, opacity / 100.0, mode);
if (! layer)
success = FALSE;
......@@ -95,13 +96,16 @@ HELP
%invoke = (
code => <<'CODE'
{
GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
GimpImageType type;
gimp_pickable_flush (pickable);
type = gimp_image_base_type_with_alpha (dest_image);
layer = gimp_layer_new_from_buffer (gimp_pickable_get_buffer (pickable),
dest_image,
gimp_image_base_type_with_alpha (dest_image),
gimp_image_get_format (dest_image, type),
name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment