libgimp: add gimp_image_list_selected_drawables().

Similar to other functions, we want a variant which returns a GList.
This commit is contained in:
Jehan 2022-10-20 23:03:33 +02:00
parent 831cb91303
commit 8f288bf722
3 changed files with 41 additions and 0 deletions

View File

@ -451,6 +451,7 @@ EXPORTS
gimp_image_list_channels
gimp_image_list_layers
gimp_image_list_selected_channels
gimp_image_list_selected_drawables
gimp_image_list_selected_layers
gimp_image_list_selected_vectors
gimp_image_list_vectors

View File

@ -524,6 +524,44 @@ gimp_image_list_vectors (GimpImage *image)
return g_list_reverse (list);
}
/**
* gimp_image_list_selected_drawables:
* @image: The image.
*
* Returns the list of drawables selected in the specified image.
*
* This procedure returns the list of drawables selected in the specified
* image.
* These can be either a list of layers or a list of channels (a list mixing
* layers and channels is not possible), or it can be a layer mask (a list
* containing only a layer mask as single item), if a layer mask is in edit
* mode.
*
* Returns: (element-type GimpItem) (transfer container):
* The list of selected drawables in the image.
* The returned list must be freed with g_list_free(). Layer
* elements belong to libgimp and must not be freed.
*
* Since: 3.0
**/
GList *
gimp_image_list_selected_drawables (GimpImage *image)
{
GimpItem **drawables;
gint num_drawables;
GList *list = NULL;
gint i;
drawables = gimp_image_get_selected_drawables (image, &num_drawables);
for (i = 0; i < num_drawables; i++)
list = g_list_prepend (list, drawables[i]);
g_free (drawables);
return g_list_reverse (list);
}
/**
* gimp_image_get_colormap:
* @image: The image.

View File

@ -56,6 +56,8 @@ GList * gimp_image_list_selected_vectors (GimpImage *image);
gboolean gimp_image_take_selected_vectors (GimpImage *image,
GList *vectors);
GList * gimp_image_list_selected_drawables(GimpImage *image);
guchar * gimp_image_get_colormap (GimpImage *image,
gint *num_colors);
gboolean gimp_image_set_colormap (GimpImage *image,