~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

Viewing changes to libgimp/gimpchannel_pdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * gimpchannel_pdb.c
 
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
/* NOTE: This file is autogenerated by pdbgen.pl */
 
23
 
 
24
#include "config.h"
 
25
 
 
26
#include "gimp.h"
 
27
 
 
28
/**
 
29
 * _gimp_channel_new:
 
30
 * @image_ID: The image to which to add the channel.
 
31
 * @width: The channel width.
 
32
 * @height: The channel height.
 
33
 * @name: The channel name.
 
34
 * @opacity: The channel opacity.
 
35
 * @color: The channel compositing color.
 
36
 *
 
37
 * Create a new channel.
 
38
 *
 
39
 * This procedure creates a new channel with the specified width and
 
40
 * height. Name, opacity, and color are also supplied parameters. The
 
41
 * new channel still needs to be added to the image, as this is not
 
42
 * automatic. Add the new channel with the 'gimp_image_add_channel'
 
43
 * command. Other attributes such as channel show masked, should be set
 
44
 * with explicit procedure calls. The channel's contents are undefined
 
45
 * initially.
 
46
 *
 
47
 * Returns: The newly created channel.
 
48
 */
 
49
gint32
 
50
_gimp_channel_new (gint32         image_ID,
 
51
                   gint           width,
 
52
                   gint           height,
 
53
                   const gchar   *name,
 
54
                   gdouble        opacity,
 
55
                   const GimpRGB *color)
 
56
{
 
57
  GimpParam *return_vals;
 
58
  gint nreturn_vals;
 
59
  gint32 channel_ID = -1;
 
60
 
 
61
  return_vals = gimp_run_procedure ("gimp_channel_new",
 
62
                                    &nreturn_vals,
 
63
                                    GIMP_PDB_IMAGE, image_ID,
 
64
                                    GIMP_PDB_INT32, width,
 
65
                                    GIMP_PDB_INT32, height,
 
66
                                    GIMP_PDB_STRING, name,
 
67
                                    GIMP_PDB_FLOAT, opacity,
 
68
                                    GIMP_PDB_COLOR, color,
 
69
                                    GIMP_PDB_END);
 
70
 
 
71
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
72
    channel_ID = return_vals[1].data.d_channel;
 
73
 
 
74
  gimp_destroy_params (return_vals, nreturn_vals);
 
75
 
 
76
  return channel_ID;
 
77
}
 
78
 
 
79
/**
 
80
 * gimp_channel_copy:
 
81
 * @channel_ID: The channel to copy.
 
82
 *
 
83
 * Copy a channel.
 
84
 *
 
85
 * This procedure copies the specified channel and returns the copy.
 
86
 *
 
87
 * Returns: The newly copied channel.
 
88
 */
 
89
gint32
 
90
gimp_channel_copy (gint32 channel_ID)
 
91
{
 
92
  GimpParam *return_vals;
 
93
  gint nreturn_vals;
 
94
  gint32 channel_copy_ID = -1;
 
95
 
 
96
  return_vals = gimp_run_procedure ("gimp_channel_copy",
 
97
                                    &nreturn_vals,
 
98
                                    GIMP_PDB_CHANNEL, channel_ID,
 
99
                                    GIMP_PDB_END);
 
100
 
 
101
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
102
    channel_copy_ID = return_vals[1].data.d_channel;
 
103
 
 
104
  gimp_destroy_params (return_vals, nreturn_vals);
 
105
 
 
106
  return channel_copy_ID;
 
107
}
 
108
 
 
109
/**
 
110
 * gimp_channel_combine_masks:
 
111
 * @channel1_ID: The channel1.
 
112
 * @channel2_ID: The channel2.
 
113
 * @operation: The selection operation.
 
114
 * @offx: x offset between upper left corner of channels: (second - first).
 
115
 * @offy: y offset between upper left corner of channels: (second - first).
 
116
 *
 
117
 * Combine two channel masks.
 
118
 *
 
119
 * This procedure combines two channel masks. The result is stored in
 
120
 * the first channel.
 
121
 *
 
122
 * Returns: TRUE on success.
 
123
 */
 
124
gboolean
 
