home contents changes options help

by Robin Rowe 2/11/04

Porting GIMP plug-ins to CinePaint can be trivial or difficult. The process is simplified by our libgimp PICL (Plug-In Compatibility Layer), a set of header files in CinePaint that emulate GIMP header files:

 cinepaint/libgimp/gimp1.2.h  
 cinepaint/libgimp/gimpcompat.h  
 cinepaint/libgimp/gimp.h  
 cinepaint/libgimp/gimpmath.h  
 cinepaint/libgimp/gimpui.h  
 cinepaint/libgimp/stdplugins-intl.h

GIMP plug-ins that include these common GIMP headers may be fooled into compiling unchanged under CinePaint. See plug-ins/rotate/rotate.c for a simple example of porting. (Search on GIMP_VERSION to find changes.)

Note that CinePaint does not use the GIMP library. Our libgimp headers use macros and other tricks to map GIMP library calls into equivalent CinePaint library calls. Sometimes there is no equivalent CinePaint call. It may be the code block involved isn't relevant to CinePaint anyway and could be ignored. An example would be a call to the GIMP help system (except PICL is clever enough to handle that one as a no-op). Or, it may be more work will be involved to workaround/implement missing functionality. That's when porting gets more difficult.

Don't simply comment out GIMP code. Use the GIMP_VERSION macro instead:

 #ifdef GIMP_VERSION
 ... code here that only GIMP understands ...
 #else
 ... code here that CinePaint understands ...
 #endif

Using GIMP_VERSION can make plug-ins compatible with both GIMP and CinePaint. By the way, don't expect the GIMP project to accept your plug-in if they realize it is CinePaint compatible. When offered our improved GIMP-compatible TIFF plug-in they stated a no tolerance policy against accepting any CinePaint code.

Note that GIMP only understands 8-bit color depth (that is, 24 bits RGB), but CinePaint can handle 8 (unsigned), 16 (unsigned or chopped float), and 32 (float). If you want deep paint support in the GIMP plug-in you are porting to CinePaint you will have to add code to the plug-in. Here's a code example from plug-ins/blur/blur.c:

    switch(precision)
    {   case PRECISION_U8:
          filter_u8(sel_width, num_channels, has_alpha, dest, previous, current,next);
          break;
        case PRECISION_U16:
          filter_u16(sel_width, num_channels, has_alpha, dest, previous, current, next);
          break;
        case PRECISION_FLOAT:
          filter_float(sel_width, num_channels, has_alpha, dest, previous, current, next);
          break;
        case PRECISION_FLOAT16:
          filter_float16(sel_width, num_channels, has_alpha, dest, previous, current, next);
          break;
        case PRECISION_NONE:
        return;
    }

To add a plug-in to the CinePaint autoconf build system you need to create a Makefile.am (you can use the one in blur as a template), add the name to the list of plug-ins in configure.ac, and execute autogen.sh followed by ./configure to regenerate the build system.

Please upload the source to your ported plug-in as a patch or tarball to our CinePaint SourceForge Patches page so we can include it in CinePaint.