David Neary <[EMAIL PROTECTED]> writes:

> Not really - the usual way is to do something like this:
> gint nlayers, i;
> gint *layers = gimp_image_get_layers(image_id, &nlayers);
> /* layers[0] is the top layer */
> for (i = 0; i < nlayers; i++)
> {
>   /* Do stuff with layers[i] */
>   /* layer is a text layer if the parasite "gimp-text-layer" has been
>    * set */
>   GimpDrawable *layer = gimp_drawable_get (layers[i]);
>   GimpParasite *text_parasite = gimp_drawable_parasite_find
>                                   (layers[i], "gimp-text-layer");
>   if (text_parasite != NULL)
>     /* We have a text layer */
> } 

OK, now I will have to kill you both. Well, perhaps not but I can only
strongly discourage to do it this way. You must not rely on the text
parasite and it's content.  Doing this might to some extent work on
XCF files that have been freshly loaded but it will fail as soon as a
text layer is modified. There is also no guarantee that this behaviour
won't change in future versions of GIMP. I might even decide to change
it in the middle of a stable release cycle. Perhaps even for the only
reason to break your code that should not be doing this.

Gimp-developer mailing list

Reply via email to