125
gimp_channel_combine_masks (gint32         channel1_ID,
 
126
                            gint32         channel2_ID,
 
127
                            GimpChannelOps operation,
 
128
                            gint           offx,
 
129
                            gint           offy)
 
130
{
 
131
  GimpParam *return_vals;
 
132
  gint nreturn_vals;
 
133
  gboolean success = TRUE;
 
134
 
 
135
  return_vals = gimp_run_procedure ("gimp_channel_combine_masks",
 
136
                                    &nreturn_vals,
 
137
                                    GIMP_PDB_CHANNEL, channel1_ID,
 
138
                                    GIMP_PDB_CHANNEL, channel2_ID,
 
139
                                    GIMP_PDB_INT32, operation,
 
140
                                    GIMP_PDB_INT32, offx,
 
141
                                    GIMP_PDB_INT32, offy,
 
142
                                    GIMP_PDB_END);
 
143
 
 
144
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
145
 
 
146
  gimp_destroy_params (return_vals, nreturn_vals);
 
147
 
 
148
  return success;
 
149
}
 
150
 
 
151
/**
 
152
 * gimp_channel_get_show_masked:
 
153
 * @channel_ID: The channel.
 
154
 *
 
155
 * Get the composite method of the specified channel.
 
156
 *
 
157
 * This procedure returns the specified channel's composite method. If
 
158
 * it is non-zero, then the channel is composited with the image so
 
159
 * that masked regions are shown. Otherwise, selected regions are
 
160
 * shown.
 
161
 *
 
162
 * Returns: The channel composite method.
 
163
 */
 
164
gboolean
 
165
gimp_channel_get_show_masked (gint32 channel_ID)
 
166
{
 
167
  GimpParam *return_vals;
 
168
  gint nreturn_vals;
 
169
  gboolean show_masked = FALSE;
 
170
 
 
171
  return_vals = gimp_run_procedure ("gimp_channel_get_show_masked",
 
172
                                    &nreturn_vals,
 
173
                                    GIMP_PDB_CHANNEL, channel_ID,
 
174
                                    GIMP_PDB_END);
 
175
 
 
176
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
177
    show_masked = return_vals[1].data.d_int32;
 
178
 
 
179
  gimp_destroy_params (return_vals, nreturn_vals);
 
180
 
 
181
  return show_masked;
 
182
}
 
183
 
 
184
/**
 
185
 * gimp_channel_set_show_masked:
 
186
 * @channel_ID: The channel.
 
187
 * @show_masked: The new channel composite method.
 
188
 *
 
189
 * Set the composite method of the specified channel.
 
190
 *
 
191
 * This procedure sets the specified channel's composite method. If it
 
192
 * is non-zero, then the channel is composited with the image so that
 
193
 * masked regions are shown. Otherwise, selected regions are shown.
 
194
 *
 
195
 * Returns: TRUE on success.
 
196
 */
 
197
gboolean
 
198
gimp_channel_set_show_masked (gint32   channel_ID,
 
199
                              gboolean show_masked)
 
200
{
 
201
  GimpParam *return_vals;
 
202
  gint nreturn_vals;
 
203
  gboolean success = TRUE;
 
204
 
 
205
  return_vals = gimp_run_procedure ("gimp_channel_set_show_masked",
 
206
                                    &nreturn_vals,
 
207
                                    GIMP_PDB_CHANNEL, channel_ID,
 
208
                                    GIMP_PDB_INT32, show_masked,
 
209
                                    GIMP_PDB_END);
 
210
 
 
211
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
212
 
 
213
  gimp_destroy_params (return_vals, nreturn_vals);
 
214
 
 
215
  return success;
 
216
}
 
217
 
 
218
/**
 
219
 * gimp_channel_get_opacity:
 
220
 * @channel_ID: The channel.
 
221
 *
 
222
 * Get the opacity of the specified channel.
 
223
 *
 
224
 * This procedure returns the specified channel's opacity.
 
225
 *
 
226
 * Returns: The channel opacity.
 
227
 */
 
228
gdouble
 
229
gimp_channel_get_opacity (gint32 channel_ID)
 
