mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 19:43:01 +00:00
872c501ee6
2005-03-03 Manish Singh <yosh@gimp.org> * plug-ins/pygimp/pygimp.h: Make a compatibility wrapper for PyBool_FromLong for pre-2.3 versions of python. * plug-ins/pygimp/gimpfu.py * plug-ins/pygimp/gimpui.py: Update to use some more modern python features. * plug-ins/pygimp/gimpmodule.c * plug-ins/pygimp/pygimp-display.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/pygimp/pygimp-image.c * plug-ins/pygimp/pygimp-parasite.c * plug-ins/pygimp/pygimp-pdb.c * plug-ins/pygimp/pygimp-tile.c: Throw exceptions on failures for libgimp wrappers (fixes bug #160136), and make the exception strings a lot more descriptive to aid debugging. Also return proper Bools when appropriate. Some new API wrapped as well. Still a work in progress. * plug-ins/pygimp/gimpplugin.py * plug-ins/pygimp/gimpshelf.py * plug-ins/pygimp/plug-ins/clothify.py * plug-ins/pygimp/plug-ins/foggify.py * plug-ins/pygimp/plug-ins/sphere.py: Add some whitespace to make things more readable.
124 lines
3.8 KiB
C
124 lines
3.8 KiB
C
/* -*- Mode: C; c-basic-offset: 4 -*-
|
|
Gimp-Python - allows the writing of Gimp plugins in Python.
|
|
Copyright (C) 1997-2002 James Henstridge <james@daa.com.au>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#ifndef _PYGIMP_H_
|
|
#define _PYGIMP_H_
|
|
|
|
#include <Python.h>
|
|
|
|
#if PY_VERSION_HEX < 0x020300F0
|
|
#define PyBool_FromLong(v) PyInt_FromLong((v) ? 1L : 0L);
|
|
#endif
|
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
extern PyObject *pygimp_error;
|
|
|
|
PyObject *pygimp_param_to_tuple(int nparams, const GimpParam *params);
|
|
GimpParam *pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype,
|
|
int nparams);
|
|
|
|
|
|
extern PyTypeObject PyGimpPDB_Type;
|
|
#define pygimp_pdb_check(v) (PyObject_TypeCheck(v, &PyGimpPDB_Type))
|
|
PyObject *pygimp_pdb_new(void);
|
|
|
|
extern PyTypeObject PyGimpPDBFunction_Type;
|
|
#define pygimp_pdb_function_check(v) (PyObject_TypeCheck(v, &PyGimpPDBFunction_Type))
|
|
PyObject *pygimp_pdb_function_new(const char *name, const char *blurb,
|
|
const char *help, const char *author,
|
|
const char *copyright, const char *date,
|
|
GimpPDBProcType proc_type,
|
|
int n_params, int n_return_vals,
|
|
GimpParamDef *params,
|
|
GimpParamDef *return_vals);
|
|
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
gint32 ID;
|
|
} PyGimpImage;
|
|
|
|
extern PyTypeObject PyGimpImage_Type;
|
|
#define pygimp_image_check(v) (PyObject_TypeCheck(v, &PyGimpImage_Type))
|
|
PyObject *pygimp_image_new(gint32 ID);
|
|
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
gint32 ID;
|
|
} PyGimpDisplay;
|
|
|
|
extern PyTypeObject PyGimpDisplay_Type;
|
|
#define pygimp_display_check(v) (PyObject_TypeCheck(v, &PyGimpDisplay_Type))
|
|
PyObject *pygimp_display_new(gint32 ID);
|
|
|
|
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
gint32 ID;
|
|
GimpDrawable *drawable;
|
|
} PyGimpDrawable, PyGimpLayer, PyGimpChannel;
|
|
|
|
extern PyTypeObject PyGimpDrawable_Type;
|
|
#define pygimp_drawable_check(v) (PyObject_TypeCheck(v, &PyGimpDrawable_Type))
|
|
PyObject *pygimp_drawable_new(GimpDrawable *drawable, gint32 ID);
|
|
|
|
extern PyTypeObject PyGimpLayer_Type;
|
|
#define pygimp_layer_check(v) (PyObject_TypeCheck(v, &PyGimpLayer_Type))
|
|
PyObject *pygimp_layer_new(gint32 ID);
|
|
|
|
extern PyTypeObject PyGimpChannel_Type;
|
|
#define pygimp_channel_check(v) (PyObject_TypeCheck(v, &PyGimpChannel_Type))
|
|
PyObject *pygimp_channel_new(gint32 ID);
|
|
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
GimpTile *tile;
|
|
PyGimpDrawable *drawable; /* we keep a reference to the drawable */
|
|
} PyGimpTile;
|
|
|
|
extern PyTypeObject PyGimpTile_Type;
|
|
#define pygimp_tile_check(v) (PyObject_TypeCheck(v, &PyGimpTile_Type))
|
|
PyObject *pygimp_tile_new(GimpTile *tile, PyGimpDrawable *drw);
|
|
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
GimpPixelRgn pr;
|
|
PyGimpDrawable *drawable; /* keep the drawable around */
|
|
} PyGimpPixelRgn;
|
|
|
|
extern PyTypeObject PyGimpPixelRgn_Type;
|
|
#define pygimp_pixel_rgn_check(v) (PyObject_TypeCheck(v, &PyGimpPixelRgn_Type))
|
|
PyObject *pygimp_pixel_rgn_new(PyGimpDrawable *drw, int x, int y,
|
|
int w, int h, int dirty, int shadow);
|
|
|
|
typedef struct {
|
|
PyObject_HEAD
|
|
GimpParasite *para;
|
|
} PyGimpParasite;
|
|
|
|
extern PyTypeObject PyGimpParasite_Type;
|
|
#define pygimp_parasite_check(v) (PyObject_TypeCheck(v, &Paratype))
|
|
PyObject *pygimp_parasite_new(GimpParasite *para);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|