mirror of https://github.com/GNOME/gimp.git
libgimp: s/gimp_image_new_by_id()/gimp_image_get_by_id()/
This means that images' ownership is not given to caller in particular. libgimp will now keep a reference of all GimpImage-s it creates and return this same reference if called again. It also means that you can now compare images by pointer comparison (as 2 GimpImage objects representing the same image ID will be equal). Obviously as a side effect, gimp_image_list() is changed to (transfer container) as you must only free the container now, not the elements. Also various other functions creating new images are now (transfer none) too. Long-time plug-ins will have to be taken in consideration in a further step (we currently never free GimpImage for destroyed images in particular).
This commit is contained in:
parent
8559cee053
commit
cfd30ec62a
|
@ -339,7 +339,6 @@ gimp_aspect_preview_draw_buffer (GimpPreview *preview,
|
||||||
g_free (sel);
|
g_free (sel);
|
||||||
g_free (src);
|
g_free (src);
|
||||||
}
|
}
|
||||||
g_object_unref (image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -111,15 +111,14 @@ gimp_channel_new_deprecated (gint32 image_id,
|
||||||
gdouble opacity,
|
gdouble opacity,
|
||||||
const GimpRGB *color)
|
const GimpRGB *color)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
|
||||||
GimpChannel *channel;
|
GimpChannel *channel;
|
||||||
gint32 channel_id;
|
gint32 channel_id;
|
||||||
|
|
||||||
channel = gimp_channel_new (image, name, width, height,
|
channel = gimp_channel_new (gimp_image_get_by_id (image_id),
|
||||||
|
name, width, height,
|
||||||
opacity, color);
|
opacity, color);
|
||||||
channel_id = gimp_item_get_id (GIMP_ITEM (channel));
|
channel_id = gimp_item_get_id (GIMP_ITEM (channel));
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
g_object_unref (channel);
|
g_object_unref (channel);
|
||||||
|
|
||||||
return channel_id;
|
return channel_id;
|
||||||
|
|
|
@ -347,7 +347,6 @@ gimp_drawable_get_format (GimpDrawable *drawable)
|
||||||
format = babl_format_with_space (format_str, space);
|
format = babl_format_with_space (format_str, space);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
g_free (format_str);
|
g_free (format_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,6 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
|
||||||
default:
|
default:
|
||||||
g_free (sel);
|
g_free (sel);
|
||||||
g_free (src);
|
g_free (src);
|
||||||
g_object_unref (image);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +505,6 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
|
||||||
g_free (src);
|
g_free (src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_object_unref (image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -552,7 +550,6 @@ gimp_drawable_preview_set_drawable (GimpDrawablePreview *drawable_preview,
|
||||||
cmap = gimp_image_get_colormap (image, &num_colors);
|
cmap = gimp_image_get_colormap (image, &num_colors);
|
||||||
gimp_preview_area_set_colormap (GIMP_PREVIEW_AREA (area),
|
gimp_preview_area_set_colormap (GIMP_PREVIEW_AREA (area),
|
||||||
cmap, num_colors);
|
cmap, num_colors);
|
||||||
g_object_unref (image);
|
|
||||||
g_free (cmap);
|
g_free (cmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,7 +432,7 @@ _gimp_edit_paste (gint32 drawable_ID,
|
||||||
* previously made to either gimp_edit_cut() or gimp_edit_copy(). This
|
* previously made to either gimp_edit_cut() or gimp_edit_copy(). This
|
||||||
* procedure returns the new image or -1 if the edit buffer was empty.
|
* procedure returns the new image or -1 if the edit buffer was empty.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The new image.
|
* Returns: (transfer none): The new image.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
|
@ -457,7 +457,7 @@ gimp_edit_paste_as_new_image (void)
|
||||||
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)
|
||||||
image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ _gimp_edit_named_paste (gint32 drawable_ID,
|
||||||
* This procedure works like gimp_edit_paste_as_new_image() but pastes
|
* This procedure works like gimp_edit_paste_as_new_image() but pastes
|
||||||
* a named buffer instead of the global buffer.
|
* a named buffer instead of the global buffer.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The new image.
|
* Returns: (transfer none): The new image.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
|
@ -928,7 +928,7 @@ gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
|
||||||
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)
|
||||||
image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
|
|
@ -1147,28 +1147,22 @@ gimp_export_image_deprecated (gint32 *image_ID,
|
||||||
GimpExportCapabilities capabilities)
|
GimpExportCapabilities capabilities)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GimpImage *new_image;
|
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpDrawable *new_drawable;
|
GimpDrawable *new_drawable;
|
||||||
GimpExportReturn retval;
|
GimpExportReturn retval;
|
||||||
|
|
||||||
image = gimp_image_new_by_id (*image_ID);
|
image = gimp_image_get_by_id (*image_ID);
|
||||||
new_image = image;
|
|
||||||
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (*drawable_ID));
|
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (*drawable_ID));
|
||||||
new_drawable = drawable;
|
new_drawable = drawable;
|
||||||
|
|
||||||
retval = gimp_export_image (&new_image, &new_drawable,
|
retval = gimp_export_image (&image, &new_drawable,
|
||||||
format_name, capabilities);
|
format_name, capabilities);
|
||||||
|
|
||||||
*image_ID = gimp_image_get_id (new_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 (new_drawable));
|
||||||
if (retval == GIMP_EXPORT_EXPORT)
|
if (retval == GIMP_EXPORT_EXPORT)
|
||||||
{
|
g_object_unref (new_drawable);
|
||||||
g_object_unref (new_image);
|
|
||||||
g_object_unref (new_drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
g_object_unref (drawable);
|
g_object_unref (drawable);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
* https://www.gimp.org/foo.png he wants to fetch a URL, and the full
|
* https://www.gimp.org/foo.png he wants to fetch a URL, and the full
|
||||||
* pathname will not look like a URL.
|
* pathname will not look like a URL.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The output image.
|
* Returns: (transfer none): The output image.
|
||||||
**/
|
**/
|
||||||
GimpImage *
|
GimpImage *
|
||||||
gimp_file_load (GimpRunMode run_mode,
|
gimp_file_load (GimpRunMode run_mode,
|
||||||
|
@ -78,7 +78,7 @@ gimp_file_load (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)
|
||||||
image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@ struct _GimpImagePrivate
|
||||||
gint id;
|
gint id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static GHashTable *gimp_images = NULL;
|
||||||
|
|
||||||
|
|
||||||
static void gimp_image_set_property (GObject *object,
|
static void gimp_image_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
|
@ -131,29 +134,49 @@ gimp_image_get_property (GObject *object,
|
||||||
gint32
|
gint32
|
||||||
gimp_image_get_id (GimpImage *image)
|
gimp_image_get_id (GimpImage *image)
|
||||||
{
|
{
|
||||||
return image->priv->id;
|
return image ? image->priv->id : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_image_new_by_id:
|
* gimp_image_get_by_id:
|
||||||
* @image_id: The image id.
|
* @image_id: The image id.
|
||||||
*
|
*
|
||||||
* Returns: (nullable) (transfer full): a #GimpImage for @image_id or
|
* Returns: (nullable) (transfer none): a #GimpImage for @image_id or
|
||||||
* %NULL if @image_id does not represent a valid image.
|
* %NULL if @image_id does not represent a valid image.
|
||||||
|
* The object belongs to libgimp and you should not free it.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
GimpImage *
|
GimpImage *
|
||||||
gimp_image_new_by_id (gint32 image_id)
|
gimp_image_get_by_id (gint32 image_id)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image = NULL;
|
||||||
|
|
||||||
image = g_object_new (GIMP_TYPE_IMAGE,
|
if (G_UNLIKELY (! gimp_images))
|
||||||
"id", image_id,
|
gimp_images = g_hash_table_new_full (g_direct_hash,
|
||||||
NULL);
|
g_direct_equal,
|
||||||
|
NULL,
|
||||||
|
(GDestroyNotify) g_object_unref);
|
||||||
|
|
||||||
if (! gimp_image_is_valid (image))
|
if (! _gimp_image_is_valid (image_id))
|
||||||
g_clear_object (&image);
|
{
|
||||||
|
g_hash_table_remove (gimp_images, GINT_TO_POINTER (image_id));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image = g_hash_table_lookup (gimp_images,
|
||||||
|
GINT_TO_POINTER (image_id));
|
||||||
|
|
||||||
|
if (! image)
|
||||||
|
{
|
||||||
|
image = g_object_new (GIMP_TYPE_IMAGE,
|
||||||
|
"id", image_id,
|
||||||
|
NULL);
|
||||||
|
g_hash_table_insert (gimp_images,
|
||||||
|
GINT_TO_POINTER (image_id),
|
||||||
|
image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
@ -165,10 +188,10 @@ gimp_image_new_by_id (gint32 image_id)
|
||||||
*
|
*
|
||||||
* This procedure returns the list of images currently open in GIMP.
|
* This procedure returns the list of images currently open in GIMP.
|
||||||
*
|
*
|
||||||
* Returns: (element-type GimpImage) (transfer full):
|
* Returns: (element-type GimpImage) (transfer container):
|
||||||
* The list of images currently open.
|
* The list of images currently open.
|
||||||
* The returned value must be freed with:
|
* The returned value must be freed with g_list_free(). Image
|
||||||
* g_list_free_full(list, g_object_unref);
|
* elements belong to libgimp and must not be freed.
|
||||||
**/
|
**/
|
||||||
GList *
|
GList *
|
||||||
gimp_image_list (void)
|
gimp_image_list (void)
|
||||||
|
@ -180,13 +203,8 @@ gimp_image_list (void)
|
||||||
|
|
||||||
ids = _gimp_image_list (&num_images);
|
ids = _gimp_image_list (&num_images);
|
||||||
for (i = 0; i < num_images; i++)
|
for (i = 0; i < num_images; i++)
|
||||||
{
|
images = g_list_prepend (images,
|
||||||
GimpImage *image;
|
gimp_image_get_by_id (ids[i]));
|
||||||
|
|
||||||
image = gimp_image_new_by_id (ids[i]);
|
|
||||||
|
|
||||||
images = g_list_prepend (images, image);
|
|
||||||
}
|
|
||||||
images = g_list_reverse (images);
|
images = g_list_reverse (images);
|
||||||
g_free (ids);
|
g_free (ids);
|
||||||
|
|
||||||
|
@ -547,14 +565,8 @@ gint *
|
||||||
gimp_image_get_layers_deprecated (gint32 image_id,
|
gimp_image_get_layers_deprecated (gint32 image_id,
|
||||||
gint *num_layers)
|
gint *num_layers)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
return _gimp_image_get_layers (gimp_image_get_by_id (image_id),
|
||||||
gint *layers;
|
num_layers);
|
||||||
|
|
||||||
image = gimp_image_new_by_id (image_id);
|
|
||||||
layers = _gimp_image_get_layers (image, num_layers);
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return layers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -578,14 +590,8 @@ gint *
|
||||||
gimp_image_get_channels_deprecated (gint32 image_id,
|
gimp_image_get_channels_deprecated (gint32 image_id,
|
||||||
gint *num_channels)
|
gint *num_channels)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
return _gimp_image_get_layers (gimp_image_get_by_id (image_id),
|
||||||
gint *channels;
|
num_channels);
|
||||||
|
|
||||||
image = gimp_image_new_by_id (image_id);
|
|
||||||
channels = _gimp_image_get_layers (image, num_channels);
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return channels;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -608,14 +614,8 @@ gint *
|
||||||
gimp_image_get_vectors_deprecated (gint32 image_id,
|
gimp_image_get_vectors_deprecated (gint32 image_id,
|
||||||
gint *num_vectors)
|
gint *num_vectors)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
return _gimp_image_get_vectors (gimp_image_get_by_id (image_id),
|
||||||
gint *vectors;
|
num_vectors);
|
||||||
|
|
||||||
image = gimp_image_new_by_id (image_id);
|
|
||||||
vectors = _gimp_image_get_vectors (image, num_vectors);
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return vectors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -635,14 +635,8 @@ guchar *
|
||||||
gimp_image_get_colormap_deprecated (gint32 image_id,
|
gimp_image_get_colormap_deprecated (gint32 image_id,
|
||||||
gint *num_colors)
|
gint *num_colors)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_get_colormap (gimp_image_get_by_id (image_id),
|
||||||
guchar *colormap;
|
num_colors);
|
||||||
|
|
||||||
colormap = gimp_image_get_colormap (image, num_colors);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return colormap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -665,14 +659,8 @@ gimp_image_set_colormap_deprecated (gint32 image_id,
|
||||||
const guchar *colormap,
|
const guchar *colormap,
|
||||||
gint num_colors)
|
gint num_colors)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_set_colormap (gimp_image_get_by_id (image_id),
|
||||||
gboolean success;
|
colormap, num_colors);
|
||||||
|
|
||||||
success = gimp_image_set_colormap (image, colormap, num_colors);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -697,14 +685,8 @@ gimp_image_get_thumbnail_data_deprecated (gint32 image_id,
|
||||||
gint *height,
|
gint *height,
|
||||||
gint *bpp)
|
gint *bpp)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_get_thumbnail_data (gimp_image_get_by_id (image_id),
|
||||||
guchar *thumbdata;
|
width, height, bpp);
|
||||||
|
|
||||||
thumbdata = gimp_image_get_thumbnail_data (image, width, height, bpp);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return thumbdata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -727,14 +709,8 @@ gimp_image_get_thumbnail_deprecated (gint32 image_id,
|
||||||
gint height,
|
gint height,
|
||||||
GimpPixbufTransparency alpha)
|
GimpPixbufTransparency alpha)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_get_thumbnail (gimp_image_get_by_id (image_id),
|
||||||
GdkPixbuf *thumbnail;
|
width, height, alpha);
|
||||||
|
|
||||||
thumbnail = gimp_image_get_thumbnail (image, width, height, alpha);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return thumbnail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -753,14 +729,7 @@ gimp_image_get_thumbnail_deprecated (gint32 image_id,
|
||||||
GimpMetadata *
|
GimpMetadata *
|
||||||
gimp_image_get_metadata_deprecated (gint32 image_id)
|
gimp_image_get_metadata_deprecated (gint32 image_id)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_get_metadata (gimp_image_get_by_id (image_id));
|
||||||
GimpMetadata *metadata;
|
|
||||||
|
|
||||||
metadata = gimp_image_get_metadata (image);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -781,12 +750,6 @@ gboolean
|
||||||
gimp_image_set_metadata_deprecated (gint32 image_id,
|
gimp_image_set_metadata_deprecated (gint32 image_id,
|
||||||
GimpMetadata *metadata)
|
GimpMetadata *metadata)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_set_metadata (gimp_image_get_by_id (image_id),
|
||||||
gboolean success;
|
metadata);
|
||||||
|
|
||||||
success = gimp_image_set_metadata (image, metadata);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct _GimpImageClass
|
||||||
GType gimp_image_get_type (void) G_GNUC_CONST;
|
GType gimp_image_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gint32 gimp_image_get_id (GimpImage *image);
|
gint32 gimp_image_get_id (GimpImage *image);
|
||||||
GimpImage * gimp_image_new_by_id (gint32 image_id);
|
GimpImage * gimp_image_get_by_id (gint32 image_id);
|
||||||
|
|
||||||
GList * gimp_image_list (void);
|
GList * gimp_image_list (void);
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ _gimp_image_list (gint *num_images)
|
||||||
* gimp_image_set_colormap(). An indexed image without a colormap will
|
* gimp_image_set_colormap(). An indexed image without a colormap will
|
||||||
* output unexpected colors.
|
* output unexpected colors.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The newly created image.
|
* Returns: (transfer none): The newly created image.
|
||||||
**/
|
**/
|
||||||
GimpImage *
|
GimpImage *
|
||||||
gimp_image_new (gint width,
|
gimp_image_new (gint width,
|
||||||
|
@ -211,7 +211,7 @@ gimp_image_new (gint width,
|
||||||
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)
|
||||||
image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ _gimp_image_new (gint width,
|
||||||
* GIMP_PRECISION_U8_NON_LINEAR precision. See gimp_image_new() for
|
* GIMP_PRECISION_U8_NON_LINEAR precision. See gimp_image_new() for
|
||||||
* further details.
|
* further details.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The newly created image.
|
* Returns: (transfer none): The newly created image.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
|
@ -319,7 +319,7 @@ gimp_image_new_with_precision (gint width,
|
||||||
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)
|
||||||
image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ _gimp_image_new_with_precision (gint width,
|
||||||
* This procedure duplicates the specified image, copying all layers,
|
* This procedure duplicates the specified image, copying all layers,
|
||||||
* channels, and image information.
|
* channels, and image information.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The new, duplicated image.
|
* Returns: (transfer none): The new, duplicated image.
|
||||||
**/
|
**/
|
||||||
GimpImage *
|
GimpImage *
|
||||||
gimp_image_duplicate (GimpImage *image)
|
gimp_image_duplicate (GimpImage *image)
|
||||||
|
@ -413,7 +413,7 @@ gimp_image_duplicate (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)
|
||||||
new_image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
new_image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
|
|
@ -191,14 +191,7 @@ gimp_image_convert_color_profile (GimpImage *image,
|
||||||
GimpColorProfile *
|
GimpColorProfile *
|
||||||
gimp_image_get_color_profile_deprecated (gint32 image_id)
|
gimp_image_get_color_profile_deprecated (gint32 image_id)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_get_color_profile (gimp_image_get_by_id (image_id));
|
||||||
GimpColorProfile *profile;
|
|
||||||
|
|
||||||
profile = gimp_image_get_color_profile (image);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return profile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,14 +209,8 @@ gboolean
|
||||||
gimp_image_set_color_profile_deprecated (gint32 image_id,
|
gimp_image_set_color_profile_deprecated (gint32 image_id,
|
||||||
GimpColorProfile *profile)
|
GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_set_color_profile (gimp_image_get_by_id (image_id),
|
||||||
gboolean success;
|
profile);
|
||||||
|
|
||||||
success = gimp_image_set_color_profile (image, profile);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -245,14 +232,7 @@ gimp_image_set_color_profile_deprecated (gint32 image_id,
|
||||||
GimpColorProfile *
|
GimpColorProfile *
|
||||||
gimp_image_get_effective_color_profile_deprecated (gint32 image_id)
|
gimp_image_get_effective_color_profile_deprecated (gint32 image_id)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_get_effective_color_profile (gimp_image_get_by_id (image_id));
|
||||||
GimpColorProfile *profile;
|
|
||||||
|
|
||||||
profile = gimp_image_get_effective_color_profile (image);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return profile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -276,12 +256,6 @@ gimp_image_convert_color_profile_deprecated (gint32 image_id,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc)
|
gboolean bpc)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_convert_color_profile (gimp_image_get_by_id (image_id),
|
||||||
gboolean success;
|
profile, intent, bpc);
|
||||||
|
|
||||||
success = gimp_image_convert_color_profile (image, profile, intent, bpc);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ gimp_image_combo_box_populate (GimpImageComboBox *combo_box)
|
||||||
combo_box->constraint_d,
|
combo_box->constraint_d,
|
||||||
combo_box->data);
|
combo_box->data);
|
||||||
|
|
||||||
g_list_free_full (images, g_object_unref);
|
g_list_free (images);
|
||||||
|
|
||||||
if (gtk_tree_model_get_iter_first (model, &iter))
|
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||||
|
@ -288,10 +288,7 @@ gimp_image_combo_box_changed (GimpImageComboBox *combo_box)
|
||||||
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo_box),
|
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo_box),
|
||||||
&image_ID))
|
&image_ID))
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
if (! _gimp_image_is_valid (image_ID))
|
||||||
|
|
||||||
image = gimp_image_new_by_id (image_ID);
|
|
||||||
if (! gimp_image_is_valid (image))
|
|
||||||
{
|
{
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
|
||||||
|
@ -302,7 +299,6 @@ gimp_image_combo_box_changed (GimpImageComboBox *combo_box)
|
||||||
gtk_list_store_clear (GTK_LIST_STORE (model));
|
gtk_list_store_clear (GTK_LIST_STORE (model));
|
||||||
gimp_image_combo_box_populate (combo_box);
|
gimp_image_combo_box_populate (combo_box);
|
||||||
}
|
}
|
||||||
g_object_unref (image);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -666,7 +666,7 @@ gimp_image_metadata_save_finish (GimpImage *image,
|
||||||
*
|
*
|
||||||
* Retrieves a thumbnail from metadata if present.
|
* Retrieves a thumbnail from metadata if present.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): a #GimpImage of the @file thumbnail.
|
* Returns: (transfer none) (nullable): a #GimpImage of the @file thumbnail.
|
||||||
*/
|
*/
|
||||||
GimpImage *
|
GimpImage *
|
||||||
gimp_image_metadata_load_thumbnail (GFile *file,
|
gimp_image_metadata_load_thumbnail (GFile *file,
|
||||||
|
@ -705,8 +705,8 @@ gimp_image_metadata_load_thumbnail (GFile *file,
|
||||||
GimpLayer *layer;
|
GimpLayer *layer;
|
||||||
|
|
||||||
image = gimp_image_new (gdk_pixbuf_get_width (pixbuf),
|
image = gimp_image_new (gdk_pixbuf_get_width (pixbuf),
|
||||||
gdk_pixbuf_get_height (pixbuf),
|
gdk_pixbuf_get_height (pixbuf),
|
||||||
GIMP_RGB);
|
GIMP_RGB);
|
||||||
gimp_image_undo_disable (image);
|
gimp_image_undo_disable (image);
|
||||||
|
|
||||||
layer = gimp_layer_new_from_pixbuf (image, _("Background"),
|
layer = gimp_layer_new_from_pixbuf (image, _("Background"),
|
||||||
|
@ -1059,14 +1059,8 @@ gimp_image_metadata_load_prepare_deprecated (gint32 image_id,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_metadata_load_prepare (gimp_image_get_by_id (image_id),
|
||||||
GimpMetadata *metadata;
|
mime_type, file, error);
|
||||||
|
|
||||||
metadata = gimp_image_metadata_load_prepare (image, mime_type, file, error);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1090,10 +1084,8 @@ gimp_image_metadata_load_finish_deprecated (gint32 image_id,
|
||||||
GimpMetadataLoadFlags flags,
|
GimpMetadataLoadFlags flags,
|
||||||
gboolean interactive)
|
gboolean interactive)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
gimp_image_metadata_load_finish (gimp_image_get_by_id (image_id),
|
||||||
|
mime_type, metadata, flags, interactive);
|
||||||
gimp_image_metadata_load_finish (image, mime_type, metadata, flags, interactive);
|
|
||||||
g_object_unref (image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1127,14 +1119,8 @@ gimp_image_metadata_save_prepare_deprecated (gint32 image_id,
|
||||||
const gchar *mime_type,
|
const gchar *mime_type,
|
||||||
GimpMetadataSaveFlags *suggested_flags)
|
GimpMetadataSaveFlags *suggested_flags)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_metadata_save_prepare (gimp_image_get_by_id (image_id),
|
||||||
GimpMetadata *metadata;
|
mime_type, suggested_flags);
|
||||||
|
|
||||||
metadata = gimp_image_metadata_save_prepare (image, mime_type, suggested_flags);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1162,15 +1148,9 @@ gimp_image_metadata_save_finish_deprecated (gint32 image_id,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
return gimp_image_metadata_save_finish (gimp_image_get_by_id (image_id),
|
||||||
gboolean success;
|
mime_type, metadata,
|
||||||
|
flags, file, error);
|
||||||
success = gimp_image_metadata_save_finish (image, mime_type, metadata,
|
|
||||||
flags, file, error);
|
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1187,11 +1167,8 @@ gimp_image_metadata_load_thumbnail_deprecated (GFile *file,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
gint32 image_id;
|
|
||||||
|
|
||||||
image = gimp_image_metadata_load_thumbnail (file, error);
|
image = gimp_image_metadata_load_thumbnail (file, error);
|
||||||
image_id = gimp_image_get_id (image);
|
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return image_id;
|
return gimp_image_get_id (image);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ _gimp_item_is_valid (gint32 item_ID)
|
||||||
*
|
*
|
||||||
* This procedure returns the item's image.
|
* This procedure returns the item's image.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): The item's image.
|
* Returns: (transfer none): The item's image.
|
||||||
*
|
*
|
||||||
* Since: 2.8
|
* Since: 2.8
|
||||||
**/
|
**/
|
||||||
|
@ -152,7 +152,7 @@ gimp_item_get_image (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)
|
||||||
image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
image = gimp_image_get_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
|
||||||
|
|
||||||
gimp_value_array_unref (return_vals);
|
gimp_value_array_unref (return_vals);
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,7 @@ gimp_item_combo_box_populate (GimpIntComboBox *combo_box)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free_full (images, g_object_unref);
|
g_list_free (images);
|
||||||
|
|
||||||
if (gtk_tree_model_get_iter_first (model, &iter))
|
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||||
|
|
|
@ -297,15 +297,14 @@ gimp_layer_new_deprecated (gint32 image_id,
|
||||||
gdouble opacity,
|
gdouble opacity,
|
||||||
GimpLayerMode mode)
|
GimpLayerMode mode)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
|
||||||
GimpLayer *layer;
|
GimpLayer *layer;
|
||||||
gint32 layer_id;
|
gint32 layer_id;
|
||||||
|
|
||||||
layer = gimp_layer_new (image, name, width, height,
|
layer = gimp_layer_new (gimp_image_get_by_id (image_id),
|
||||||
|
name, width, height,
|
||||||
type, opacity, mode);
|
type, opacity, mode);
|
||||||
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
|
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
g_object_unref (layer);
|
g_object_unref (layer);
|
||||||
|
|
||||||
return layer_id;
|
return layer_id;
|
||||||
|
@ -344,15 +343,14 @@ gimp_layer_new_from_pixbuf_deprecated (gint32 image_id,
|
||||||
gdouble progress_start,
|
gdouble progress_start,
|
||||||
gdouble progress_end)
|
gdouble progress_end)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
|
||||||
GimpLayer *layer;
|
GimpLayer *layer;
|
||||||
gint32 layer_id;
|
gint32 layer_id;
|
||||||
|
|
||||||
layer = gimp_layer_new_from_pixbuf (image, name, pixbuf, opacity, mode,
|
layer = gimp_layer_new_from_pixbuf (gimp_image_get_by_id (image_id),
|
||||||
|
name, pixbuf, opacity, mode,
|
||||||
progress_start, progress_end);
|
progress_start, progress_end);
|
||||||
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
|
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
g_object_unref (layer);
|
g_object_unref (layer);
|
||||||
|
|
||||||
return layer_id;
|
return layer_id;
|
||||||
|
@ -387,15 +385,14 @@ gimp_layer_new_from_surface_deprecated (gint32 image_id,
|
||||||
gdouble progress_start,
|
gdouble progress_start,
|
||||||
gdouble progress_end)
|
gdouble progress_end)
|
||||||
{
|
{
|
||||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
|
||||||
GimpLayer *layer;
|
GimpLayer *layer;
|
||||||
gint32 layer_id;
|
gint32 layer_id;
|
||||||
|
|
||||||
layer = gimp_layer_new_from_surface (image, name, surface,
|
layer = gimp_layer_new_from_surface (gimp_image_get_by_id (image_id),
|
||||||
|
name, surface,
|
||||||
progress_start, progress_end);
|
progress_start, progress_end);
|
||||||
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
|
layer_id = gimp_item_get_id (GIMP_ITEM (layer));
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
g_object_unref (layer);
|
g_object_unref (layer);
|
||||||
|
|
||||||
return layer_id;
|
return layer_id;
|
||||||
|
|
|
@ -116,20 +116,16 @@ gimp_param_image_id_validate (GParamSpec *pspec,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GimpParamSpecImageID *ispec = GIMP_PARAM_SPEC_IMAGE_ID (pspec);
|
GimpParamSpecImageID *ispec = GIMP_PARAM_SPEC_IMAGE_ID (pspec);
|
||||||
GimpImage *image;
|
|
||||||
gint image_id = value->data[0].v_int;
|
gint image_id = value->data[0].v_int;
|
||||||
|
|
||||||
if (ispec->none_ok && (image_id == 0 || image_id == -1))
|
if (ispec->none_ok && (image_id == 0 || image_id == -1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
image = gimp_image_new_by_id (image_id);
|
if (! _gimp_image_is_valid (image_id))
|
||||||
if (! gimp_image_is_valid (image))
|
|
||||||
{
|
{
|
||||||
value->data[0].v_int = -1;
|
value->data[0].v_int = -1;
|
||||||
g_object_unref (image);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
g_object_unref (image);
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1431,11 +1431,11 @@ gimp_procedure_validate_args (GimpProcedure *procedure,
|
||||||
if (arg_type == GIMP_TYPE_IMAGE_ID &&
|
if (arg_type == GIMP_TYPE_IMAGE_ID &&
|
||||||
spec_type == GIMP_TYPE_IMAGE)
|
spec_type == GIMP_TYPE_IMAGE)
|
||||||
{
|
{
|
||||||
GValue value = G_VALUE_INIT;
|
GValue value = G_VALUE_INIT;
|
||||||
GimpImage *image = gimp_image_new_by_id (g_value_get_int (arg));
|
|
||||||
|
|
||||||
g_value_init (&value, GIMP_TYPE_IMAGE);
|
g_value_init (&value, GIMP_TYPE_IMAGE);
|
||||||
g_value_take_object (&value, image);
|
g_value_set_object (&value,
|
||||||
|
gimp_image_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);
|
||||||
|
|
|
@ -93,21 +93,19 @@ gimp_selection_float_deprecated (gint32 image_ID,
|
||||||
gint offx,
|
gint offx,
|
||||||
gint offy)
|
gint offy)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
GimpLayer *selection;
|
GimpLayer *selection;
|
||||||
gint32 selection_id = -1;
|
gint32 selection_id = -1;
|
||||||
|
|
||||||
image = gimp_image_new_by_id (image_ID);
|
|
||||||
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
|
drawable = GIMP_DRAWABLE (gimp_item_new_by_id (drawable_ID));
|
||||||
|
|
||||||
selection = gimp_selection_float (image, drawable,
|
selection = gimp_selection_float (gimp_image_get_by_id (image_ID),
|
||||||
|
drawable,
|
||||||
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 (image);
|
|
||||||
g_object_unref (drawable);
|
g_object_unref (drawable);
|
||||||
g_object_unref (selection);
|
g_object_unref (selection);
|
||||||
|
|
||||||
|
|
|
@ -559,8 +559,6 @@ gimp_zoom_preview_draw_buffer (GimpPreview *preview,
|
||||||
g_free (sel);
|
g_free (sel);
|
||||||
g_free (src);
|
g_free (src);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -170,9 +170,9 @@ package Gimp::CodeGen::pdb;
|
||||||
const_type => 'GimpImage *',
|
const_type => 'GimpImage *',
|
||||||
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_image ($value, gimp)',
|
get_value_func => '$var = gimp_value_get_image ($value, gimp)',
|
||||||
dup_value_func => '$var = gimp_image_new_by_id (gimp_value_get_image_id ($value))',
|
dup_value_func => '$var = gimp_image_get_by_id (gimp_value_get_image_id ($value))',
|
||||||
dup_value_func_d=> '$var = gimp_value_get_image_id ($value)',
|
dup_value_func_d=> '$var = gimp_value_get_image_id ($value)',
|
||||||
set_value_func => 'gimp_value_set_image_id ($value, gimp_image_get_id ($var))',
|
set_value_func => 'gimp_value_set_image_id ($value, gimp_image_get_id ($var))',
|
||||||
take_value_func => 'gimp_value_set_image ($value, $var)',
|
take_value_func => 'gimp_value_set_image ($value, $var)',
|
||||||
|
|
|
@ -129,7 +129,7 @@ run (const gchar *name,
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
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_new_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_new_by_id (drawable_ID));
|
||||||
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
|
@ -138,7 +138,6 @@ run (const gchar *name,
|
||||||
gimp_get_data (PLUG_IN_PROC, &cvals);
|
gimp_get_data (PLUG_IN_PROC, &cvals);
|
||||||
if (! checkerboard_dialog (image, drawable))
|
if (! checkerboard_dialog (image, drawable))
|
||||||
{
|
{
|
||||||
g_object_unref (image);
|
|
||||||
g_object_unref (drawable);
|
g_object_unref (drawable);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +178,6 @@ run (const gchar *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (drawable);
|
g_object_unref (drawable);
|
||||||
g_object_unref (image);
|
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ run (const gchar *name,
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
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_new_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_new_by_id (drawable_ID));
|
||||||
|
|
||||||
if (run_mode == GIMP_RUN_NONINTERACTIVE)
|
if (run_mode == GIMP_RUN_NONINTERACTIVE)
|
||||||
|
@ -254,7 +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 (image);
|
|
||||||
g_object_unref (drawable);
|
g_object_unref (drawable);
|
||||||
|
|
||||||
values[0].type = GIMP_PDB_STATUS;
|
values[0].type = GIMP_PDB_STATUS;
|
||||||
|
|
Loading…
Reference in New Issue