home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / libgimp / gimp.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-28  |  8.7 KB  |  330 lines

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimp.h
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. #ifndef __GIMP_H__
  23. #define __GIMP_H__
  24.  
  25. #include <glib.h>
  26.  
  27. #include <libgimp/gimpenums.h>
  28. #include <libgimp/gimptypes.h>
  29.  
  30. #include <libgimp/gimpchannel.h>
  31. #include <libgimp/gimpcolorspace.h>
  32. #include <libgimp/gimpdrawable.h>
  33. #include <libgimp/gimpfeatures.h>
  34. #include <libgimp/gimpgradientselect.h>
  35. #include <libgimp/gimpenv.h>
  36. #include <libgimp/gimpimage.h>
  37. #include <libgimp/gimplayer.h>
  38. #include <libgimp/gimplimits.h>
  39. #include <libgimp/gimpmath.h>
  40. #include <libgimp/gimpparasite.h>
  41. #include <libgimp/gimppixelrgn.h>
  42. #include <libgimp/gimpproceduraldb.h>
  43. #include <libgimp/gimpselection.h>
  44. #include <libgimp/gimptile.h>
  45. #include <libgimp/gimpunit.h>
  46. #include <libgimp/gimputils.h>
  47. #include <libgimp/gimpvector.h>
  48.  
  49. #include <libgimp/gimp_pdb.h>
  50.  
  51. #include <libgimp/gimpcompat.h>  /* to be removed before 1.2 */
  52.  
  53. #ifdef G_OS_WIN32
  54. #  include <stdlib.h>        /* For _-argc and __argv */
  55. #  ifdef LIBGIMP_COMPILATION
  56. #    define GIMPVAR __declspec(dllexport)
  57. #  else  /* !LIBGIMP_COMPILATION */
  58. #    define GIMPVAR extern __declspec(dllimport)
  59. #  endif /* !LIBGIMP_COMPILATION */
  60. #else  /* !G_OS_WIN32 */
  61. #  define GIMPVAR extern
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif /* __cplusplus */
  67.  
  68.  
  69. #define gimp_get_data         gimp_procedural_db_get_data
  70. #define gimp_get_data_size    gimp_procedural_db_get_data_size
  71. #define gimp_set_data         gimp_procedural_db_set_data
  72.  
  73.  
  74. GIMPVAR guint gimp_major_version;
  75. GIMPVAR guint gimp_minor_version;
  76. GIMPVAR guint gimp_micro_version;
  77.  
  78. GIMPVAR GIOChannel *_readchannel;
  79.  
  80. typedef void (* GimpInitProc)  (void);
  81. typedef void (* GimpQuitProc)  (void);
  82. typedef void (* GimpQueryProc) (void);
  83. typedef void (* GimpRunProc)   (gchar      *name,
  84.                 gint        nparams,
  85.                 GimpParam  *param,
  86.                 gint       *nreturn_vals,
  87.                 GimpParam **return_vals);
  88.  
  89.  
  90. struct _GimpPlugInInfo
  91. {
  92.   /* called when the gimp application initially starts up */
  93.   GimpInitProc  init_proc;
  94.  
  95.   /* called when the gimp application exits */
  96.   GimpQuitProc  quit_proc;
  97.  
  98.   /* called by the gimp so that the plug-in can inform the
  99.    *  gimp of what it does. (ie. installing a procedure database
  100.    *  procedure).
  101.    */
  102.   GimpQueryProc query_proc;
  103.  
  104.   /* called to run a procedure the plug-in installed in the
  105.    *  procedure database.
  106.    */
  107.   GimpRunProc   run_proc;
  108. };
  109.  
  110. struct _GimpParamDef
  111. {
  112.   GimpPDBArgType  type;
  113.   gchar          *name;
  114.   gchar          *description;
  115. };
  116.  
  117. struct _GimpParamColor
  118. {
  119.   guint8 red;
  120.   guint8 green;
  121.   guint8 blue;
  122. };
  123.  
  124. struct _GimpParamRegion
  125. {
  126.   gint32 x;
  127.   gint32 y;
  128.   gint32 width;
  129.   gint32 height;
  130. };
  131.  
  132. union _GimpParamData
  133. {
  134.   gint32            d_int32;
  135.   gint16            d_int16;
  136.   gint8             d_int8;
  137.   gdouble           d_float;
  138.   gchar            *d_string;
  139.   gint32           *d_int32array;
  140.   gint16           *d_int16array;
  141.   gint8            *d_int8array;
  142.   gdouble          *d_floatarray;
  143.   gchar           **d_stringarray;
  144.   GimpParamColor    d_color;
  145.   GimpParamRegion   d_region;
  146.   gint32            d_display;
  147.   gint32            d_image;
  148.   gint32            d_layer;
  149.   gint32            d_layer_mask;
  150.   gint32            d_channel;
  151.   gint32            d_drawable;
  152.   gint32            d_selection;
  153.   gint32            d_boundary;
  154.   gint32            d_path;
  155.   gint32            d_unit;
  156.   GimpParasite      d_parasite;
  157.   gint32            d_tattoo;
  158.   GimpPDBStatusType d_status;
  159. };
  160.  
  161. struct _GimpParam
  162. {
  163.   GimpPDBArgType type;
  164.   GimpParamData  data;
  165. };
  166.  
  167.  
  168.  
  169. #ifdef G_OS_WIN32
  170.  
  171. #ifdef __cplusplus
  172. extern "C" {
  173. #endif
  174. void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178.  
  179. /* Define WinMain() because plug-ins are built as GUI applications. Also
  180.  * define a main() in case some plug-in still is built as a console
  181.  * application.
  182.  */
  183. #  ifdef __GNUC__
  184. #    ifndef _stdcall
  185. #      define _stdcall __attribute__((stdcall))
  186. #    endif
  187. #  endif
  188.  
  189. #  define MAIN()            \
  190.    static int                \
  191.    win32_gimp_main (int argc, char **argv)    \
  192.    {                    \
  193.      set_gimp_PLUG_IN_INFO_PTR(&PLUG_IN_INFO);    \
  194.      return gimp_main (argc, argv);    \
  195.    }                    \
  196.                     \
  197.    struct HINSTANCE__;            \
  198.    int _stdcall                \
  199.    WinMain (struct HINSTANCE__ *hInstance, \
  200.         struct HINSTANCE__ *hPrevInstance,    \
  201.         char *lpszCmdLine,        \
  202.         int   nCmdShow)        \
  203.    {                    \
  204.      return win32_gimp_main (__argc, __argv);    \
  205.    }                    \
  206.                     \
  207.    int                    \
  208.    main (int argc, char *argv[])    \
  209.    {                    \
  210.      return win32_gimp_main (argc, argv);    \
  211.    }
  212. #else
  213. #ifndef __EMX__
  214. #  define MAIN()            \
  215.    int                    \
  216.    main (int argc, char *argv[])    \
  217.    {                    \
  218.      return gimp_main (argc, argv);    \
  219.    }
  220. #else
  221. #  define MAIN()                \
  222.    int                        \
  223.    main (int argc, char *argv[])        \
  224.    {                        \
  225.      set_gimp_PLUG_IN_INFO(&PLUG_IN_INFO);    \
  226.      return gimp_main (argc, argv);        \
  227.    }
  228. #endif
  229. #endif
  230.  
  231.  
  232. /* The main procedure that should be called with the
  233.  *  'argc' and 'argv' that are passed to "main".
  234.  */
  235. gint        gimp_main                (gint      argc,
  236.                       gchar    *argv[]);
  237.  
  238. /* Forcefully causes the gimp library to exit and
  239.  *  close down its connection to main gimp application.
  240.  */
  241. void G_GNUC_NORETURN gimp_quit       (void);
  242.  
  243. /* Returns the default gdisplay (given at plug-in config time).
  244.  */
  245. gint32      gimp_default_display     (void);
  246.  
  247.  
  248. /* Install a procedure in the procedure database.
  249.  */
  250. void        gimp_install_procedure   (gchar        *name,
  251.                       gchar        *blurb,
  252.                       gchar        *help,
  253.                       gchar        *author,
  254.                       gchar        *copyright,
  255.                       gchar        *date,
  256.                       gchar        *menu_path,
  257.                       gchar        *image_types,
  258.                       gint          type,
  259.                       gint          nparams,
  260.                       gint          nreturn_vals,
  261.                       GimpParamDef *params,
  262.                       GimpParamDef *return_vals);
  263.  
  264. /* Install a temporary procedure in the procedure database.
  265.  */
  266. void        gimp_install_temp_proc   (gchar        *name,
  267.                       gchar        *blurb,
  268.                       gchar        *help,
  269.                       gchar        *author,
  270.                       gchar        *copyright,
  271.                       gchar        *date,
  272.                       gchar        *menu_path,
  273.                       gchar        *image_types,
  274.                       gint          type,
  275.                       gint          nparams,
  276.                       gint          nreturn_vals,
  277.                       GimpParamDef *params,
  278.                       GimpParamDef *return_vals,
  279.                       GimpRunProc   run_proc);
  280.  
  281. /* Uninstall a temporary procedure
  282.  */
  283. void        gimp_uninstall_temp_proc (gchar        *name);
  284.  
  285. /* Run a procedure in the procedure database. The parameters are
  286.  *  specified via the variable length argument list. The return
  287.  *  values are returned in the 'GimpParam*' array.
  288.  */
  289. GimpParam * gimp_run_procedure     (gchar     *name,
  290.                     gint      *nreturn_vals,
  291.                     ...);
  292.  
  293. /* Run a procedure in the procedure database. The parameters are
  294.  *  specified as an array of GimpParam.  The return
  295.  *  values are returned in the 'GimpParam*' array.
  296.  */
  297. GimpParam * gimp_run_procedure2    (gchar     *name,
  298.                     gint      *nreturn_vals,
  299.                     gint       nparams,
  300.                     GimpParam *params);
  301.  
  302. /* Destroy the an array of parameters. This is useful for
  303.  *  destroying the return values returned by a call to
  304.  *  'gimp_run_procedure'.
  305.  */
  306. void        gimp_destroy_params    (GimpParam    *params,
  307.                     gint          nparams);
  308.  
  309. /* Destroy the an array of GimpParamDef's. This is useful for
  310.  *  destroying the return values returned by a call to
  311.  *  'gimp_query_procedure'.
  312.  */
  313. void        gimp_destroy_paramdefs (GimpParamDef *paramdefs,
  314.                     gint          nparams);
  315.  
  316. gdouble     gimp_gamma             (void);
  317. gboolean    gimp_install_cmap      (void);
  318. gboolean    gimp_use_xshm          (void);
  319. guchar    * gimp_color_cube        (void);
  320. gint        gimp_min_colors        (void);
  321.  
  322. gchar     * gimp_get_progname      (void);
  323.  
  324.  
  325. #ifdef __cplusplus
  326. }
  327. #endif /* __cplusplus */
  328.  
  329. #endif /* __GIMP_H__ */
  330.