230
{
 
231
  GimpParam *return_vals;
 
232
  gint nreturn_vals;
 
233
  gdouble opacity = 0;
 
234
 
 
235
  return_vals = gimp_run_procedure ("gimp_channel_get_opacity",
 
236
                                    &nreturn_vals,
 
237
                                    GIMP_PDB_CHANNEL, channel_ID,
 
238
                                    GIMP_PDB_END);
 
239
 
 
240
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
241
    opacity = return_vals[1].data.d_float;
 
242
 
 
243
  gimp_destroy_params (return_vals, nreturn_vals);
 
244
 
 
245
  return opacity;
 
246
}
 
247
 
 
248
/**
 
249
 * gimp_channel_set_opacity:
 
250
 * @channel_ID: The channel.
 
251
 * @opacity: The new channel opacity.
 
252
 *
 
253
 * Set the opacity of the specified channel.
 
254
 *
 
255
 * This procedure sets the specified channel's opacity.
 
256
 *
 
257
 * Returns: TRUE on success.
 
258
 */
 
259
gboolean
 
260
gimp_channel_set_opacity (gint32  channel_ID,
 
261
                          gdouble opacity)
 
262
{
 
263
  GimpParam *return_vals;
 
264
  gint nreturn_vals;
 
265
  gboolean success = TRUE;
 
266
 
 
267
  return_vals = gimp_run_procedure ("gimp_channel_set_opacity",
 
268
                                    &nreturn_vals,
 
269
                                    GIMP_PDB_CHANNEL, channel_ID,
 
270
                                    GIMP_PDB_FLOAT, opacity,
 
271
                                    GIMP_PDB_END);
 
272
 
 
273
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
274
 
 
275
  gimp_destroy_params (return_vals, nreturn_vals);
 
276
 
 
277
  return success;
 
278
}
 
279
 
 
280
/**
 
281
 * gimp_channel_get_color:
 
282
 * @channel_ID: The channel.
 
283
 * @color: The channel compositing color.
 
284
 *
 
285
 * Get the compositing color of the specified channel.
 
286
 *
 
287
 * This procedure returns the specified channel's compositing color.
 
288
 *
 
289
 * Returns: TRUE on success.
 
290
 */
 
291
gboolean
 
292
gimp_channel_get_color (gint32   channel_ID,
 
293
                        GimpRGB *color)
 
294
{
 
295
  GimpParam *return_vals;
 
296
  gint nreturn_vals;
 
297
  gboolean success = TRUE;
 
298
 
 
299
  return_vals = gimp_run_procedure ("gimp_channel_get_color",
 
300
                                    &nreturn_vals,
 
301
                                    GIMP_PDB_CHANNEL, channel_ID,
 
302
                                    GIMP_PDB_END);
 
303
 
 
304
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
305
 
 
306
  if (success)
 
307
    *color = return_vals[1].data.d_color;
 
308
 
 
309
  gimp_destroy_params (return_vals, nreturn_vals);
 
310
 
 
311
  return success;
 
312
}
 
313
 
 
314
/**
 
315
 * gimp_channel_set_color:
 
316
 * @channel_ID: The channel.
 
317
 * @color: The new channel compositing color.
 
318
 *
 
319
 * Set the compositing color of the specified channel.
 
320
 *
 
321
 * This procedure sets the specified channel's compositing color.
 
322
 *
 
323
 * Returns: TRUE on success.
 
324
 */
 
325
gboolean
 
326
gimp_channel_set_color (gint32         channel_ID,
 
327
                        const GimpRGB *color)
 
328
{
 
329
  GimpParam *return_vals;
 
330
  gint nreturn_vals;
 
331
  gboolean success = TRUE;
 
332
 
 
333
  return_vals = gimp_run_procedure ("gimp_channel_set_color",
 
334
                                    &nreturn_vals,
 
335
                                    GIMP_PDB_CHANNEL, channel_ID,
 
336
                                    GIMP_PDB_COLOR, color,
 
337
                                    GIMP_PDB_END);
 
338
 
 
339
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
340
 
 
341
  gimp_destroy_params (return_vals, nreturn_vals);
 
342
 
 
343
  return success;
 
344
}