summaryrefslogtreecommitdiffstats
path: root/plug-ins/pygimp/pygimp.h
blob: c7d927bb19deaeddc7f18bd5cfc7f7640468caeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* -*- 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 3 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, see <https://www.gnu.org/licenses/>.
 */

#ifndef _PYGIMP_H_
#define _PYGIMP_H_

#include <Python.h>

#include <libgimp/gimp.h>

#define _INSIDE_PYGIMP_
#include "pygimp-api.h"

#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
#endif

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);

extern PyTypeObject PyGimpImage_Type;
#define pygimp_image_check(v) (PyObject_TypeCheck(v, &PyGimpImage_Type))
PyObject *pygimp_image_new(gint32 ID);

extern PyTypeObject PyGimpDisplay_Type;
#define pygimp_display_check(v) (PyObject_TypeCheck(v, &PyGimpDisplay_Type))
PyObject *pygimp_display_new(gint32 ID);

extern PyTypeObject PyGimpItem_Type;
#define pygimp_item_check(v) (PyObject_TypeCheck(v, &PyGimpItem_Type))
PyObject *pygimp_item_new(gint32 ID);

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 PyGimpGroupLayer_Type;
#define pygimp_layer__group_check(v) (PyObject_TypeCheck(v, &PyGimpGroupLayer_Type))
PyObject *pygimp_group_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, &PyGimpParasite_Type))
PyObject *pygimp_parasite_new(GimpParasite *para);

extern PyTypeObject PyGimpVectors_Type;
#define pygimp_vectors_check(v) (PyObject_TypeCheck(v, &PyGimpVectors_Type))
PyObject *pygimp_vectors_new(gint32 vectors_ID);

extern PyTypeObject PyGimpVectorsStroke_Type;
extern PyTypeObject PyGimpVectorsBezierStroke_Type;

typedef struct {
    PyObject_HEAD
    GimpPixelFetcher *pf;
    PyGimpDrawable *drawable; /* keep the drawable around */
    gboolean shadow;
    GimpRGB bg_color;
    GimpPixelFetcherEdgeMode edge_mode;
    int bpp;
} PyGimpPixelFetcher;

extern PyTypeObject PyGimpPixelFetcher_Type;
#define pygimp_pixel_fetcher_check(v) (PyObject_TypeCheck(v, &PyGimpPixelFetcher_Type))

G_END_DECLS

#endif