Re: [Gimp-developer] [Q] Future of Gimp

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

 



I hope you don't mind that I reply to the list also - this might also
be interesting to others.

Daniel Carrera (dcarrera@xxxxxxxxxxxx) wrote:
> On Sat, Mar 29, 2003 at 03:54:24AM +0100, Simon Budig wrote:
> 
> > > What is a PDB function?  Is that what people use to make bindings?
> > 
> > Yes, and to write plugins etc - except that some plugin-authors are
> > probably not aware of that fact. Gimp maintains a Procedural DataBase
> > with various functions. Libgimp has some functions to access this
> > Databasea (search, execute) plus a lot of wrappers around this
> > functions. Basically for a language binding you have to use these
> > pdb-access functions to map the pdb functions into the target language.
> > 
> > http://developer.gimp.org/api/1.3/libgimp/libgimp-gimpproceduraldb.html
> 
> I've read this page, but I don't feel any closer to understanding this.
> What is a procedural database?  Why would I want to touch it when I'm 
> trying to make language bindings?

For a short explantation of the PDB have a look at
  http://www.home.unix-ag.org/simon/gimp/guadec2002/gimp-plugin/html/

> Shouldn't I try to make bindings around all the other libgimp functions, 
> like gimp_image_scale() or things like that?

The point is, that this is not necessary. If you look at the libgimp
implementation of gimp_image_scale() you'll see that it is a short
wrapper around a PDB call:

    gboolean
    gimp_image_scale (gint32 image_ID,
                      gint   new_width,
                      gint   new_height)
    {
      GimpParam *return_vals;
      gint nreturn_vals;
      gboolean success = TRUE;

      return_vals = gimp_run_procedure ("gimp_image_scale",
                                        &nreturn_vals,
                                        GIMP_PDB_IMAGE, image_ID,
                                        GIMP_PDB_INT32, new_width,
                                        GIMP_PDB_INT32, new_height,
                                        GIMP_PDB_END);

      success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

      gimp_destroy_params (return_vals, nreturn_vals);

      return success;
    }

Most libgimp functions look exactly this way. So, if you want to look at
it this way the libgimp is (except the PDB-access stuff) basically a
C-binding. Bindings for other languages don't need to use
gimp_image_scale() from libgimp, they can use their wrapper around
gimp_run_procedure directly. IIRC the Perl bindings don't have fixed
wrappers around all PDB functions. They dynamically search the PDB with
some heuristics if a function gets called. This has the advantage that
it can provide bindings to PDB functions the author (of the binding) at
the time of writing did not know about.

> I don't understand how PDB relates to the rest of Gimp.

Basically the PDB *is* the GIMP. Ok, this is not exactly true, but as
far as plugins and bindings it is. You cannot access image manipulation
functions that are not entered in the PDB - fortunately most
functionality is available via the PDB.

> Thank you for your help.

I hope this helps.

Bye,
        Simon

-- 
      Simon.Budig@xxxxxxxxxxx       http://www.home.unix-ag.org/simon/

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux