libgimp: GimpItem now also belong to libgimp.

This commit is contained in:
Jehan 2019-08-15 12:12:25 +02:00
parent d15388c8c9
commit 08849a584c
35 changed files with 270 additions and 401 deletions

View file

@ -327,7 +327,6 @@ gimp_aspect_preview_draw_buffer (GimpPreview *preview,
&w, &h, &bpp); &w, &h, &bpp);
sel = gimp_drawable_get_thumbnail_data (GIMP_DRAWABLE (selection), sel = gimp_drawable_get_thumbnail_data (GIMP_DRAWABLE (selection),
&w, &h, &bpp); &w, &h, &bpp);
g_object_unref (selection);
gimp_preview_area_mask (GIMP_PREVIEW_AREA (area), gimp_preview_area_mask (GIMP_PREVIEW_AREA (area),
0, 0, width, height, 0, 0, width, height,

View file

@ -60,7 +60,8 @@ gimp_channel_init (GimpChannel *channel)
* set with explicit procedure calls. The channel's contents are * set with explicit procedure calls. The channel's contents are
* undefined initially. * undefined initially.
* *
* Returns: The newly created channel. * Returns: (transfer none): The newly created channel.
* The object belongs to libgimp and you should not free it.
*/ */
GimpChannel * GimpChannel *
gimp_channel_new (GimpImage *image, gimp_channel_new (GimpImage *image,
@ -112,14 +113,9 @@ gimp_channel_new_deprecated (gint32 image_id,
const GimpRGB *color) const GimpRGB *color)
{ {
GimpChannel *channel; GimpChannel *channel;
gint32 channel_id;
channel = gimp_channel_new (gimp_image_get_by_id (image_id), channel = gimp_channel_new (gimp_image_get_by_id (image_id),
name, width, height, name, width, height,
opacity, color); opacity, color);
channel_id = gimp_item_get_id (GIMP_ITEM (channel)); return gimp_item_get_id (GIMP_ITEM (channel));
g_object_unref (channel);
return channel_id;
} }

View file

@ -53,7 +53,7 @@
* explicit procedure calls. * explicit procedure calls.
* The channel's contents are undefined initially. * The channel's contents are undefined initially.
* *
* Returns: (transfer full): The newly created channel. * Returns: (transfer none): The newly created channel.
**/ **/
GimpChannel * GimpChannel *
_gimp_channel_new (GimpImage *image, _gimp_channel_new (GimpImage *image,
@ -87,7 +87,7 @@ _gimp_channel_new (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); channel = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -108,7 +108,7 @@ _gimp_channel_new (GimpImage *image,
* Other attributes, such as channel visibility, should be set with * Other attributes, such as channel visibility, should be set with
* explicit procedure calls. * explicit procedure calls.
* *
* Returns: (transfer full): The newly created channel. * Returns: (transfer none): The newly created channel.
* *
* Since: 2.4 * Since: 2.4
**/ **/
@ -138,7 +138,7 @@ gimp_channel_new_from_component (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); channel = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -206,7 +206,7 @@ _gimp_channel_new_from_component (gint32 image_ID,
* The new channel still needs to be added to the image, as this is not * The new channel still needs to be added to the image, as this is not
* automatic. Add the new channel with gimp_image_insert_channel(). * automatic. Add the new channel with gimp_image_insert_channel().
* *
* Returns: (transfer full): The newly copied channel. * Returns: (transfer none): The newly copied channel.
**/ **/
GimpChannel * GimpChannel *
gimp_channel_copy (GimpChannel *channel) gimp_channel_copy (GimpChannel *channel)
@ -230,7 +230,7 @@ gimp_channel_copy (GimpChannel *channel)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel_copy = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); channel_copy = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -369,7 +369,10 @@ gimp_drawable_get_thumbnail_format (GimpDrawable *drawable)
gchar *format_str = _gimp_drawable_get_thumbnail_format (drawable); gchar *format_str = _gimp_drawable_get_thumbnail_format (drawable);
if (format_str) if (format_str)
format = babl_format (format_str); {
format = babl_format (format_str);
g_free (format_str);
}
return format; return format;
} }
@ -388,7 +391,8 @@ gimp_drawable_get_thumbnail_format (GimpDrawable *drawable)
* Retrieves thumbnail data for the drawable identified by @drawable_ID. * Retrieves thumbnail data for the drawable identified by @drawable_ID.
* The thumbnail will be not larger than the requested size. * The thumbnail will be not larger than the requested size.
* *
* Returns: (transfer full): * Returns: (transfer full) (nullable): thumbnail data or %NULL if
* @drawable_ID is invalid.
**/ **/
guchar * guchar *
gimp_drawable_get_thumbnail_data_deprecated (gint32 drawable_ID, gimp_drawable_get_thumbnail_data_deprecated (gint32 drawable_ID,
@ -396,17 +400,8 @@ gimp_drawable_get_thumbnail_data_deprecated (gint32 drawable_ID,
gint *height, gint *height,
gint *bpp) gint *bpp)
{ {
GimpDrawable *drawable; return gimp_drawable_get_thumbnail_data (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)),
guchar *data = NULL; width, height, bpp);
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
data = gimp_drawable_get_thumbnail_data (drawable, width, height, bpp);
g_object_unref (drawable);
return data;
} }
/** /**
@ -420,7 +415,8 @@ gimp_drawable_get_thumbnail_data_deprecated (gint32 drawable_ID,
* @drawable_ID. The thumbnail will be not larger than the requested * @drawable_ID. The thumbnail will be not larger than the requested
* size. * size.
* *
* Returns: (transfer full): a new #GdkPixbuf * Returns: (transfer full) (nullable): a new #GdkPixbuf or %NULL if
* @drawable_ID is invalid.
* *
* Since: 2.2 * Since: 2.2
**/ **/
@ -430,17 +426,8 @@ gimp_drawable_get_thumbnail_deprecated (gint32 drawable_ID,
gint height, gint height,
GimpPixbufTransparency alpha) GimpPixbufTransparency alpha)
{ {
GimpDrawable *drawable; return gimp_drawable_get_thumbnail (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)),
GdkPixbuf *thumbnail = NULL; width, height, alpha);
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
thumbnail = gimp_drawable_get_thumbnail (drawable, width, height, alpha);
g_object_unref (drawable);
return thumbnail;
} }
guchar * guchar *
@ -453,19 +440,10 @@ gimp_drawable_get_sub_thumbnail_data_deprecated (gint32 drawable_ID,
gint *dest_height, gint *dest_height,
gint *bpp) gint *bpp)
{ {
GimpDrawable *drawable; return gimp_drawable_get_sub_thumbnail_data (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)),
guchar *data = NULL; src_x, src_y,
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
data = gimp_drawable_get_sub_thumbnail_data (drawable, src_x, src_y,
src_width, src_height, src_width, src_height,
dest_width, dest_height, bpp); dest_width, dest_height, bpp);
g_object_unref (drawable);
return data;
} }
/** /**
@ -497,19 +475,10 @@ gimp_drawable_get_sub_thumbnail_deprecated (gint32 drawable_ID,
gint dest_height, gint dest_height,
GimpPixbufTransparency alpha) GimpPixbufTransparency alpha)
{ {
GimpDrawable *drawable; return gimp_drawable_get_sub_thumbnail (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)),
GdkPixbuf *thumbnail = NULL; src_x, src_y,
src_width, src_height,
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); dest_width, dest_height, alpha);
g_return_val_if_fail (drawable, NULL);
thumbnail = gimp_drawable_get_sub_thumbnail (drawable, src_x, src_y,
src_width, src_height,
dest_width, dest_height, alpha);
g_object_unref (drawable);
return thumbnail;
} }
/** /**
@ -530,17 +499,7 @@ gimp_drawable_get_sub_thumbnail_deprecated (gint32 drawable_ID,
GeglBuffer * GeglBuffer *
gimp_drawable_get_buffer_deprecated (gint32 drawable_ID) gimp_drawable_get_buffer_deprecated (gint32 drawable_ID)
{ {
GimpDrawable *drawable; return gimp_drawable_get_buffer (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)));
GeglBuffer *buffer = NULL;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
buffer = gimp_drawable_get_buffer (drawable);
g_object_unref (drawable);
return buffer;
} }
/** /**
@ -561,17 +520,7 @@ gimp_drawable_get_buffer_deprecated (gint32 drawable_ID)
GeglBuffer * GeglBuffer *
gimp_drawable_get_shadow_buffer_deprecated (gint32 drawable_ID) gimp_drawable_get_shadow_buffer_deprecated (gint32 drawable_ID)
{ {
GimpDrawable *drawable; return gimp_drawable_get_shadow_buffer (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)));
GeglBuffer *buffer = NULL;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
buffer = gimp_drawable_get_shadow_buffer (drawable);
g_object_unref (drawable);
return buffer;
} }
/** /**
@ -587,17 +536,7 @@ gimp_drawable_get_shadow_buffer_deprecated (gint32 drawable_ID)
const Babl * const Babl *
gimp_drawable_get_format_deprecated (gint32 drawable_ID) gimp_drawable_get_format_deprecated (gint32 drawable_ID)
{ {
GimpDrawable *drawable; return gimp_drawable_get_format (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)));
const Babl *format = NULL;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
format = gimp_drawable_get_format (drawable);
g_object_unref (drawable);
return format;
} }
/** /**
* gimp_drawable_get_thumbnail_format_deprecated: (skip) * gimp_drawable_get_thumbnail_format_deprecated: (skip)
@ -612,15 +551,5 @@ gimp_drawable_get_format_deprecated (gint32 drawable_ID)
const Babl * const Babl *
gimp_drawable_get_thumbnail_format_deprecated (gint32 drawable_ID) gimp_drawable_get_thumbnail_format_deprecated (gint32 drawable_ID)
{ {
GimpDrawable *drawable; return gimp_drawable_get_thumbnail_format (GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)));
const Babl *format = NULL;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
g_return_val_if_fail (drawable, NULL);
format = gimp_drawable_get_thumbnail_format (drawable);
g_object_unref (drawable);
return format;
} }

View file

@ -474,7 +474,6 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
draw_width, draw_height, draw_width, draw_height,
&s_w, &s_h, &s_w, &s_h,
&s_bpp); &s_bpp);
g_object_unref (selection);
switch (d_bpp) switch (d_bpp)
{ {

View file

@ -333,7 +333,7 @@ _gimp_edit_copy_visible (gint32 image_ID)
* specified drawable, and a subsequent call to floating_sel_attach is * specified drawable, and a subsequent call to floating_sel_attach is
* not needed. * not needed.
* *
* Returns: (transfer full): The new floating selection. * Returns: (transfer none): The new floating selection.
**/ **/
GimpLayer * GimpLayer *
gimp_edit_paste (GimpDrawable *drawable, gimp_edit_paste (GimpDrawable *drawable,
@ -359,7 +359,7 @@ gimp_edit_paste (GimpDrawable *drawable,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); floating_sel = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -808,7 +808,7 @@ _gimp_edit_named_copy_visible (gint32 image_ID,
* This procedure works like gimp_edit_paste() but pastes a named * This procedure works like gimp_edit_paste() but pastes a named
* buffer instead of the global buffer. * buffer instead of the global buffer.
* *
* Returns: (transfer full): The new floating selection. * Returns: (transfer none): The new floating selection.
* *
* Since: 2.4 * Since: 2.4
**/ **/
@ -838,7 +838,7 @@ gimp_edit_named_paste (GimpDrawable *drawable,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); floating_sel = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -101,8 +101,6 @@ export_merge (GimpImage *image,
gimp_selection_none (image); gimp_selection_none (image);
gimp_drawable_edit_clear (GIMP_DRAWABLE (transp)); gimp_drawable_edit_clear (GIMP_DRAWABLE (transp));
nvisible++; nvisible++;
g_object_unref (transp);
} }
if (nvisible > 1) if (nvisible > 1)
@ -121,7 +119,7 @@ export_merge (GimpImage *image,
return; /* shouldn't happen */ return; /* shouldn't happen */
} }
g_list_free_full (layers, g_object_unref); g_list_free (layers);
layers = gimp_image_get_layers (image); layers = gimp_image_get_layers (image);
/* make sure that the merged drawable matches the image size */ /* make sure that the merged drawable matches the image size */
@ -144,7 +142,7 @@ export_merge (GimpImage *image,
if (gimp_item_get_id (iter->data) != gimp_item_get_id (GIMP_ITEM (*drawable))) if (gimp_item_get_id (iter->data) != gimp_item_get_id (GIMP_ITEM (*drawable)))
gimp_image_remove_layer (image, iter->data); gimp_image_remove_layer (image, iter->data);
} }
g_list_free_full (layers, g_object_unref); g_list_free (layers);
} }
static void static void
@ -174,7 +172,7 @@ export_remove_alpha (GimpImage *image,
gimp_layer_flatten (iter->data); gimp_layer_flatten (iter->data);
} }
g_list_free_full (layers, g_object_unref); g_list_free (layers);
} }
static void static void
@ -193,11 +191,9 @@ export_apply_masks (GimpImage *image,
mask = gimp_layer_get_mask (iter->data); mask = gimp_layer_get_mask (iter->data);
if (mask) if (mask)
gimp_layer_remove_mask (iter->data, GIMP_MASK_APPLY); gimp_layer_remove_mask (iter->data, GIMP_MASK_APPLY);
g_clear_object (&mask);
} }
g_list_free_full (layers, g_object_unref); g_list_free (layers);
} }
static void static void
@ -232,7 +228,7 @@ export_convert_indexed (GimpImage *image,
GIMP_CONVERT_DITHER_NONE, GIMP_CONVERT_DITHER_NONE,
GIMP_CONVERT_PALETTE_GENERATE, GIMP_CONVERT_PALETTE_GENERATE,
256, FALSE, FALSE, ""); 256, FALSE, FALSE, "");
g_list_free_full (layers, g_object_unref); g_list_free (layers);
} }
static void static void
@ -261,7 +257,7 @@ export_add_alpha (GimpImage *image,
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (iter->data))) if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (iter->data)))
gimp_layer_add_alpha (GIMP_LAYER (iter->data)); gimp_layer_add_alpha (GIMP_LAYER (iter->data));
} }
g_list_free_full (layers, g_object_unref); g_list_free (layers);
} }
static void static void
@ -839,14 +835,8 @@ gimp_export_image (GimpImage **image,
{ {
for (iter = layers; iter; iter = iter->next) for (iter = layers; iter; iter = iter->next)
{ {
GimpLayer *layer = GIMP_LAYER (iter->data); if (gimp_layer_get_mask (iter->data))
GimpLayerMask *mask;
mask = gimp_layer_get_mask (layer);
if (mask)
has_layer_masks = TRUE; has_layer_masks = TRUE;
g_clear_object (&mask);
} }
} }
@ -924,7 +914,7 @@ gimp_export_image (GimpImage **image,
} }
} }
g_list_free_full (children, g_object_unref); g_list_free (children);
/* check layer masks */ /* check layer masks */
if (has_layer_masks && if (has_layer_masks &&
@ -932,7 +922,7 @@ gimp_export_image (GimpImage **image,
actions = g_slist_prepend (actions, &export_action_apply_masks); actions = g_slist_prepend (actions, &export_action_apply_masks);
} }
g_list_free_full (layers, g_object_unref); g_list_free (layers);
/* check the image type */ /* check the image type */
type = gimp_image_base_type (*image); type = gimp_image_base_type (*image);
@ -1148,22 +1138,16 @@ gimp_export_image_deprecated (gint32 *image_ID,
{ {
GimpImage *image; GimpImage *image;
GimpDrawable *drawable; GimpDrawable *drawable;
GimpDrawable *new_drawable;
GimpExportReturn retval; GimpExportReturn retval;
image = gimp_image_get_by_id (*image_ID); image = gimp_image_get_by_id (*image_ID);
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (*drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (*drawable_ID));
new_drawable = drawable;
retval = gimp_export_image (&image, &new_drawable, retval = gimp_export_image (&image, &drawable,
format_name, capabilities); format_name, capabilities);
*image_ID = gimp_image_get_id (image); *image_ID = gimp_image_get_id (image);
*drawable_ID = gimp_item_get_id (GIMP_ITEM (new_drawable)); *drawable_ID = gimp_item_get_id (GIMP_ITEM (drawable));
if (retval == GIMP_EXPORT_EXPORT)
g_object_unref (new_drawable);
g_object_unref (drawable);
return retval; return retval;
} }

View file

@ -149,7 +149,7 @@ _gimp_file_load (GimpRunMode run_mode,
* needs to be added to the existing image with * needs to be added to the existing image with
* gimp_image_insert_layer(). * gimp_image_insert_layer().
* *
* Returns: (transfer full): The layer created when loading the image file. * Returns: (transfer none): The layer created when loading the image file.
* *
* Since: 2.4 * Since: 2.4
**/ **/
@ -179,7 +179,7 @@ gimp_file_load_layer (GimpRunMode run_mode,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -220,10 +220,10 @@ gimp_image_list (void)
* This procedure returns the list of layers contained in the specified * This procedure returns the list of layers contained in the specified
* image. The order of layers is from topmost to bottommost. * image. The order of layers is from topmost to bottommost.
* *
* Returns: (element-type GimpImage) (transfer full): * Returns: (element-type GimpImage) (transfer container):
* The list of layers contained in the image. * The list of layers contained in the image.
* The returned value must be freed with: * The returned value must be freed with g_list_free(). Layer
* g_list_free_full(list, g_object_unref); * elements belong to libgimp and must not be freed.
* *
* Since: 3.0 * Since: 3.0
**/ **/
@ -237,13 +237,8 @@ gimp_image_get_layers (GimpImage *image)
ids = _gimp_image_get_layers (image, &num_layers); ids = _gimp_image_get_layers (image, &num_layers);
for (i = 0; i < num_layers; i++) for (i = 0; i < num_layers; i++)
{ layers = g_list_prepend (layers,
GimpLayer *layer; GIMP_LAYER (gimp_item_get_by_id (ids[i])));
layer = GIMP_LAYER (gimp_item_new_by_id (ids[i]));
layers = g_list_prepend (layers, layer);
}
layers = g_list_reverse (layers); layers = g_list_reverse (layers);
g_free (ids); g_free (ids);
@ -262,10 +257,10 @@ gimp_image_get_layers (GimpImage *image)
* \"channels\" are custom channels and do not include the image's * \"channels\" are custom channels and do not include the image's
* color components. * color components.
* *
* Returns: (element-type GimpChannel) (transfer full): * Returns: (element-type GimpChannel) (transfer container):
* The list of channels contained in the image. * The list of channels contained in the image.
* The returned value must be freed with: * The returned value must be freed with g_list_free(). Channel
* g_list_free_full(list, g_object_unref); * elements belong to libgimp and must not be freed.
* *
* Since: 3.0 * Since: 3.0
**/ **/
@ -279,13 +274,8 @@ gimp_image_get_channels (GimpImage *image)
ids = _gimp_image_get_channels (image, &num_channels); ids = _gimp_image_get_channels (image, &num_channels);
for (i = 0; i < num_channels; i++) for (i = 0; i < num_channels; i++)
{ channels = g_list_prepend (channels,
GimpChannel *channel; GIMP_CHANNEL (gimp_item_get_by_id (ids[i])));
channel = GIMP_CHANNEL (gimp_item_new_by_id (ids[i]));
channels = g_list_prepend (channels, channel);
}
channels = g_list_reverse (channels); channels = g_list_reverse (channels);
g_free (ids); g_free (ids);
@ -301,10 +291,10 @@ gimp_image_get_channels (GimpImage *image)
* This procedure returns the list of vectors contained in the * This procedure returns the list of vectors contained in the
* specified image. * specified image.
* *
* Returns: (element-type GimpVectors) (transfer full): * Returns: (element-type GimpVectors) (transfer container):
* The list of vectors contained in the image. * The list of vectors contained in the image.
* The returned value must be freed with: * The returned value must be freed with g_list_free(). Vectors
* g_list_free_full(list, g_object_unref); * elements belong to libgimp and must not be freed.
* *
* Since: 3.0 * Since: 3.0
**/ **/
@ -318,13 +308,8 @@ gimp_image_get_vectors (GimpImage *image)
ids = _gimp_image_get_vectors (image, &num_vectors); ids = _gimp_image_get_vectors (image, &num_vectors);
for (i = 0; i < num_vectors; i++) for (i = 0; i < num_vectors; i++)
{ vectors = g_list_prepend (vectors,
GimpVectors *path; GIMP_VECTORS (gimp_item_get_by_id (ids[i])));
path = GIMP_VECTORS (gimp_item_new_by_id (ids[i]));
vectors = g_list_prepend (vectors, path);
}
vectors = g_list_reverse (vectors); vectors = g_list_reverse (vectors);
g_free (ids); g_free (ids);

View file

@ -1115,7 +1115,7 @@ _gimp_image_get_vectors (GimpImage *image,
* layer mask and the layer mask is in edit mode, then the layer mask * layer mask and the layer mask is in edit mode, then the layer mask
* is the active drawable. * is the active drawable.
* *
* Returns: (transfer full): The active drawable. * Returns: (transfer none): The active drawable.
**/ **/
GimpDrawable * GimpDrawable *
gimp_image_get_active_drawable (GimpImage *image) gimp_image_get_active_drawable (GimpImage *image)
@ -1139,7 +1139,7 @@ gimp_image_get_active_drawable (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1)))); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1281,7 +1281,7 @@ _gimp_image_unset_active_channel (gint32 image_ID)
* This procedure returns the image's floating selection, if it exists. * This procedure returns the image's floating selection, if it exists.
* If it doesn't exist, -1 is returned as the layer ID. * If it doesn't exist, -1 is returned as the layer ID.
* *
* Returns: (transfer full): The image's floating selection. * Returns: (transfer none): The image's floating selection.
**/ **/
GimpLayer * GimpLayer *
gimp_image_get_floating_sel (GimpImage *image) gimp_image_get_floating_sel (GimpImage *image)
@ -1305,7 +1305,7 @@ gimp_image_get_floating_sel (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); floating_sel = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1362,7 +1362,7 @@ _gimp_image_get_floating_sel (gint32 image_ID)
* is attached to, if it exists. If it doesn't exist, -1 is returned as * is attached to, if it exists. If it doesn't exist, -1 is returned as
* the drawable ID. * the drawable ID.
* *
* Returns: (transfer full): * Returns: (transfer none):
* The drawable the floating selection is attached to. * The drawable the floating selection is attached to.
**/ **/
GimpDrawable * GimpDrawable *
@ -1387,7 +1387,7 @@ gimp_image_floating_sel_attached_to (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1)))); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1591,7 +1591,7 @@ _gimp_image_pick_color (gint32 image_ID,
* at the specified coordinates. This procedure will return -1 if no * at the specified coordinates. This procedure will return -1 if no
* layer is found. * layer is found.
* *
* Returns: (transfer full): The layer found at the specified coordinates. * Returns: (transfer none): The layer found at the specified coordinates.
**/ **/
GimpLayer * GimpLayer *
gimp_image_pick_correlate_layer (GimpImage *image, gimp_image_pick_correlate_layer (GimpImage *image,
@ -1619,7 +1619,7 @@ gimp_image_pick_correlate_layer (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -3360,7 +3360,7 @@ _gimp_image_reorder_item (gint32 image_ID,
* merging with the CLIP_TO_IMAGE merge type. Non-visible layers are * merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
* discarded, and the resulting image is stripped of its alpha channel. * discarded, and the resulting image is stripped of its alpha channel.
* *
* Returns: (transfer full): The resulting layer. * Returns: (transfer none): The resulting layer.
**/ **/
GimpLayer * GimpLayer *
gimp_image_flatten (GimpImage *image) gimp_image_flatten (GimpImage *image)
@ -3384,7 +3384,7 @@ gimp_image_flatten (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -3447,7 +3447,7 @@ _gimp_image_flatten (gint32 image_ID)
* extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the * extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
* final layer to the size of the bottommost layer. * final layer to the size of the bottommost layer.
* *
* Returns: (transfer full): The resulting layer. * Returns: (transfer none): The resulting layer.
**/ **/
GimpLayer * GimpLayer *
gimp_image_merge_visible_layers (GimpImage *image, gimp_image_merge_visible_layers (GimpImage *image,
@ -3473,7 +3473,7 @@ gimp_image_merge_visible_layers (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -3543,7 +3543,7 @@ _gimp_image_merge_visible_layers (gint32 image_ID,
* CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the * CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the
* bottommost layer. * bottommost layer.
* *
* Returns: (transfer full): The resulting layer. * Returns: (transfer none): The resulting layer.
**/ **/
GimpLayer * GimpLayer *
gimp_image_merge_down (GimpImage *image, gimp_image_merge_down (GimpImage *image,
@ -3571,7 +3571,7 @@ gimp_image_merge_down (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -4063,7 +4063,7 @@ _gimp_image_thumbnail (GimpImage *image,
* If a channel is currently active, then no layer will be. If a layer * If a channel is currently active, then no layer will be. If a layer
* mask is active, then this will return the associated layer. * mask is active, then this will return the associated layer.
* *
* Returns: (transfer full): The active layer. * Returns: (transfer none): The active layer.
**/ **/
GimpLayer * GimpLayer *
gimp_image_get_active_layer (GimpImage *image) gimp_image_get_active_layer (GimpImage *image)
@ -4087,7 +4087,7 @@ gimp_image_get_active_layer (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
active_layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); active_layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -4232,7 +4232,7 @@ _gimp_image_set_active_layer (gint32 image_ID,
* If there is an active channel, this will return the channel ID, * If there is an active channel, this will return the channel ID,
* otherwise, -1. * otherwise, -1.
* *
* Returns: (transfer full): The active channel. * Returns: (transfer none): The active channel.
**/ **/
GimpChannel * GimpChannel *
gimp_image_get_active_channel (GimpImage *image) gimp_image_get_active_channel (GimpImage *image)
@ -4256,7 +4256,7 @@ gimp_image_get_active_channel (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
active_channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); active_channel = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -4399,7 +4399,7 @@ _gimp_image_set_active_channel (gint32 image_ID,
* *
* If there is an active path, its ID will be returned, otherwise, -1. * If there is an active path, its ID will be returned, otherwise, -1.
* *
* Returns: (transfer full): The active vectors. * Returns: (transfer none): The active vectors.
**/ **/
GimpVectors * GimpVectors *
gimp_image_get_active_vectors (GimpImage *image) gimp_image_get_active_vectors (GimpImage *image)
@ -4423,7 +4423,7 @@ gimp_image_get_active_vectors (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
active_vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1)))); active_vectors = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -4560,7 +4560,7 @@ _gimp_image_set_active_vectors (gint32 image_ID,
* This will always return a valid ID for a selection -- which is * This will always return a valid ID for a selection -- which is
* represented as a channel internally. * represented as a channel internally.
* *
* Returns: (transfer full): The selection channel. * Returns: (transfer none): The selection channel.
**/ **/
GimpSelection * GimpSelection *
gimp_image_get_selection (GimpImage *image) gimp_image_get_selection (GimpImage *image)
@ -4584,7 +4584,7 @@ gimp_image_get_selection (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
selection = GIMP_SELECTION (gimp_item_new_by_id (gimp_value_get_selection_id (gimp_value_array_index (return_vals, 1)))); selection = GIMP_SELECTION (gimp_item_get_by_id (gimp_value_get_selection_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -6191,7 +6191,7 @@ _gimp_image_set_tattoo_state (gint32 image_ID,
* This procedure returns the layer with the given tattoo in the * This procedure returns the layer with the given tattoo in the
* specified image. * specified image.
* *
* Returns: (transfer full): The layer with the specified tattoo. * Returns: (transfer none): The layer with the specified tattoo.
**/ **/
GimpLayer * GimpLayer *
gimp_image_get_layer_by_tattoo (GimpImage *image, gimp_image_get_layer_by_tattoo (GimpImage *image,
@ -6217,7 +6217,7 @@ gimp_image_get_layer_by_tattoo (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -6277,7 +6277,7 @@ _gimp_image_get_layer_by_tattoo (gint32 image_ID,
* This procedure returns the channel with the given tattoo in the * This procedure returns the channel with the given tattoo in the
* specified image. * specified image.
* *
* Returns: (transfer full): The channel with the specified tattoo. * Returns: (transfer none): The channel with the specified tattoo.
**/ **/
GimpChannel * GimpChannel *
gimp_image_get_channel_by_tattoo (GimpImage *image, gimp_image_get_channel_by_tattoo (GimpImage *image,
@ -6303,7 +6303,7 @@ gimp_image_get_channel_by_tattoo (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); channel = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -6363,7 +6363,7 @@ _gimp_image_get_channel_by_tattoo (gint32 image_ID,
* This procedure returns the vectors with the given tattoo in the * This procedure returns the vectors with the given tattoo in the
* specified image. * specified image.
* *
* Returns: (transfer full): The vectors with the specified tattoo. * Returns: (transfer none): The vectors with the specified tattoo.
* *
* Since: 2.6 * Since: 2.6
**/ **/
@ -6391,7 +6391,7 @@ gimp_image_get_vectors_by_tattoo (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1)))); vectors = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -6453,7 +6453,7 @@ _gimp_image_get_vectors_by_tattoo (gint32 image_ID,
* This procedure returns the layer with the given name in the * This procedure returns the layer with the given name in the
* specified image. * specified image.
* *
* Returns: (transfer full): The layer with the specified name. * Returns: (transfer none): The layer with the specified name.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -6481,7 +6481,7 @@ gimp_image_get_layer_by_name (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -6543,7 +6543,7 @@ _gimp_image_get_layer_by_name (gint32 image_ID,
* This procedure returns the channel with the given name in the * This procedure returns the channel with the given name in the
* specified image. * specified image.
* *
* Returns: (transfer full): The channel with the specified name. * Returns: (transfer none): The channel with the specified name.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -6571,7 +6571,7 @@ gimp_image_get_channel_by_name (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); channel = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -6633,7 +6633,7 @@ _gimp_image_get_channel_by_name (gint32 image_ID,
* This procedure returns the vectors with the given name in the * This procedure returns the vectors with the given name in the
* specified image. * specified image.
* *
* Returns: (transfer full): The vectors with the specified name. * Returns: (transfer none): The vectors with the specified name.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -6661,7 +6661,7 @@ gimp_image_get_vectors_by_name (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1)))); vectors = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -717,7 +717,6 @@ gimp_image_metadata_load_thumbnail (GFile *file,
g_object_unref (pixbuf); g_object_unref (pixbuf);
gimp_image_insert_layer (image, layer, NULL, 0); gimp_image_insert_layer (image, layer, NULL, 0);
g_object_unref (layer);
gimp_image_metadata_rotate (image, gimp_image_metadata_rotate (image,
gexiv2_metadata_get_orientation (GEXIV2_METADATA (metadata))); gexiv2_metadata_get_orientation (GEXIV2_METADATA (metadata)));

View file

@ -37,6 +37,9 @@ struct _GimpItemPrivate
gint id; gint id;
}; };
static GHashTable *gimp_items = NULL;
static void gimp_item_set_property (GObject *object, static void gimp_item_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
@ -136,29 +139,66 @@ gimp_item_get_id (GimpItem *item)
} }
/** /**
* gimp_item_new_by_id: * gimp_item_get_by_id:
* @item_id: The item id. * @item_id: The item id.
* *
* Creates a #GimpItem representing @item_id. Since #GimpItem is an * Creates a #GimpItem representing @item_id. Since #GimpItem is an
* abstract class, the object real type will actually be the proper * abstract class, the object real type will actually be the proper
* subclass. * subclass.
* *
* Returns: (nullable) (transfer full): a #GimpItem for @item_id or * Returns: (nullable) (transfer none): a #GimpItem for @item_id or
* %NULL if @item_id does not represent a valid item. * %NULL if @item_id does not represent a valid item.
* The object belongs to libgimp and you should not free it.
* *
* Since: 3.0 * Since: 3.0
**/ **/
GimpItem * GimpItem *
gimp_item_new_by_id (gint32 item_id) gimp_item_get_by_id (gint32 item_id)
{ {
GimpItem *item = NULL; GimpItem *item = NULL;
if (_gimp_item_is_valid (item_id)) if (G_UNLIKELY (! gimp_items))
gimp_items = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
(GDestroyNotify) g_object_unref);
if (! _gimp_item_is_valid (item_id))
{ {
if (_gimp_item_is_layer (item_id)) g_hash_table_remove (gimp_items, GINT_TO_POINTER (item_id));
item = g_object_new (GIMP_TYPE_LAYER, }
"id", item_id, else
NULL); {
item = g_hash_table_lookup (gimp_items,
GINT_TO_POINTER (item_id));
if (! item)
{
if (_gimp_item_is_layer (item_id))
item = g_object_new (GIMP_TYPE_LAYER,
"id", item_id,
NULL);
else if (_gimp_item_is_layer_mask (item_id))
item = g_object_new (GIMP_TYPE_LAYER_MASK,
"id", item_id,
NULL);
else if (_gimp_item_is_selection (item_id))
item = g_object_new (GIMP_TYPE_SELECTION,
"id", item_id,
NULL);
else if (_gimp_item_is_channel (item_id))
item = g_object_new (GIMP_TYPE_CHANNEL,
"id", item_id,
NULL);
else if (_gimp_item_is_vectors (item_id))
item = g_object_new (GIMP_TYPE_VECTORS,
"id", item_id,
NULL);
if (item)
g_hash_table_insert (gimp_items,
GINT_TO_POINTER (item_id),
item);
}
} }
return item; return item;
@ -173,10 +213,10 @@ gimp_item_new_by_id (gint32 item_id)
* This procedure returns the list of items which are children of the * This procedure returns the list of items which are children of the
* specified item. The order is topmost to bottommost. * specified item. The order is topmost to bottommost.
* *
* Returns: (element-type GimpItem) (transfer full): * Returns: (element-type GimpItem) (transfer container):
* The item's list of children. * The item's list of children.
* The returned value must be freed with: * The returned value must be freed with g_list_free(). Item
* g_list_free_full(list, g_object_unref); * elements belong to libgimp and must not be freed.
* *
* Since: 3.0 * Since: 3.0
**/ **/
@ -191,7 +231,7 @@ gimp_item_get_children (GimpItem *item)
ids = _gimp_item_get_children (item, &num_items); ids = _gimp_item_get_children (item, &num_items);
for (i = 0; i < num_items; i++) for (i = 0; i < num_items; i++)
children = g_list_prepend (children, gimp_item_new_by_id (ids[i])); children = g_list_prepend (children, gimp_item_get_by_id (ids[i]));
children = g_list_reverse (children); children = g_list_reverse (children);
g_free (ids); g_free (ids);
@ -219,12 +259,6 @@ gint *
gimp_item_get_children_deprecated (gint32 item_id, gimp_item_get_children_deprecated (gint32 item_id,
gint *num_children) gint *num_children)
{ {
GimpItem *item; return _gimp_item_get_children (gimp_item_get_by_id (item_id),
gint *children; num_children);
item = gimp_item_new_by_id (item_id);
children = _gimp_item_get_children (item, num_children);
g_object_unref (item);
return children;
} }

View file

@ -67,7 +67,7 @@ struct _GimpItemClass
GType gimp_item_get_type (void) G_GNUC_CONST; GType gimp_item_get_type (void) G_GNUC_CONST;
gint32 gimp_item_get_id (GimpItem *item); gint32 gimp_item_get_id (GimpItem *item);
GimpItem * gimp_item_new_by_id (gint32 item_id); GimpItem * gimp_item_get_by_id (gint32 item_id);
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API #ifndef GIMP_DEPRECATED_REPLACE_NEW_API

View file

@ -954,7 +954,7 @@ _gimp_item_is_group (gint32 item_ID)
* *
* This procedure returns the item's parent item, if any. * This procedure returns the item's parent item, if any.
* *
* Returns: (transfer full): The item's parent item. * Returns: (transfer none): The item's parent item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -980,7 +980,7 @@ gimp_item_get_parent (GimpItem *item)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
parent = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); parent = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -406,7 +406,7 @@ gimp_item_combo_box_populate (GimpIntComboBox *combo_box)
items = gimp_image_get_layers (image); items = gimp_image_get_layers (image);
gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model), gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model),
image, items, 0); image, items, 0);
g_list_free_full (items, g_object_unref); g_list_free (items);
} }
if (GIMP_IS_DRAWABLE_COMBO_BOX (combo_box) || if (GIMP_IS_DRAWABLE_COMBO_BOX (combo_box) ||
@ -415,7 +415,7 @@ gimp_item_combo_box_populate (GimpIntComboBox *combo_box)
items = gimp_image_get_channels (image); items = gimp_image_get_channels (image);
gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model), gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model),
image, items, 0); image, items, 0);
g_list_free_full (items, g_object_unref); g_list_free (items);
} }
if (GIMP_IS_VECTORS_COMBO_BOX (combo_box)) if (GIMP_IS_VECTORS_COMBO_BOX (combo_box))
@ -423,7 +423,7 @@ gimp_item_combo_box_populate (GimpIntComboBox *combo_box)
items = gimp_image_get_vectors (image); items = gimp_image_get_vectors (image);
gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model), gimp_item_combo_box_model_add (combo_box, GTK_LIST_STORE (model),
image, items, 0); image, items, 0);
g_list_free_full (items, g_object_unref); g_list_free (items);
} }
} }
@ -507,7 +507,7 @@ gimp_item_combo_box_model_add (GimpIntComboBox *combo_box,
gimp_item_combo_box_model_add (combo_box, store, gimp_item_combo_box_model_add (combo_box, store,
image, children, image, children,
tree_level + 1); tree_level + 1);
g_list_free_full (children, g_object_unref); g_list_free (children);
} }
} }

View file

@ -52,7 +52,7 @@
* linked flag set to TRUE will also be translated by the specified * linked flag set to TRUE will also be translated by the specified
* offsets. * offsets.
* *
* Returns: (transfer full): The translated item. * Returns: (transfer none): The translated item.
* *
* Since: 2.10 * Since: 2.10
**/ **/
@ -82,7 +82,7 @@ gimp_item_transform_translate (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -173,7 +173,7 @@ _gimp_item_transform_translate (gint32 item_ID,
* This procedure is affected by the following context setters: * This procedure is affected by the following context setters:
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The flipped item. * Returns: (transfer none): The flipped item.
* *
* Since: 2.2 * Since: 2.2
**/ **/
@ -205,7 +205,7 @@ gimp_item_transform_flip_simple (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -310,7 +310,7 @@ _gimp_item_transform_flip_simple (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The flipped item. * Returns: (transfer none): The flipped item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -344,7 +344,7 @@ gimp_item_transform_flip (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -465,7 +465,7 @@ _gimp_item_transform_flip (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The transformed item. * Returns: (transfer none): The transformed item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -507,7 +507,7 @@ gimp_item_transform_perspective (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -639,7 +639,7 @@ _gimp_item_transform_perspective (gint32 item_ID,
* This procedure is affected by the following context setters: * This procedure is affected by the following context setters:
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The rotated item. * Returns: (transfer none): The rotated item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -673,7 +673,7 @@ gimp_item_transform_rotate_simple (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -789,7 +789,7 @@ _gimp_item_transform_rotate_simple (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The rotated item. * Returns: (transfer none): The rotated item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -823,7 +823,7 @@ gimp_item_transform_rotate (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -938,7 +938,7 @@ _gimp_item_transform_rotate (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The scaled item. * Returns: (transfer none): The scaled item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -972,7 +972,7 @@ gimp_item_transform_scale (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1084,7 +1084,7 @@ _gimp_item_transform_scale (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The sheared item. * Returns: (transfer none): The sheared item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -1114,7 +1114,7 @@ gimp_item_transform_shear (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1228,7 +1228,7 @@ _gimp_item_transform_shear (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The transformed item. * Returns: (transfer none): The transformed item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -1268,7 +1268,7 @@ gimp_item_transform_2d (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1398,7 +1398,7 @@ _gimp_item_transform_2d (gint32 item_ID,
* gimp_context_set_transform_direction(), * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize(). * gimp_context_set_transform_resize().
* *
* Returns: (transfer full): The transformed item. * Returns: (transfer none): The transformed item.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -1442,7 +1442,7 @@ gimp_item_transform_matrix (GimpItem *item,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1))); ret_item = gimp_item_get_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -63,7 +63,10 @@ gimp_layer_init (GimpLayer *layer)
* command. Other attributes such as layer mask modes, and offsets * command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls. * should be set with explicit procedure calls.
* *
* Returns: The newly created layer. * Returns: (transfer none): The newly created layer.
* The object belongs to libgimp and you should not free it.
*
* Since: 3.0
*/ */
GimpLayer * GimpLayer *
gimp_layer_new (GimpImage *image, gimp_layer_new (GimpImage *image,
@ -93,7 +96,10 @@ gimp_layer_new (GimpImage *image,
* newly copied layer is for use within the original layer's image. It * newly copied layer is for use within the original layer's image. It
* should not be subsequently added to any other image. * should not be subsequently added to any other image.
* *
* Returns: (transfer full): The newly copied layer. * Returns: (transfer none): The newly copied layer.
* The object belongs to libgimp and you should not free it.
*
* Since: 3.0
*/ */
GimpLayer * GimpLayer *
gimp_layer_copy (GimpLayer *layer) gimp_layer_copy (GimpLayer *layer)
@ -121,9 +127,10 @@ gimp_layer_copy (GimpLayer *layer)
* gimp_progress_update() will be called for. You have to call * gimp_progress_update() will be called for. You have to call
* gimp_progress_init() beforehand then. * gimp_progress_init() beforehand then.
* *
* Returns: The newly created layer. * Returns: (transfer none): The newly created layer.
* The object belongs to libgimp and you should not free it.
* *
* Since: 2.4 * Since: 3.0
*/ */
GimpLayer * GimpLayer *
gimp_layer_new_from_pixbuf (GimpImage *image, gimp_layer_new_from_pixbuf (GimpImage *image,
@ -199,9 +206,10 @@ gimp_layer_new_from_pixbuf (GimpImage *image,
* gimp_progress_update() will be called for. You have to call * gimp_progress_update() will be called for. You have to call
* gimp_progress_init() beforehand then. * gimp_progress_init() beforehand then.
* *
* Returns: The newly created layer. * Returns: (transfer none): The newly created layer.
* The object belongs to libgimp and you should not free it.
* *
* Since: 2.8 * Since: 3.0
*/ */
GimpLayer * GimpLayer *
gimp_layer_new_from_surface (GimpImage *image, gimp_layer_new_from_surface (GimpImage *image,
@ -286,7 +294,7 @@ gimp_layer_new_from_surface (GimpImage *image,
* command. Other attributes such as layer mask modes, and offsets * command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls. * should be set with explicit procedure calls.
* *
* Returns: The newly created layer. * Returns: The newly created layer ID.
*/ */
gint32 gint32
gimp_layer_new_deprecated (gint32 image_id, gimp_layer_new_deprecated (gint32 image_id,
@ -298,16 +306,12 @@ gimp_layer_new_deprecated (gint32 image_id,
GimpLayerMode mode) GimpLayerMode mode)
{ {
GimpLayer *layer; GimpLayer *layer;
gint32 layer_id;
layer = gimp_layer_new (gimp_image_get_by_id (image_id), layer = gimp_layer_new (gimp_image_get_by_id (image_id),
name, width, height, name, width, height,
type, opacity, mode); type, opacity, mode);
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
g_object_unref (layer); return gimp_item_get_id (GIMP_ITEM (layer));
return layer_id;
} }
/** /**
@ -330,7 +334,7 @@ gimp_layer_new_deprecated (gint32 image_id,
* gimp_progress_update() will be called for. You have to call * gimp_progress_update() will be called for. You have to call
* gimp_progress_init() beforehand then. * gimp_progress_init() beforehand then.
* *
* Returns: The newly created layer. * Returns: The newly created layer ID.
* *
* Since: 2.4 * Since: 2.4
*/ */
@ -344,16 +348,12 @@ gimp_layer_new_from_pixbuf_deprecated (gint32 image_id,
gdouble progress_end) gdouble progress_end)
{ {
GimpLayer *layer; GimpLayer *layer;
gint32 layer_id;
layer = gimp_layer_new_from_pixbuf (gimp_image_get_by_id (image_id), layer = gimp_layer_new_from_pixbuf (gimp_image_get_by_id (image_id),
name, pixbuf, opacity, mode, name, pixbuf, opacity, mode,
progress_start, progress_end); progress_start, progress_end);
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
g_object_unref (layer); return gimp_item_get_id (GIMP_ITEM (layer));
return layer_id;
} }
/** /**
@ -374,7 +374,7 @@ gimp_layer_new_from_pixbuf_deprecated (gint32 image_id,
* gimp_progress_update() will be called for. You have to call * gimp_progress_update() will be called for. You have to call
* gimp_progress_init() beforehand then. * gimp_progress_init() beforehand then.
* *
* Returns: The newly created layer. * Returns: The newly created layer ID.
* *
* Since: 2.8 * Since: 2.8
*/ */
@ -386,16 +386,12 @@ gimp_layer_new_from_surface_deprecated (gint32 image_id,
gdouble progress_end) gdouble progress_end)
{ {
GimpLayer *layer; GimpLayer *layer;
gint32 layer_id;
layer = gimp_layer_new_from_surface (gimp_image_get_by_id (image_id), layer = gimp_layer_new_from_surface (gimp_image_get_by_id (image_id),
name, surface, name, surface,
progress_start, progress_end); progress_start, progress_end);
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
g_object_unref (layer); return gimp_item_get_id (GIMP_ITEM (layer));
return layer_id;
} }
/** /**
@ -408,25 +404,14 @@ gimp_layer_new_from_surface_deprecated (gint32 image_id,
* newly copied layer is for use within the original layer's image. It * newly copied layer is for use within the original layer's image. It
* should not be subsequently added to any other image. * should not be subsequently added to any other image.
* *
* Returns: The newly copied layer. * Returns: The newly copied layer ID.
*/ */
gint32 gint32
gimp_layer_copy_deprecated (gint32 layer_ID) gimp_layer_copy_deprecated (gint32 layer_ID)
{ {
GimpLayer *layer;
GimpLayer *copy; GimpLayer *copy;
gint32 copy_id;
layer = GIMP_LAYER (gimp_item_new_by_id (layer_ID)); copy = gimp_layer_copy (GIMP_LAYER (gimp_item_get_by_id (layer_ID)));
g_return_val_if_fail (layer, -1);
copy = gimp_layer_copy (layer); return gimp_item_get_id (GIMP_ITEM (copy));
g_return_val_if_fail (copy, -1);
copy_id = gimp_item_get_id (GIMP_ITEM (copy));
g_object_unref (copy);
g_object_unref (layer);
return copy_id;
} }

View file

@ -53,7 +53,7 @@
* command. Other attributes such as layer mask modes, and offsets * command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls. * should be set with explicit procedure calls.
* *
* Returns: (transfer full): The newly created layer. * Returns: (transfer none): The newly created layer.
**/ **/
GimpLayer * GimpLayer *
_gimp_layer_new (GimpImage *image, _gimp_layer_new (GimpImage *image,
@ -89,7 +89,7 @@ _gimp_layer_new (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -110,7 +110,7 @@ _gimp_layer_new (GimpImage *image,
* gimp_image_insert_layer() command. Other attributes such as layer * gimp_image_insert_layer() command. Other attributes such as layer
* mask modes, and offsets should be set with explicit procedure calls. * mask modes, and offsets should be set with explicit procedure calls.
* *
* Returns: (transfer full): The newly created layer. * Returns: (transfer none): The newly created layer.
* *
* Since: 2.6 * Since: 2.6
**/ **/
@ -140,7 +140,7 @@ gimp_layer_new_from_visible (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -211,7 +211,7 @@ _gimp_layer_new_from_visible (gint32 image_ID,
* gimp_image_insert_layer() command. Other attributes such as layer * gimp_image_insert_layer() command. Other attributes such as layer
* mask modes, and offsets should be set with explicit procedure calls. * mask modes, and offsets should be set with explicit procedure calls.
* *
* Returns: (transfer full): The newly copied layer. * Returns: (transfer none): The newly copied layer.
**/ **/
GimpLayer * GimpLayer *
gimp_layer_new_from_drawable (GimpDrawable *drawable, gimp_layer_new_from_drawable (GimpDrawable *drawable,
@ -237,7 +237,7 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_copy = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer_copy = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -304,7 +304,7 @@ _gimp_layer_new_from_drawable (gint32 drawable_ID,
* gimp_image_reorder_item(), gimp_item_get_parent(), * gimp_image_reorder_item(), gimp_item_get_parent(),
* gimp_item_get_children(), gimp_item_is_group(). * gimp_item_get_children(), gimp_item_is_group().
* *
* Returns: (transfer full): The newly created layer group. * Returns: (transfer none): The newly created layer group.
* *
* Since: 2.8 * Since: 2.8
**/ **/
@ -330,7 +330,7 @@ gimp_layer_group_new (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_group = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer_group = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -398,7 +398,7 @@ _gimp_layer_group_new (gint32 image_ID)
* the background layer in an image is being copied and added to the * the background layer in an image is being copied and added to the
* same image. * same image.
* *
* Returns: (transfer full): The newly copied layer. * Returns: (transfer none): The newly copied layer.
**/ **/
GimpLayer * GimpLayer *
_gimp_layer_copy (GimpLayer *layer, _gimp_layer_copy (GimpLayer *layer,
@ -424,7 +424,7 @@ _gimp_layer_copy (GimpLayer *layer,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer_copy = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer_copy = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1009,7 +1009,7 @@ _gimp_layer_set_offsets (gint32 layer_ID,
* 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with * 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with
* 'ADD-SELECTION-MASK' when there is no selection on the image. * 'ADD-SELECTION-MASK' when there is no selection on the image.
* *
* Returns: (transfer full): The newly created mask. * Returns: (transfer none): The newly created mask.
**/ **/
GimpLayerMask * GimpLayerMask *
gimp_layer_create_mask (GimpLayer *layer, gimp_layer_create_mask (GimpLayer *layer,
@ -1035,7 +1035,7 @@ gimp_layer_create_mask (GimpLayer *layer,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
mask = GIMP_LAYER_MASK (gimp_item_new_by_id (gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1)))); mask = GIMP_LAYER_MASK (gimp_item_get_by_id (gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1112,7 +1112,7 @@ _gimp_layer_create_mask (gint32 layer_ID,
* This procedure returns the specified layer's mask, or -1 if none * This procedure returns the specified layer's mask, or -1 if none
* exists. * exists.
* *
* Returns: (transfer full): The layer mask. * Returns: (transfer none): The layer mask.
**/ **/
GimpLayerMask * GimpLayerMask *
gimp_layer_get_mask (GimpLayer *layer) gimp_layer_get_mask (GimpLayer *layer)
@ -1136,7 +1136,7 @@ gimp_layer_get_mask (GimpLayer *layer)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
mask = GIMP_LAYER_MASK (gimp_item_new_by_id (gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1)))); mask = GIMP_LAYER_MASK (gimp_item_get_by_id (gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1192,7 +1192,7 @@ _gimp_layer_get_mask (gint32 layer_ID)
* This procedure returns the specified mask's layer , or -1 if none * This procedure returns the specified mask's layer , or -1 if none
* exists. * exists.
* *
* Returns: (transfer full): The mask's layer. * Returns: (transfer none): The mask's layer.
* *
* Since: 2.2 * Since: 2.2
**/ **/
@ -1218,7 +1218,7 @@ gimp_layer_from_mask (GimpLayerMask *mask)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -1447,11 +1447,11 @@ gimp_procedure_validate_args (GimpProcedure *procedure,
(arg_type == GIMP_TYPE_LAYER_ID && (arg_type == GIMP_TYPE_LAYER_ID &&
spec_type == GIMP_TYPE_LAYER)) spec_type == GIMP_TYPE_LAYER))
{ {
GValue value = G_VALUE_INIT; GValue value = G_VALUE_INIT;
GimpItem *item = gimp_item_new_by_id (g_value_get_int (arg));
g_value_init (&value, spec_type); g_value_init (&value, spec_type);
g_value_take_object (&value, item); g_value_set_object (&value,
gimp_item_get_by_id (g_value_get_int (arg)));
gimp_value_array_remove (args, i); gimp_value_array_remove (args, i);
gimp_value_array_insert (args, i, &value); gimp_value_array_insert (args, i, &value);
g_value_unset (&value); g_value_unset (&value);

View file

@ -36,6 +36,7 @@ static void
gimp_selection_init (GimpSelection *selection) gimp_selection_init (GimpSelection *selection)
{ {
} }
/** /**
* gimp_selection_float: * gimp_selection_float:
* @image: ignored * @image: ignored
@ -93,21 +94,15 @@ gimp_selection_float_deprecated (gint32 image_ID,
gint offx, gint offx,
gint offy) gint offy)
{ {
GimpDrawable *drawable; GimpLayer *selection;
GimpLayer *selection; gint32 selection_id = -1;
gint32 selection_id = -1;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
selection = gimp_selection_float (gimp_image_get_by_id (image_ID), selection = gimp_selection_float (gimp_image_get_by_id (image_ID),
drawable, GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID)),
offx, offx,
offy); offy);
if (selection) if (selection)
selection_id = gimp_item_get_id (GIMP_ITEM (selection)); selection_id = gimp_item_get_id (GIMP_ITEM (selection));
g_object_unref (drawable);
g_object_unref (selection);
return selection_id; return selection_id;
} }

View file

@ -457,7 +457,7 @@ _gimp_selection_translate (gint32 image_ID,
* instantiated as a floating selection. The offsets allow initial * instantiated as a floating selection. The offsets allow initial
* positioning of the new floating selection. * positioning of the new floating selection.
* *
* Returns: (transfer full): The floated layer. * Returns: (transfer none): The floated layer.
**/ **/
GimpLayer * GimpLayer *
_gimp_selection_float (GimpDrawable *drawable, _gimp_selection_float (GimpDrawable *drawable,
@ -485,7 +485,7 @@ _gimp_selection_float (GimpDrawable *drawable,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -1244,7 +1244,7 @@ _gimp_selection_flood (gint32 image_ID)
* new channel. The new channel is automatically inserted into the * new channel. The new channel is automatically inserted into the
* image's list of channels. * image's list of channels.
* *
* Returns: (transfer full): The new channel. * Returns: (transfer none): The new channel.
**/ **/
GimpChannel * GimpChannel *
gimp_selection_save (GimpImage *image) gimp_selection_save (GimpImage *image)
@ -1268,7 +1268,7 @@ gimp_selection_save (GimpImage *image)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
channel = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1)))); channel = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -51,7 +51,7 @@
* added to the image, as this is not automatic. Add the new layer * added to the image, as this is not automatic. Add the new layer
* using gimp_image_insert_layer(). * using gimp_image_insert_layer().
* *
* Returns: (transfer full): The new text layer. * Returns: (transfer none): The new text layer.
* *
* Since: 2.6 * Since: 2.6
**/ **/
@ -85,7 +85,7 @@ gimp_text_layer_new (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -64,7 +64,7 @@
* divide the size in points by 72.0 and multiply it by the image's * divide the size in points by 72.0 and multiply it by the image's
* vertical resolution. * vertical resolution.
* *
* Returns: (transfer full): The new text layer or -1 if no layer was created. * Returns: (transfer none): The new text layer or -1 if no layer was created.
**/ **/
GimpLayer * GimpLayer *
gimp_text_fontname (GimpImage *image, gimp_text_fontname (GimpImage *image,
@ -106,7 +106,7 @@ gimp_text_fontname (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
text_layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1)))); text_layer = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -44,7 +44,7 @@
* Creates a new empty vectors object. The vectors object needs to be * Creates a new empty vectors object. The vectors object needs to be
* added to the image using gimp_image_insert_vectors(). * added to the image using gimp_image_insert_vectors().
* *
* Returns: (transfer full): * Returns: (transfer none):
* the current vector object, 0 if no vector exists in the image. * the current vector object, 0 if no vector exists in the image.
* *
* Since: 2.4 * Since: 2.4
@ -73,7 +73,7 @@ gimp_vectors_new (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1)))); vectors = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -135,7 +135,7 @@ _gimp_vectors_new (gint32 image_ID,
* Creates a new vectors object from a text layer. The vectors object * Creates a new vectors object from a text layer. The vectors object
* needs to be added to the image using gimp_image_insert_vectors(). * needs to be added to the image using gimp_image_insert_vectors().
* *
* Returns: (transfer full): The vectors of the text layer. * Returns: (transfer none): The vectors of the text layer.
* *
* Since: 2.6 * Since: 2.6
**/ **/
@ -163,7 +163,7 @@ gimp_vectors_new_from_text_layer (GimpImage *image,
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1)))); vectors = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);
@ -224,7 +224,7 @@ _gimp_vectors_new_from_text_layer (gint32 image_ID,
* This procedure copies the specified vectors object and returns the * This procedure copies the specified vectors object and returns the
* copy. * copy.
* *
* Returns: (transfer full): The newly copied vectors object. * Returns: (transfer none): The newly copied vectors object.
* *
* Since: 2.6 * Since: 2.6
**/ **/
@ -250,7 +250,7 @@ gimp_vectors_copy (GimpVectors *vectors)
gimp_value_array_unref (args); gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS) if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
vectors_copy = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1)))); vectors_copy = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1))));
gimp_value_array_unref (return_vals); gimp_value_array_unref (return_vals);

View file

@ -547,7 +547,6 @@ gimp_zoom_preview_draw_buffer (GimpPreview *preview,
src_x + offsx, src_y + offsy, src_x + offsx, src_y + offsy,
src_width, src_height, src_width, src_height,
&width, &height, &bpp); &width, &height, &bpp);
g_object_unref (selection);
gimp_preview_area_mask (GIMP_PREVIEW_AREA (area), gimp_preview_area_mask (GIMP_PREVIEW_AREA (area),
0, 0, width, height, 0, 0, width, height,

View file

@ -185,9 +185,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpItem *', const_type => 'GimpItem *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_item ($value, gimp)', get_value_func => '$var = gimp_value_get_item ($value, gimp)',
dup_value_func => '$var = gimp_item_new_by_id (gimp_value_get_item_id ($value))', dup_value_func => '$var = gimp_item_get_by_id (gimp_value_get_item_id ($value))',
dup_value_func_d=> '$var = gimp_value_get_item_id ($value)', dup_value_func_d=> '$var = gimp_value_get_item_id ($value)',
set_value_func => 'gimp_value_set_item_id ($value, $var)', set_value_func => 'gimp_value_set_item_id ($value, $var)',
take_value_func => 'gimp_value_set_item ($value, $var)', take_value_func => 'gimp_value_set_item ($value, $var)',
@ -200,9 +200,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpLayer *', const_type => 'GimpLayer *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_layer ($value, gimp)', get_value_func => '$var = gimp_value_get_layer ($value, gimp)',
dup_value_func => '$var = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id ($value)))', dup_value_func => '$var = GIMP_LAYER (gimp_item_get_by_id (gimp_value_get_layer_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_layer_id ($value)', dup_value_func_d=> '$var = gimp_value_get_layer_id ($value)',
set_value_func => 'gimp_value_set_layer_id ($value, $var)', set_value_func => 'gimp_value_set_layer_id ($value, $var)',
take_value_func => 'gimp_value_set_layer ($value, $var)', take_value_func => 'gimp_value_set_layer ($value, $var)',
@ -215,9 +215,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpChannel *', const_type => 'GimpChannel *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_channel ($value, gimp)', get_value_func => '$var = gimp_value_get_channel ($value, gimp)',
dup_value_func => '$var = GIMP_CHANNEL (gimp_item_new_by_id (gimp_value_get_channel_id ($value)))', dup_value_func => '$var = GIMP_CHANNEL (gimp_item_get_by_id (gimp_value_get_channel_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_channel_id ($value)', dup_value_func_d=> '$var = gimp_value_get_channel_id ($value)',
set_value_func => 'gimp_value_set_channel_id ($value, $var)', set_value_func => 'gimp_value_set_channel_id ($value, $var)',
take_value_func => 'gimp_value_set_channel ($value, $var)', take_value_func => 'gimp_value_set_channel ($value, $var)',
@ -230,9 +230,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpDrawable *', const_type => 'GimpDrawable *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_drawable ($value, gimp)', get_value_func => '$var = gimp_value_get_drawable ($value, gimp)',
dup_value_func => '$var = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id ($value)))', dup_value_func => '$var = GIMP_DRAWABLE (gimp_item_get_by_id (gimp_value_get_drawable_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_drawable_id ($value)', dup_value_func_d=> '$var = gimp_value_get_drawable_id ($value)',
set_value_func => 'gimp_value_set_drawable_id ($value, $var)', set_value_func => 'gimp_value_set_drawable_id ($value, $var)',
take_value_func => 'gimp_value_set_drawable ($value, $var)', take_value_func => 'gimp_value_set_drawable ($value, $var)',
@ -245,9 +245,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpSelection *', const_type => 'GimpSelection *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_selection ($value, gimp)', get_value_func => '$var = gimp_value_get_selection ($value, gimp)',
dup_value_func => '$var = GIMP_SELECTION (gimp_item_new_by_id (gimp_value_get_selection_id ($value)))', dup_value_func => '$var = GIMP_SELECTION (gimp_item_get_by_id (gimp_value_get_selection_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_selection_id ($value)', dup_value_func_d=> '$var = gimp_value_get_selection_id ($value)',
set_value_func => 'gimp_value_set_selection_id ($value, $var)', set_value_func => 'gimp_value_set_selection_id ($value, $var)',
take_value_func => 'gimp_value_set_selection ($value, $var)', take_value_func => 'gimp_value_set_selection ($value, $var)',
@ -260,9 +260,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpLayerMask *', const_type => 'GimpLayerMask *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_layer_mask ($value, gimp)', get_value_func => '$var = gimp_value_get_layer_mask ($value, gimp)',
dup_value_func => '$var = GIMP_LAYER_MASK (gimp_item_new_by_id (gimp_value_get_layer_mask_id ($value)))', dup_value_func => '$var = GIMP_LAYER_MASK (gimp_item_get_by_id (gimp_value_get_layer_mask_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_layer_mask_id ($value)', dup_value_func_d=> '$var = gimp_value_get_layer_mask_id ($value)',
set_value_func => 'gimp_value_set_layer_mask_id ($value, $var)', set_value_func => 'gimp_value_set_layer_mask_id ($value, $var)',
take_value_func => 'gimp_value_set_layer_mask ($value, $var)', take_value_func => 'gimp_value_set_layer_mask ($value, $var)',
@ -275,9 +275,9 @@ package Gimp::CodeGen::pdb;
const_type => 'GimpVectors *', const_type => 'GimpVectors *',
id => 1, id => 1,
init_value => 'NULL', init_value => 'NULL',
out_annotate => '(transfer full)', out_annotate => '(transfer none)',
get_value_func => '$var = gimp_value_get_vectors ($value, gimp)', get_value_func => '$var = gimp_value_get_vectors ($value, gimp)',
dup_value_func => '$var = GIMP_VECTORS (gimp_item_new_by_id (gimp_value_get_vectors_id ($value)))', dup_value_func => '$var = GIMP_VECTORS (gimp_item_get_by_id (gimp_value_get_vectors_id ($value)))',
dup_value_func_d=> '$var = gimp_value_get_vectors_id ($value)', dup_value_func_d=> '$var = gimp_value_get_vectors_id ($value)',
set_value_func => 'gimp_value_set_vectors_id ($value, $var)', set_value_func => 'gimp_value_set_vectors_id ($value, $var)',
take_value_func => 'gimp_value_set_vectors ($value, $var)', take_value_func => 'gimp_value_set_vectors ($value, $var)',

View file

@ -150,17 +150,14 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_id = param[2].data.d_drawable; drawable_id = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_id)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_id));
switch (run_mode) switch (run_mode)
{ {
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:
gimp_get_data (PLUG_IN_PROC, &bvals); gimp_get_data (PLUG_IN_PROC, &bvals);
if (! blinds_dialog (drawable)) if (! blinds_dialog (drawable))
{ return;
g_object_unref (drawable);
return;
}
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -202,7 +199,6 @@ run (const gchar *name,
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }
g_object_unref (drawable);
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View file

@ -130,17 +130,14 @@ run (const gchar *name,
image_ID = param[1].data.d_int32; image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_drawable; drawable_ID = param[2].data.d_drawable;
image = gimp_image_get_by_id (image_ID); image = gimp_image_get_by_id (image_ID);
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
switch (run_mode) switch (run_mode)
{ {
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:
gimp_get_data (PLUG_IN_PROC, &cvals); gimp_get_data (PLUG_IN_PROC, &cvals);
if (! checkerboard_dialog (image, drawable)) if (! checkerboard_dialog (image, drawable))
{ return;
g_object_unref (drawable);
return;
}
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -177,7 +174,6 @@ run (const gchar *name,
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }
g_object_unref (drawable);
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View file

@ -199,7 +199,7 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_ID = param[2].data.d_drawable; drawable_ID = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
if (! gimp_drawable_mask_intersect (drawable, if (! gimp_drawable_mask_intersect (drawable,
&x, &y, &width, &height) || &x, &y, &width, &height) ||
@ -208,7 +208,6 @@ run (const gchar *name,
{ {
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
values[0].data.d_status = status; values[0].data.d_status = status;
g_object_unref (drawable);
return; return;
} }
@ -220,10 +219,7 @@ run (const gchar *name,
/* First acquire information with a dialog */ /* First acquire information with a dialog */
if (! retinex_dialog (drawable)) if (! retinex_dialog (drawable))
{ return;
g_object_unref (drawable);
return;
}
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -268,7 +264,6 @@ run (const gchar *name,
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }
g_object_unref (drawable);
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View file

@ -188,7 +188,7 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_ID = param[2].data.d_drawable; drawable_ID = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
switch (run_mode) switch (run_mode)
{ {
@ -199,10 +199,7 @@ run (const gchar *name,
gimp_drawable_is_gray (drawable)) gimp_drawable_is_gray (drawable))
{ {
if (! despeckle_dialog ()) if (! despeckle_dialog ())
{ return;
g_object_unref (drawable);
return;
}
} }
break; break;
@ -270,7 +267,6 @@ run (const gchar *name,
} }
} }
g_object_unref (drawable);
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View file

@ -143,7 +143,7 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_ID = param[2].data.d_drawable; drawable_ID = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
switch (run_mode) switch (run_mode)
{ {
@ -157,10 +157,7 @@ run (const gchar *name,
* Get information from the dialog... * Get information from the dialog...
*/ */
if (! destripe_dialog (drawable)) if (! destripe_dialog (drawable))
{ return;
g_object_unref (drawable);
return;
}
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -217,8 +214,6 @@ run (const gchar *name,
} }
}; };
g_object_unref (drawable);
/* /*
* Reset the current run status... * Reset the current run status...
*/ */

View file

@ -179,7 +179,7 @@ run (const gchar *name,
image_ID = param[1].data.d_int32; image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_drawable; drawable_ID = param[2].data.d_drawable;
image = gimp_image_get_by_id (image_ID); image = gimp_image_get_by_id (image_ID);
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
if (run_mode == GIMP_RUN_NONINTERACTIVE) if (run_mode == GIMP_RUN_NONINTERACTIVE)
{ {
@ -254,8 +254,6 @@ run (const gchar *name,
gimp_set_data (PLUG_IN_PROC, &grid_cfg, sizeof (grid_cfg)); gimp_set_data (PLUG_IN_PROC, &grid_cfg, sizeof (grid_cfg));
} }
g_object_unref (drawable);
values[0].type = GIMP_PDB_STATUS; values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View file

@ -387,7 +387,7 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_id = param[2].data.d_drawable; drawable_id = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_id)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_id));
switch (run_mode) switch (run_mode)
{ {
@ -428,8 +428,6 @@ run (const gchar *name,
gimp_displays_flush (); gimp_displays_flush ();
} /* switch */ } /* switch */
g_object_unref (drawable);
*nreturn_vals = 1; *nreturn_vals = 1;
*return_vals = values; *return_vals = values;
values[0].type = GIMP_PDB_STATUS; values[0].type = GIMP_PDB_STATUS;

View file

@ -153,7 +153,7 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_id = param[2].data.d_drawable; drawable_id = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_id)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_id));
*nreturn_vals = 1; *nreturn_vals = 1;
*return_vals = values; *return_vals = values;
@ -167,10 +167,7 @@ run (const gchar *name,
gimp_get_data (PLUG_IN_PROC, &nlfvals); gimp_get_data (PLUG_IN_PROC, &nlfvals);
if (! nlfilter_dialog (drawable)) if (! nlfilter_dialog (drawable))
{ return;
g_object_unref (drawable);
return;
}
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -204,7 +201,6 @@ run (const gchar *name,
gimp_set_data (PLUG_IN_PROC, &nlfvals, sizeof (NLFilterValues)); gimp_set_data (PLUG_IN_PROC, &nlfvals, sizeof (NLFilterValues));
} }
g_object_unref (drawable);
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View file

@ -216,12 +216,11 @@ run (const gchar *name,
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
drawable_ID = param[2].data.d_drawable; drawable_ID = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID)); drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h)) if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
{ {
g_message (_("Region selected for filter is empty")); g_message (_("Region selected for filter is empty"));
g_object_unref (drawable);
return; return;
} }
@ -233,10 +232,7 @@ run (const gchar *name,
/* First acquire information with a dialog */ /* First acquire information with a dialog */
if (! sparkle_dialog (drawable)) if (! sparkle_dialog (drawable))
{ return;
g_object_unref (drawable);
return;
}
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
@ -315,7 +311,6 @@ run (const gchar *name,
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
} }
g_object_unref (drawable);
values[0].data.d_status = status; values[0].data.d_status = status;
} }