On Thursday 02 December 2004 09:50, Sven Neumann wrote:
> Hi,
>
> 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.
>

Actually, it doesn't even work on a newly created text layer. No 
parasites in there, checking interactively.

There is one thing to do - The plug-in have to manage text layers on 
it's side, creating itsef the parasites it need to store the 
information. - Just like the old Dyn text. Then, the standard 
text-tool api can be used. The plug-in won't know about any other 
text layers but the ones it creates, thought.
>
> Sven
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to