mirror of https://github.com/GNOME/gimp.git
app, libgimp, pdb, plug-ins: layerarray PDB type is now a GimpCoreObjectArray.
This commit is contained in:
parent
318f7451cd
commit
d484b591d9
|
@ -169,7 +169,6 @@ file_load_layers_invoker (GimpProcedure *procedure,
|
|||
gint run_mode;
|
||||
GimpImage *image;
|
||||
GFile *file;
|
||||
gint num_layers = 0;
|
||||
GimpLayer **layers = NULL;
|
||||
|
||||
run_mode = g_value_get_enum (gimp_value_array_index (args, 0));
|
||||
|
@ -188,33 +187,33 @@ file_load_layers_invoker (GimpProcedure *procedure,
|
|||
if (layer_list)
|
||||
{
|
||||
GList *list;
|
||||
gint i;
|
||||
gsize num_layers;
|
||||
gint i;
|
||||
|
||||
num_layers = g_list_length (layer_list);
|
||||
|
||||
layers = g_new (GimpLayer *, num_layers);
|
||||
layers = g_new0 (GimpLayer *, num_layers + 1);
|
||||
|
||||
for (i = 0, list = layer_list;
|
||||
i < num_layers;
|
||||
i++, list = g_list_next (list))
|
||||
{
|
||||
layers[i] = g_object_ref (list->data);
|
||||
layers[i] = list->data;
|
||||
}
|
||||
|
||||
g_list_free (layer_list);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_value_set_int (gimp_value_array_index (return_vals, 1), num_layers);
|
||||
gimp_value_take_object_array (gimp_value_array_index (return_vals, 2), GIMP_TYPE_LAYER, (GObject **) layers, num_layers);
|
||||
}
|
||||
g_value_take_boxed (gimp_value_array_index (return_vals, 1), layers);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
@ -476,17 +475,11 @@ register_file_procs (GimpPDB *pdb)
|
|||
G_TYPE_FILE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_int ("num-layers",
|
||||
"num layers",
|
||||
"The number of loaded layers",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_object_array ("layers",
|
||||
"layers",
|
||||
"The list of loaded layers",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_param_spec_core_object_array ("layers",
|
||||
"layers",
|
||||
"The list of loaded layers",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
|
|
@ -431,7 +431,6 @@ image_get_layers_invoker (GimpProcedure *procedure,
|
|||
gboolean success = TRUE;
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
gint num_layers = 0;
|
||||
GimpLayer **layers = NULL;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
@ -439,28 +438,22 @@ image_get_layers_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
GList *list = gimp_image_get_layer_iter (image);
|
||||
gsize num_layers;
|
||||
gint i;
|
||||
|
||||
num_layers = g_list_length (list);
|
||||
|
||||
if (num_layers)
|
||||
{
|
||||
gint i;
|
||||
layers = g_new0 (GimpLayer *, num_layers + 1);
|
||||
|
||||
layers = g_new (GimpLayer *, num_layers);
|
||||
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = g_object_ref (list->data);
|
||||
}
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = list->data;
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_value_set_int (gimp_value_array_index (return_vals, 1), num_layers);
|
||||
gimp_value_take_object_array (gimp_value_array_index (return_vals, 2), GIMP_TYPE_LAYER, (GObject **) layers, num_layers);
|
||||
}
|
||||
g_value_take_boxed (gimp_value_array_index (return_vals, 1), layers);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
@ -1936,7 +1929,6 @@ image_get_selected_layers_invoker (GimpProcedure *procedure,
|
|||
gboolean success = TRUE;
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
gint num_layers = 0;
|
||||
GimpLayer **layers = NULL;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
@ -1944,28 +1936,21 @@ image_get_selected_layers_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
GList *list = gimp_image_get_selected_layers (image);
|
||||
gsize num_layers;
|
||||
gint i;
|
||||
|
||||
num_layers = g_list_length (list);
|
||||
layers = g_new0 (GimpLayer *, num_layers + 1);
|
||||
|
||||
if (num_layers)
|
||||
{
|
||||
gint i;
|
||||
|
||||
layers = g_new (GimpLayer *, num_layers);
|
||||
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = g_object_ref (list->data);
|
||||
}
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = list->data;
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_value_set_int (gimp_value_array_index (return_vals, 1), num_layers);
|
||||
gimp_value_take_object_array (gimp_value_array_index (return_vals, 2), GIMP_TYPE_LAYER, (GObject **) layers, num_layers);
|
||||
}
|
||||
g_value_take_boxed (gimp_value_array_index (return_vals, 1), layers);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
@ -1980,21 +1965,19 @@ image_set_selected_layers_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpImage *image;
|
||||
gint num_layers;
|
||||
const GimpLayer **layers;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
num_layers = g_value_get_int (gimp_value_array_index (args, 1));
|
||||
layers = (const GimpLayer **) gimp_value_get_object_array (gimp_value_array_index (args, 2));
|
||||
layers = g_value_get_boxed (gimp_value_array_index (args, 1));
|
||||
|
||||
if (success)
|
||||
{
|
||||
GList *selected_layers = NULL;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < num_layers; i++)
|
||||
selected_layers = g_list_prepend (selected_layers,
|
||||
GIMP_LAYER (layers[i]));
|
||||
if (layers)
|
||||
for (i = 0; layers[i] != NULL; i++)
|
||||
selected_layers = g_list_prepend (selected_layers, (gpointer) layers[i]);
|
||||
|
||||
gimp_image_set_selected_layers (image, selected_layers);
|
||||
g_list_free (selected_layers);
|
||||
|
@ -2181,18 +2164,13 @@ image_get_selected_drawables_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
GList *list = gimp_image_get_selected_drawables (image);
|
||||
gsize num_drawables;
|
||||
gint i;
|
||||
|
||||
num_drawables = g_list_length (list);
|
||||
drawables = g_new0 (GimpDrawable *, num_drawables + 1);
|
||||
|
||||
if (num_drawables)
|
||||
{
|
||||
gint i;
|
||||
|
||||
drawables = g_new0 (GimpDrawable *, num_drawables + 1);
|
||||
|
||||
for (i = 0; i < num_drawables; i++, list = g_list_next (list))
|
||||
drawables[i] = list->data;
|
||||
}
|
||||
for (i = 0; i < num_drawables; i++, list = g_list_next (list))
|
||||
drawables[i] = list->data;
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
|
@ -3481,17 +3459,11 @@ register_image_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_int ("num-layers",
|
||||
"num layers",
|
||||
"The number of root layers contained in the image",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_object_array ("layers",
|
||||
"layers",
|
||||
"The list of layers contained in the image.",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_param_spec_core_object_array ("layers",
|
||||
"layers",
|
||||
"The list of layers contained in the image.",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
@ -4865,17 +4837,11 @@ register_image_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_int ("num-layers",
|
||||
"num layers",
|
||||
"The number of selected layers in the image",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_object_array ("layers",
|
||||
"layers",
|
||||
"The list of selected layers in the image.",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_param_spec_core_object_array ("layers",
|
||||
"layers",
|
||||
"The list of selected layers in the image.",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
@ -4900,17 +4866,11 @@ register_image_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_int ("num-layers",
|
||||
"num layers",
|
||||
"The number of layers to select",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_object_array ("layers",
|
||||
"layers",
|
||||
"The list of layers to select",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
|
||||
gimp_param_spec_core_object_array ("layers",
|
||||
"layers",
|
||||
"The list of layers to select",
|
||||
GIMP_TYPE_LAYER,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ gimp_file_load_layer (GimpRunMode run_mode,
|
|||
* @run_mode: The run mode.
|
||||
* @image: Destination image.
|
||||
* @file: The file to load.
|
||||
* @num_layers: (out): The number of loaded layers.
|
||||
*
|
||||
* Loads an image file as layers for an existing image.
|
||||
*
|
||||
|
@ -134,17 +133,15 @@ gimp_file_load_layer (GimpRunMode run_mode,
|
|||
* needs to be added to the existing image with
|
||||
* gimp_image_insert_layer().
|
||||
*
|
||||
* Returns: (array length=num_layers) (element-type GimpLayer) (transfer container):
|
||||
* Returns: (element-type GimpLayer) (array zero-terminated=1) (transfer container):
|
||||
* The list of loaded layers.
|
||||
* The returned value must be freed with g_free().
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
GimpLayer **
|
||||
gimp_file_load_layers (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
gint *num_layers)
|
||||
GFile *file)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
|
@ -161,13 +158,8 @@ gimp_file_load_layers (GimpRunMode run_mode,
|
|||
args);
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
*num_layers = 0;
|
||||
|
||||
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
|
||||
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
||||
}
|
||||
layers = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
|
||||
|
||||
gimp_value_array_unref (return_vals);
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
|
|||
GFile *file);
|
||||
GimpLayer** gimp_file_load_layers (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
gint *num_layers);
|
||||
GFile *file);
|
||||
gboolean gimp_file_save (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
|
|
|
@ -235,13 +235,12 @@ GList *
|
|||
gimp_image_list_layers (GimpImage *image)
|
||||
{
|
||||
GimpLayer **layers;
|
||||
gint num_layers;
|
||||
GList *list = NULL;
|
||||
gint i;
|
||||
|
||||
layers = gimp_image_get_layers (image, &num_layers);
|
||||
layers = gimp_image_get_layers (image);
|
||||
|
||||
for (i = 0; i < num_layers; i++)
|
||||
for (i = 0; layers[i] != NULL; i++)
|
||||
list = g_list_prepend (list, layers[i]);
|
||||
|
||||
g_free (layers);
|
||||
|
@ -269,13 +268,12 @@ GList *
|
|||
gimp_image_list_selected_layers (GimpImage *image)
|
||||
{
|
||||
GimpLayer **layers;
|
||||
gint num_layers;
|
||||
GList *list = NULL;
|
||||
gint i;
|
||||
|
||||
layers = gimp_image_get_selected_layers (image, &num_layers);
|
||||
layers = gimp_image_get_selected_layers (image);
|
||||
|
||||
for (i = 0; i < num_layers; i++)
|
||||
for (i = 0; layers[i] != NULL; i++)
|
||||
list = g_list_prepend (list, layers[i]);
|
||||
|
||||
g_free (layers);
|
||||
|
@ -306,12 +304,11 @@ gimp_image_take_selected_layers (GimpImage *image,
|
|||
gboolean success;
|
||||
gint i;
|
||||
|
||||
sel_layers = g_new0 (GimpLayer *, g_list_length (layers));
|
||||
sel_layers = g_new0 (GimpLayer *, g_list_length (layers) + 1);
|
||||
for (list = layers, i = 0; list; list = list->next, i++)
|
||||
sel_layers[i] = list->data;
|
||||
|
||||
success = gimp_image_set_selected_layers (image, g_list_length (layers),
|
||||
(const GimpLayer **) sel_layers);
|
||||
success = gimp_image_set_selected_layers (image, (const GimpLayer **) sel_layers);
|
||||
g_list_free (layers);
|
||||
g_free (sel_layers);
|
||||
|
||||
|
|
|
@ -465,7 +465,6 @@ gimp_image_get_height (GimpImage *image)
|
|||
/**
|
||||
* gimp_image_get_layers:
|
||||
* @image: The image.
|
||||
* @num_layers: (out): The number of root layers contained in the image.
|
||||
*
|
||||
* Returns the list of root layers contained in the specified image.
|
||||
*
|
||||
|
@ -478,13 +477,11 @@ gimp_image_get_height (GimpImage *image)
|
|||
* with gimp_item_get_children() (possibly recursively checking if
|
||||
* these have children too).
|
||||
*
|
||||
* Returns: (array length=num_layers) (element-type GimpLayer) (transfer container):
|
||||
* Returns: (element-type GimpLayer) (array zero-terminated=1) (transfer container):
|
||||
* The list of layers contained in the image.
|
||||
* The returned value must be freed with g_free().
|
||||
**/
|
||||
GimpLayer **
|
||||
gimp_image_get_layers (GimpImage *image,
|
||||
gint *num_layers)
|
||||
gimp_image_get_layers (GimpImage *image)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
|
@ -499,13 +496,8 @@ gimp_image_get_layers (GimpImage *image,
|
|||
args);
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
*num_layers = 0;
|
||||
|
||||
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
|
||||
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
||||
}
|
||||
layers = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
|
||||
|
||||
gimp_value_array_unref (return_vals);
|
||||
|
||||
|
@ -2199,22 +2191,19 @@ _gimp_image_thumbnail (GimpImage *image,
|
|||
/**
|
||||
* gimp_image_get_selected_layers:
|
||||
* @image: The image.
|
||||
* @num_layers: (out): The number of selected layers in the image.
|
||||
*
|
||||
* Returns the specified image's selected layers.
|
||||
*
|
||||
* This procedure returns the list of selected layers in the specified
|
||||
* image.
|
||||
*
|
||||
* Returns: (array length=num_layers) (element-type GimpLayer) (transfer container):
|
||||
* Returns: (element-type GimpLayer) (array zero-terminated=1) (transfer container):
|
||||
* The list of selected layers in the image.
|
||||
* The returned value must be freed with g_free().
|
||||
*
|
||||
* Since: 3.0.0
|
||||
**/
|
||||
GimpLayer **
|
||||
gimp_image_get_selected_layers (GimpImage *image,
|
||||
gint *num_layers)
|
||||
gimp_image_get_selected_layers (GimpImage *image)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
|
@ -2229,13 +2218,8 @@ gimp_image_get_selected_layers (GimpImage *image,
|
|||
args);
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
*num_layers = 0;
|
||||
|
||||
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
|
||||
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
||||
}
|
||||
layers = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
|
||||
|
||||
gimp_value_array_unref (return_vals);
|
||||
|
||||
|
@ -2245,8 +2229,7 @@ gimp_image_get_selected_layers (GimpImage *image,
|
|||
/**
|
||||
* gimp_image_set_selected_layers:
|
||||
* @image: The image.
|
||||
* @num_layers: The number of layers to select.
|
||||
* @layers: (array length=num_layers) (element-type GimpLayer): The list of layers to select.
|
||||
* @layers: (element-type GimpLayer) (array zero-terminated=1): The list of layers to select.
|
||||
*
|
||||
* Sets the specified image's selected layers.
|
||||
*
|
||||
|
@ -2261,7 +2244,6 @@ gimp_image_get_selected_layers (GimpImage *image,
|
|||
**/
|
||||
gboolean
|
||||
gimp_image_set_selected_layers (GimpImage *image,
|
||||
gint num_layers,
|
||||
const GimpLayer **layers)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
|
@ -2270,10 +2252,8 @@ gimp_image_set_selected_layers (GimpImage *image,
|
|||
|
||||
args = gimp_value_array_new_from_types (NULL,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
G_TYPE_INT, num_layers,
|
||||
GIMP_TYPE_OBJECT_ARRAY, NULL,
|
||||
GIMP_TYPE_CORE_OBJECT_ARRAY, layers,
|
||||
G_TYPE_NONE);
|
||||
gimp_value_set_object_array (gimp_value_array_index (args, 2), GIMP_TYPE_LAYER, (GObject **) layers, num_layers);
|
||||
|
||||
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
||||
"gimp-image-set-selected-layers",
|
||||
|
|
|
@ -48,8 +48,7 @@ GimpPrecision gimp_image_get_precision (GimpImage
|
|||
GimpLayerMode gimp_image_get_default_new_layer_mode (GimpImage *image);
|
||||
gint gimp_image_get_width (GimpImage *image);
|
||||
gint gimp_image_get_height (GimpImage *image);
|
||||
GimpLayer** gimp_image_get_layers (GimpImage *image,
|
||||
gint *num_layers);
|
||||
GimpLayer** gimp_image_get_layers (GimpImage *image);
|
||||
GimpChannel** gimp_image_get_channels (GimpImage *image,
|
||||
gint *num_channels);
|
||||
GimpPath** gimp_image_get_paths (GimpImage *image,
|
||||
|
@ -145,10 +144,8 @@ G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage
|
|||
gint *actual_height,
|
||||
gint *bpp,
|
||||
GBytes **thumbnail_data);
|
||||
GimpLayer** gimp_image_get_selected_layers (GimpImage *image,
|
||||
gint *num_layers);
|
||||
GimpLayer** gimp_image_get_selected_layers (GimpImage *image);
|
||||
gboolean gimp_image_set_selected_layers (GimpImage *image,
|
||||
gint num_layers,
|
||||
const GimpLayer **layers);
|
||||
GimpChannel** gimp_image_get_selected_channels (GimpImage *image,
|
||||
gint *num_channels);
|
||||
|
|
|
@ -27,7 +27,6 @@ gimp_c_test_run (GimpProcedure *procedure,
|
|||
GimpExportOptions *options;
|
||||
GimpExportReturn delete;
|
||||
gint n_images;
|
||||
gint n_layers;
|
||||
gboolean identical_buffers;
|
||||
|
||||
new_image = gimp_image_new (NEW_IMAGE_WIDTH, NEW_IMAGE_HEIGHT, GIMP_RGB);
|
||||
|
@ -48,8 +47,8 @@ gimp_c_test_run (GimpProcedure *procedure,
|
|||
g_free (images);
|
||||
|
||||
GIMP_TEST_START("Verify start state (2)");
|
||||
layers = gimp_image_get_layers (new_image, &n_layers);
|
||||
GIMP_TEST_END(n_layers == 2);
|
||||
layers = gimp_image_get_layers (new_image);
|
||||
GIMP_TEST_END(gimp_core_object_array_get_length ((GObject **) layers) == 2);
|
||||
g_free (layers);
|
||||
|
||||
original_image = new_image;
|
||||
|
@ -61,8 +60,8 @@ gimp_c_test_run (GimpProcedure *procedure,
|
|||
g_free (images);
|
||||
|
||||
GIMP_TEST_START("The new image has a single layer");
|
||||
layers = gimp_image_get_layers (new_image, &n_layers);
|
||||
GIMP_TEST_END(n_layers == 1);
|
||||
layers = gimp_image_get_layers (new_image);
|
||||
GIMP_TEST_END(gimp_core_object_array_get_length ((GObject **) layers) == 1);
|
||||
|
||||
export_layer = layers[0];
|
||||
g_free (layers);
|
||||
|
|
10
pdb/app.pl
10
pdb/app.pl
|
@ -709,11 +709,11 @@ CODE
|
|||
}
|
||||
elsif ($pdbtype eq 'layerarray') {
|
||||
$pspec = <<CODE;
|
||||
gimp_param_spec_object_array ("$name",
|
||||
"$nick",
|
||||
"$blurb",
|
||||
GIMP_TYPE_LAYER,
|
||||
$flags)
|
||||
gimp_param_spec_core_object_array ("$name",
|
||||
"$nick",
|
||||
"$blurb",
|
||||
GIMP_TYPE_LAYER,
|
||||
$flags)
|
||||
CODE
|
||||
}
|
||||
elsif ($pdbtype eq 'channelarray') {
|
||||
|
|
|
@ -176,9 +176,7 @@ HELP
|
|||
|
||||
@outargs = (
|
||||
{ name => 'layers', type => 'layerarray',
|
||||
desc => 'The list of loaded layers',
|
||||
array => { name => 'num_layers',
|
||||
desc => 'The number of loaded layers' } }
|
||||
desc => 'The list of loaded layers' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
|
@ -194,23 +192,26 @@ HELP
|
|||
if (layer_list)
|
||||
{
|
||||
GList *list;
|
||||
gint i;
|
||||
gsize num_layers;
|
||||
gint i;
|
||||
|
||||
num_layers = g_list_length (layer_list);
|
||||
|
||||
layers = g_new (GimpLayer *, num_layers);
|
||||
layers = g_new0 (GimpLayer *, num_layers + 1);
|
||||
|
||||
for (i = 0, list = layer_list;
|
||||
i < num_layers;
|
||||
i++, list = g_list_next (list))
|
||||
{
|
||||
layers[i] = g_object_ref (list->data);
|
||||
layers[i] = list->data;
|
||||
}
|
||||
|
||||
g_list_free (layer_list);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
|
@ -261,27 +261,22 @@ HELP
|
|||
|
||||
@outargs = (
|
||||
{ name => 'layers', type => 'layerarray',
|
||||
desc => 'The list of layers contained in the image.',
|
||||
array => { name => 'num_layers',
|
||||
desc => 'The number of root layers contained in the image' } }
|
||||
desc => 'The list of layers contained in the image.' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GList *list = gimp_image_get_layer_iter (image);
|
||||
gsize num_layers;
|
||||
gint i;
|
||||
|
||||
num_layers = g_list_length (list);
|
||||
|
||||
if (num_layers)
|
||||
{
|
||||
gint i;
|
||||
layers = g_new0 (GimpLayer *, num_layers + 1);
|
||||
|
||||
layers = g_new (GimpLayer *, num_layers);
|
||||
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = g_object_ref (list->data);
|
||||
}
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = list->data;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
@ -1979,27 +1974,21 @@ HELP
|
|||
|
||||
@outargs = (
|
||||
{ name => 'layers', type => 'layerarray',
|
||||
desc => 'The list of selected layers in the image.',
|
||||
array => { name => 'num_layers',
|
||||
desc => 'The number of selected layers in the image' } }
|
||||
desc => 'The list of selected layers in the image.' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GList *list = gimp_image_get_selected_layers (image);
|
||||
gsize num_layers;
|
||||
gint i;
|
||||
|
||||
num_layers = g_list_length (list);
|
||||
layers = g_new0 (GimpLayer *, num_layers + 1);
|
||||
|
||||
if (num_layers)
|
||||
{
|
||||
gint i;
|
||||
|
||||
layers = g_new (GimpLayer *, num_layers);
|
||||
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = g_object_ref (list->data);
|
||||
}
|
||||
for (i = 0; i < num_layers; i++, list = g_list_next (list))
|
||||
layers[i] = list->data;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
@ -2021,11 +2010,7 @@ HELP
|
|||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' },
|
||||
{ name => 'layers', type => 'layerarray',
|
||||
desc => 'The list of layers to select',
|
||||
no_validate => 1,
|
||||
array => { name => 'num_layers',
|
||||
type => '0 <= int32',
|
||||
desc => 'The number of layers to select' } }
|
||||
desc => 'The list of layers to select' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
|
@ -2034,9 +2019,9 @@ HELP
|
|||
GList *selected_layers = NULL;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < num_layers; i++)
|
||||
selected_layers = g_list_prepend (selected_layers,
|
||||
GIMP_LAYER (layers[i]));
|
||||
if (layers)
|
||||
for (i = 0; layers[i] != NULL; i++)
|
||||
selected_layers = g_list_prepend (selected_layers, (gpointer) layers[i]);
|
||||
|
||||
gimp_image_set_selected_layers (image, selected_layers);
|
||||
g_list_free (selected_layers);
|
||||
|
@ -2236,18 +2221,13 @@ HELP
|
|||
{
|
||||
GList *list = gimp_image_get_selected_drawables (image);
|
||||
gsize num_drawables;
|
||||
gint i;
|
||||
|
||||
num_drawables = g_list_length (list);
|
||||
drawables = g_new0 (GimpDrawable *, num_drawables + 1);
|
||||
|
||||
if (num_drawables)
|
||||
{
|
||||
gint i;
|
||||
|
||||
drawables = g_new0 (GimpDrawable *, num_drawables + 1);
|
||||
|
||||
for (i = 0; i < num_drawables; i++, list = g_list_next (list))
|
||||
drawables[i] = list->data;
|
||||
}
|
||||
for (i = 0; i < num_drawables; i++, list = g_list_next (list))
|
||||
drawables[i] = list->data;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
15
pdb/pdb.pl
15
pdb/pdb.pl
|
@ -147,17 +147,16 @@ package Gimp::CodeGen::pdb;
|
|||
take_value_func => 'g_value_take_boxed ($value, $var)' },
|
||||
|
||||
layerarray => { name => 'LAYERARRAY',
|
||||
gtype => 'GIMP_TYPE_OBJECT_ARRAY',
|
||||
gtype => 'GIMP_TYPE_CORE_OBJECT_ARRAY',
|
||||
type => 'GimpLayer **',
|
||||
const_type => 'const GimpLayer **',
|
||||
array => 1,
|
||||
init_value => 'NULL',
|
||||
in_annotate => '(element-type GimpLayer)',
|
||||
out_annotate => '(element-type GimpLayer) (transfer container)',
|
||||
get_value_func => '$var = (const GimpLayer **) gimp_value_get_object_array ($value)',
|
||||
dup_value_func => '{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index ($value)); if (a) $var = g_memdup2 (a->data, a->length * sizeof (gpointer)); }',
|
||||
set_value_func => 'gimp_value_set_object_array ($value, GIMP_TYPE_LAYER, (GObject **) $var, $var_len)',
|
||||
take_value_func => 'gimp_value_take_object_array ($value, GIMP_TYPE_LAYER, (GObject **) $var, $var_len)' },
|
||||
in_annotate => '(element-type GimpLayer) (array zero-terminated=1)',
|
||||
out_annotate => '(element-type GimpLayer) (array zero-terminated=1) (transfer container)',
|
||||
get_value_func => '$var = g_value_get_boxed ($value)',
|
||||
dup_value_func => '$var = g_value_dup_boxed (gimp_value_array_index ($value))',
|
||||
set_value_func => 'g_value_set_boxed ($value, $var)',
|
||||
take_value_func => 'g_value_take_boxed ($value, $var)' },
|
||||
|
||||
channelarray => { name => 'CHANNELARRAY',
|
||||
gtype => 'GIMP_TYPE_OBJECT_ARRAY',
|
||||
|
|
|
@ -534,7 +534,8 @@ do_optimizations (GimpRunMode run_mode,
|
|||
|
||||
width = gimp_image_get_width (image);
|
||||
height = gimp_image_get_height (image);
|
||||
layers = gimp_image_get_layers (image, &total_frames);
|
||||
layers = gimp_image_get_layers (image);
|
||||
total_frames = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
imagetype = gimp_image_get_base_type (image);
|
||||
pixelstep = (imagetype == GIMP_RGB) ? 4 : 2;
|
||||
|
||||
|
|
|
@ -691,9 +691,8 @@ compose_run (GimpProcedure *procedure,
|
|||
if (! strcmp (name, COMPOSE_PROC))
|
||||
{
|
||||
GimpLayer **layers;
|
||||
gint nlayers;
|
||||
|
||||
layers = gimp_image_get_layers (image, &nlayers);
|
||||
layers = gimp_image_get_layers (image);
|
||||
|
||||
if (! layers)
|
||||
{
|
||||
|
@ -987,7 +986,6 @@ compose (const gchar *compose_type,
|
|||
gint width, height;
|
||||
gint num_images, compose_idx;
|
||||
gint i, j;
|
||||
gint num_layers;
|
||||
GimpLayer *layer_dst;
|
||||
GimpImage *image_dst;
|
||||
gint first_object;
|
||||
|
@ -1088,7 +1086,7 @@ compose (const gchar *compose_type,
|
|||
GimpLayer **layers;
|
||||
|
||||
/* Get first layer of image */
|
||||
layers = gimp_image_get_layers (inputs[j].comp.object, &num_layers);
|
||||
layers = gimp_image_get_layers (inputs[j].comp.object);
|
||||
|
||||
if (! layers)
|
||||
{
|
||||
|
@ -1220,8 +1218,8 @@ compose_dialog (GimpProcedure *procedure,
|
|||
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
layer_list = gimp_image_get_layers (gimp_item_get_image (GIMP_ITEM (drawable)),
|
||||
&nlayers);
|
||||
layer_list = gimp_image_get_layers (gimp_item_get_image (GIMP_ITEM (drawable)));
|
||||
nlayers = gimp_core_object_array_get_length ((GObject **) layer_list);
|
||||
|
||||
dialog = gimp_procedure_dialog_new (procedure,
|
||||
GIMP_PROCEDURE_CONFIG (config),
|
||||
|
|
|
@ -1248,11 +1248,14 @@ save_dialog (GimpImage *image,
|
|||
GtkWidget *vbox;
|
||||
GtkWidget *text_view;
|
||||
GtkTextBuffer *text_buffer;
|
||||
GimpLayer **layers;
|
||||
gint32 n_layers;
|
||||
gboolean animation_supported;
|
||||
gboolean run;
|
||||
|
||||
g_free (gimp_image_get_layers (image, &n_layers));
|
||||
layers = gimp_image_get_layers (image);
|
||||
n_layers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
g_free (layers);
|
||||
|
||||
animation_supported = n_layers > 1;
|
||||
|
||||
|
|
|
@ -824,7 +824,8 @@ mng_export_image (GFile *file,
|
|||
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
|
||||
"default-chunks");
|
||||
|
||||
layers = gimp_image_get_layers (image, &num_layers);
|
||||
layers = gimp_image_get_layers (image);
|
||||
num_layers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
|
||||
if (num_layers < 1)
|
||||
return FALSE;
|
||||
|
@ -1575,14 +1576,15 @@ mng_save_dialog (GimpImage *image,
|
|||
GimpProcedure *procedure,
|
||||
GObject *config)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
gint num_layers;
|
||||
gboolean run;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GimpLayer **layers;
|
||||
gint num_layers;
|
||||
gboolean run;
|
||||
|
||||
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
|
||||
GIMP_PROCEDURE_CONFIG (config),
|
||||
|
@ -1599,7 +1601,9 @@ mng_save_dialog (GimpImage *image,
|
|||
"options-frame", "options-label",
|
||||
FALSE, "options-vbox");
|
||||
|
||||
g_free (gimp_image_get_layers (image, &num_layers));
|
||||
layers = gimp_image_get_layers (image);
|
||||
num_layers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
g_free (layers);
|
||||
|
||||
if (num_layers == 1)
|
||||
{
|
||||
|
|
|
@ -569,7 +569,6 @@ load_multi (GimpProcedure *procedure,
|
|||
{
|
||||
GimpLayer **layers;
|
||||
GimpLayer *new_layer;
|
||||
gint n_layers;
|
||||
|
||||
fread (&offset, 1, 4, fd);
|
||||
|
||||
|
@ -591,7 +590,7 @@ load_multi (GimpProcedure *procedure,
|
|||
|
||||
if (temp_image)
|
||||
{
|
||||
layers = gimp_image_get_layers (temp_image, &n_layers);
|
||||
layers = gimp_image_get_layers (temp_image);
|
||||
new_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (layers[0]),
|
||||
image);
|
||||
gimp_item_set_name (GIMP_ITEM (new_layer),
|
||||
|
|
|
@ -765,7 +765,8 @@ pdf_export_image (GimpProcedure *procedure,
|
|||
*/
|
||||
cairo_scale (cr, x_scale, y_scale);
|
||||
|
||||
layers = gimp_image_get_layers (image, &n_layers);
|
||||
layers = gimp_image_get_layers (image);
|
||||
n_layers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
|
||||
/* Fill image with background color if transparent and
|
||||
* user chose that option.
|
||||
|
@ -943,7 +944,8 @@ gui_single (GimpProcedure *procedure,
|
|||
"pages-box");
|
||||
/* Enable "layers-as-pages" if more than one layer, or there's a single
|
||||
* layer group has more than one layer */
|
||||
layers = gimp_image_get_layers (multi_page.images[0], &n_layers);
|
||||
layers = gimp_image_get_layers (multi_page.images[0]);
|
||||
n_layers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
|
||||
if (n_layers == 1 && gimp_item_is_group (GIMP_ITEM (layers[0])))
|
||||
{
|
||||
|
|
|
@ -944,11 +944,13 @@ save_dialog (GimpImage *image,
|
|||
GimpProcedure *procedure,
|
||||
GObject *config)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
gint n_frames;
|
||||
gboolean run;
|
||||
GtkWidget *dialog;
|
||||
GimpLayer **layers;
|
||||
gint n_frames;
|
||||
gboolean run;
|
||||
|
||||
g_free (gimp_image_get_layers (image, &n_frames));
|
||||
layers = gimp_image_get_layers (image);
|
||||
n_frames = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
|
||||
g_object_set (config,
|
||||
"from-frame", 1,
|
||||
|
|
|
@ -398,7 +398,6 @@ icns_attach_image (GimpImage *image,
|
|||
GimpValueArray *return_vals = NULL;
|
||||
GimpLayer **layers;
|
||||
GimpLayer *new_layer;
|
||||
gint n_layers;
|
||||
gchar *temp_file_type = NULL;
|
||||
gchar *procedure_name = NULL;
|
||||
|
||||
|
@ -452,7 +451,7 @@ icns_attach_image (GimpImage *image,
|
|||
{
|
||||
temp_image = g_value_get_object (gimp_value_array_index (return_vals, 1));
|
||||
|
||||
layers = gimp_image_get_layers (temp_image, &n_layers);
|
||||
layers = gimp_image_get_layers (temp_image);
|
||||
new_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (layers[0]), image);
|
||||
gimp_item_set_name (GIMP_ITEM (new_layer), layer_name);
|
||||
gimp_image_insert_layer (image, new_layer, NULL, 0);
|
||||
|
|
|
@ -923,20 +923,20 @@ ani_load_image (GFile *file,
|
|||
GimpImage *temp_image = NULL;
|
||||
GimpLayer **layers;
|
||||
GimpLayer *new_layer;
|
||||
gint nlayers;
|
||||
|
||||
temp_image = ico_load_image (file, &file_offset, frame + 1,
|
||||
error);
|
||||
layers = gimp_image_get_layers (temp_image, &nlayers);
|
||||
layers = gimp_image_get_layers (temp_image);
|
||||
if (layers)
|
||||
{
|
||||
for (gint i = 0; i < nlayers; i++)
|
||||
for (gint i = 0; layers[i]; i++)
|
||||
{
|
||||
new_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (layers[i]),
|
||||
image);
|
||||
gimp_image_insert_layer (image, new_layer, NULL, frame);
|
||||
frame++;
|
||||
}
|
||||
g_free (layers);
|
||||
}
|
||||
gimp_image_delete (temp_image);
|
||||
}
|
||||
|
|
|
@ -2669,11 +2669,11 @@ save_dialog (GimpImage *image,
|
|||
/* Multi-layer Indexed Image Warning */
|
||||
if (gimp_image_get_base_type (image) == GIMP_INDEXED)
|
||||
{
|
||||
gint32 n_layers = 0;
|
||||
GimpLayer **layers;
|
||||
|
||||
g_free (gimp_image_get_layers (image, &n_layers));
|
||||
layers = gimp_image_get_layers (image);
|
||||
|
||||
if (n_layers > 1)
|
||||
if (gimp_core_object_array_get_length ((GObject **) layers) > 1)
|
||||
{
|
||||
text = g_strdup_printf ("\n<b>%s</b>: %s",
|
||||
_("Indexed Image Warning"),
|
||||
|
@ -2693,6 +2693,7 @@ save_dialog (GimpImage *image,
|
|||
"indexed-notice", NULL);
|
||||
g_free (text);
|
||||
}
|
||||
g_free (layers);
|
||||
}
|
||||
|
||||
/* Compatibility Notice */
|
||||
|
|
|
@ -537,9 +537,12 @@ image_is_monochrome (GimpImage *image)
|
|||
static gboolean
|
||||
image_is_multi_layer (GimpImage *image)
|
||||
{
|
||||
gint32 n_layers;
|
||||
GimpLayer **layers;
|
||||
gint32 n_layers;
|
||||
|
||||
g_free (gimp_image_get_layers (image, &n_layers));
|
||||
layers = gimp_image_get_layers (image);
|
||||
n_layers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
g_free (layers);
|
||||
|
||||
return (n_layers > 1);
|
||||
}
|
||||
|
|
|
@ -62,12 +62,15 @@ save_dialog (GimpImage *image,
|
|||
GimpProcedure *procedure,
|
||||
GObject *config)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
gint32 nlayers;
|
||||
gboolean animation_supported = FALSE;
|
||||
gboolean run;
|
||||
GtkWidget *dialog;
|
||||
GimpLayer **layers;
|
||||
gint32 nlayers;
|
||||
gboolean animation_supported = FALSE;
|
||||
gboolean run;
|
||||
|
||||
g_free (gimp_image_get_layers (image, &nlayers));
|
||||
layers = gimp_image_get_layers (image);
|
||||
nlayers = gimp_core_object_array_get_length ((GObject **) layers);
|
||||
g_free (layers);
|
||||
|
||||
animation_supported = nlayers > 1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue