parasite usage
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
parasite usage | Giampaolo Bellini | 03 Jun 00:41 |
parasite usage | saulgoode@flashingtwelve.brickfilms.com | 03 Jun 09:38 |
parasite usage | Giampaolo Bellini | 03 Jun 10:19 |
parasite usage | Bill Skaggs | 04 Jun 00:14 |
parasite usage
Hi all
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 ?
thanks in advance for any hints
Giampaolo
parasite usage
Quoting Giampaolo Bellini :
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.
parasite usage
Hello saulgoode
thanks a lot for your great explanation... I'm looking at the GIH
plug-in right now.
.
BTW (for other novices) there are some useful info in the
doc-devel/parasite.txt file I miss when I post the msg :-(
best regards
Giampaolo
2010/6/3 :
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.
parasite usage
Parasites are a mechanism for attaching arbitrary binary data to an image or
layer,
so they will support just about anything you can imagine. The main thing to
think
about is compatibility: if you want your plug-in to generate persistent
parasites and
read them later, the process needs to work on every platform, and future
versions of
your plug-in should not break if they are applied to images that contain
parasites
generated by earlier versions. This "future backward compatibility"
principle is what
usually calls for the most thought.
-- Bill