1 /* -*- Mode: C; c-basic-offset: 4 -*- 2 * Gimp-Python - allows the writing of Gimp plugins in Python. 3 * Copyright (C) 1997-2002 James Henstridge <james@daa.com.au> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef _PYGIMP_H_ 20 #define _PYGIMP_H_ 21 22 #include <Python.h> 23 24 #include <libgimp/gimp.h> 25 26 #define _INSIDE_PYGIMP_ 27 #include "pygimp-api.h" 28 29 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) 30 typedef int Py_ssize_t; 31 #define PY_SSIZE_T_MAX INT_MAX 32 #define PY_SSIZE_T_MIN INT_MIN 33 #define PyInt_AsSsize_t(o) PyInt_AsLong(o) 34 #endif 35 36 G_BEGIN_DECLS 37 38 extern PyObject *pygimp_error; 39 40 PyObject *pygimp_param_to_tuple(int nparams, const GimpParam *params); 41 GimpParam *pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, 42 int nparams); 43 44 45 extern PyTypeObject PyGimpPDB_Type; 46 #define pygimp_pdb_check(v) (PyObject_TypeCheck(v, &PyGimpPDB_Type)) 47 PyObject *pygimp_pdb_new(void); 48 49 extern PyTypeObject PyGimpPDBFunction_Type; 50 #define pygimp_pdb_function_check(v) (PyObject_TypeCheck(v, &PyGimpPDBFunction_Type)) 51 PyObject *pygimp_pdb_function_new(const char *name, const char *blurb, 52 const char *help, const char *author, 53 const char *copyright, const char *date, 54 GimpPDBProcType proc_type, 55 int n_params, int n_return_vals, 56 GimpParamDef *params, 57 GimpParamDef *return_vals); 58 59 extern PyTypeObject PyGimpImage_Type; 60 #define pygimp_image_check(v) (PyObject_TypeCheck(v, &PyGimpImage_Type)) 61 PyObject *pygimp_image_new(gint32 ID); 62 63 extern PyTypeObject PyGimpDisplay_Type; 64 #define pygimp_display_check(v) (PyObject_TypeCheck(v, &PyGimpDisplay_Type)) 65 PyObject *pygimp_display_new(gint32 ID); 66 67 extern PyTypeObject PyGimpItem_Type; 68 #define pygimp_item_check(v) (PyObject_TypeCheck(v, &PyGimpItem_Type)) 69 PyObject *pygimp_item_new(gint32 ID); 70 71 extern PyTypeObject PyGimpDrawable_Type; 72 #define pygimp_drawable_check(v) (PyObject_TypeCheck(v, &PyGimpDrawable_Type)) 73 PyObject *pygimp_drawable_new(GimpDrawable *drawable, gint32 ID); 74 75 extern PyTypeObject PyGimpLayer_Type; 76 #define pygimp_layer_check(v) (PyObject_TypeCheck(v, &PyGimpLayer_Type)) 77 PyObject *pygimp_layer_new(gint32 ID); 78 79 extern PyTypeObject PyGimpGroupLayer_Type; 80 #define pygimp_layer__group_check(v) (PyObject_TypeCheck(v, &PyGimpGroupLayer_Type)) 81 PyObject *pygimp_group_layer_new(gint32 ID); 82 83 extern PyTypeObject PyGimpChannel_Type; 84 #define pygimp_channel_check(v) (PyObject_TypeCheck(v, &PyGimpChannel_Type)) 85 PyObject *pygimp_channel_new(gint32 ID); 86 87 typedef struct { 88 PyObject_HEAD 89 GimpTile *tile; 90 PyGimpDrawable *drawable; /* we keep a reference to the drawable */ 91 } PyGimpTile; 92 93 extern PyTypeObject PyGimpTile_Type; 94 #define pygimp_tile_check(v) (PyObject_TypeCheck(v, &PyGimpTile_Type)) 95 PyObject *pygimp_tile_new(GimpTile *tile, PyGimpDrawable *drw); 96 97 typedef struct { 98 PyObject_HEAD 99 GimpPixelRgn pr; 100 PyGimpDrawable *drawable; /* keep the drawable around */ 101 } PyGimpPixelRgn; 102 103 extern PyTypeObject PyGimpPixelRgn_Type; 104 #define pygimp_pixel_rgn_check(v) (PyObject_TypeCheck(v, &PyGimpPixelRgn_Type)) 105 PyObject *pygimp_pixel_rgn_new(PyGimpDrawable *drw, int x, int y, 106 int w, int h, int dirty, int shadow); 107 108 typedef struct { 109 PyObject_HEAD 110 GimpParasite *para; 111 } PyGimpParasite; 112 113 extern PyTypeObject PyGimpParasite_Type; 114 #define pygimp_parasite_check(v) (PyObject_TypeCheck(v, &PyGimpParasite_Type)) 115 PyObject *pygimp_parasite_new(GimpParasite *para); 116 117 extern PyTypeObject PyGimpVectors_Type; 118 #define pygimp_vectors_check(v) (PyObject_TypeCheck(v, &PyGimpVectors_Type)) 119 PyObject *pygimp_vectors_new(gint32 vectors_ID); 120 121 extern PyTypeObject PyGimpVectorsStroke_Type; 122 extern PyTypeObject PyGimpVectorsBezierStroke_Type; 123 124 typedef struct { 125 PyObject_HEAD 126 GimpPixelFetcher *pf; 127 PyGimpDrawable *drawable; /* keep the drawable around */ 128 gboolean shadow; 129 GimpRGB bg_color; 130 GimpPixelFetcherEdgeMode edge_mode; 131 int bpp; 132 } PyGimpPixelFetcher; 133 134 extern PyTypeObject PyGimpPixelFetcher_Type; 135 #define pygimp_pixel_fetcher_check(v) (PyObject_TypeCheck(v, &PyGimpPixelFetcher_Type)) 136 137 G_END_DECLS 138 139 #endif 140