Quoting Giampaolo Bellini <iw2...@gmail.com>:

>    I'm writing my first first plugin for gimp and I'm looking for more
> info about parasite: expecially, I wonder if there is a standard way
> to improve parasite's compatibility between different plugin
> revisions... what if, for example, I add, change or remove a parameter
> from my parasite struct ?
> is there a way, then, to access parasites saved with previous version
> of the plug-in ?
> I see that there are some serialize/deserialize functions in
> gimpparasiteio but missing usage info... are them for solve this kind
> of problems or I'm looking at the wrong direction ?

If I understand correctly, libgimpbase/gimpparasiteio.c does not  
actually contain any functionality which your plug-in should be making  
use of; instead it is the intended centralized location for the  
parasite conversions to be placed for GIMP's "standardized" parasites,  
i.e., the ones supported by GIMP core and its official plug-in. It  
does not appear that this intended convention has always been followed  
-- for example, the gfig plug-in processes its parasites within its  
own source files -- though parasites in general aren't used as much as  
they could be.

The GIH plug-in (for image pipes) is apparently the only code which  
currently processes its parasites in the gimpparasiteio.c file, and it  
seems to me an excellent example of how you should handle your own  
parasites. As you can see from the source, it is basically an  
associated list of pairs of structmember:value each separate by spaces  
(if you need to use colons or spaces in your data then you should  
choose different delimiters).

As a third-party plug-in, you will not be placing your parasite  
handling in libgimpbase/gimpparasiteio.c; however, I would recommend  
following the approach used for the GIH image pipe plug-in. As an  
associated list, it will be trivial to later add or remove struct  
members and maintain both forward and backward compatibility. If at  
some point in the future your plug-in were to be accepted as an  
official part of the GIMP distribution, then it might become  
appropriate to move the parasite handling from your plug-in to the  
libgimpbase/gimpparasiteio.c file.

Gimp-developer mailing list

Reply via email to