[Gimp-developer] Of Palettes and Plug-ins



Hey,

First of all, a little background. I am using the master branch and am
trying to make the palette import parsers plugable. I have been
experimenting a bit as a result.

I have been trying to write a python plugin that returns a palette.
However, when I define a return type as PF_PALETTE, the pdb reports the
procedure as returning a string. I have seen that PF_PALETTE is mapped to a
PDB_STRING type. Further research suggests that a palette cannot be
returned from a plugin procedure.

While discovering that, I also tried using the pattern used for file
importers to make the palette parsers importable. You can see my work so
far here<https://github.com/wt/gimp/commit/2f0fbe1b17975172ebe7d702dd430c8ea248c59f>.
This work is currently a bunch of hacking. As you can see
in gimp/app/plug-in/gimppluginmanager-file.c:278
(here<https://github.com/wt/gimp/blob/2f0fbe1b17975172ebe7d702dd430c8ea248c59f/app/plug-in/gimppluginmanager-file.c#L278>),
I tried to use the GIMP_IS_PALETTE macro to make sure the return value of
the plugin is a palette. However, I cannot include "core/gimppalette.h" in
this file without lots of errors that I am not sure how to solve.

My basic design is going to be as follows:

   - Add a procedure to register a palette loader
   This procedure will check that registered procedure take an int32 and
   two strings and return a palette. The args are the same as those for the
   image importer, and the return is a palette instead of an image.
   - Write a python (or other language) procedure to implement that
   interface.

Does anyone have any tips on making a procedure return a palette? Am I on
the wrong course?

Thanks,
wt


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]