pippin.gimp.org/gggl/api/c

gggl

Refer to the glossary for defintions of terminology used in this documentation.

At the moment compiling against gggl isn't documented, but if you know your way around a compiler and have gotten your hands dirty before it shouldn't be hard.

gggl.h is the only header file that is needed to gain access to libgggl, the reference for each of the functions in that file is documented in that file, refer to that file for calling convention for each function.

gggl works by allowing you to create a graph of processing instructions, creating modifying and comsuming image buffers, each op has properties: the following is a simple contrast adjustment program.

#include 'gggl.h'

void define_graph(Gggl *gggl) {

	
	
    /* create ops */
    int load   = gggl_op_create (gggl);
    int adjust = gggl_op_create (gggl);
    int save   = gggg_op_create (gggl);
	
    /* instantiate the ops */
    gggl_op_set_type (gggl, load,   'png_load'); 
    gggl_op_set_type (gggl, adjust, 'bcontrast');
    gggl_op_set_type (gggl, save,   'png_save');
	
    /* connect the nodes like this diagram
       .------.
       | load |
       `------'
          |
          v
       .--------.
       | adjust |
       `--------'
          |
          v
       .------.
       | save |
       `------'
    */
    gggl_op_set_input (gggl, adjust, 0, load, 0);
    gggl_op_set_input (gggl, save, 0, adjust, 0);

	
    gggl_property_set (gggl, load,  
        'file', 'input.png');  
    gggl_property_set (gggl, adjust,
        'contrast', '1.5'); 
    gggl_property_set (gggl, save,
        'file', 'output.png');
	
    /* set the save operation as 'active'
       this means that this operation, and
       all it's dependencies will be calculated
       when the graph is processed */

    gggl_set_active (gggl, save);
}   
	                             


int main (int    argc,
          char **argv)
{
    Gggl *gggl;

    /* by passing an empty path to the plug-in
       loader it will load the default paths as
       set in GGGL_PLUGIN_PATH which is a colon
       seperated list of paths to recursivly look
       for .so files in */

    gggl_operation_db_load_plugins(NULL);

    /* create a new gggl instance */
    gggl = gggl_create();  

    define_graph (gggl);    
 
    /* process graph  */	
    gggl_process (gggl); 

    /* free gggl instance, and nodes */
    gggl_destroy (gggl);

    return 0;
}
xhml·css last html rebuild: Wed Mar 30 23:08:22 CEST 2005   pippin@gimp·org