1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3  *
4  * gimpimagegrid_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 3 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, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 /* NOTE: This file is auto-generated by pdbgen.pl */
22 
23 #include "config.h"
24 
25 #include "gimp.h"
26 
27 
28 /**
29  * SECTION: gimpimagegrid
30  * @title: gimpimagegrid
31  * @short_description: Functions manuipulating an image's grid.
32  *
33  * Functions manuipulating an image's grid.
34  **/
35 
36 
37 /**
38  * gimp_image_grid_get_spacing:
39  * @image_ID: The image.
40  * @xspacing: The image's grid horizontal spacing.
41  * @yspacing: The image's grid vertical spacing.
42  *
43  * Gets the spacing of an image's grid.
44  *
45  * This procedure retrieves the horizontal and vertical spacing of an
46  * image's grid. It takes the image as parameter.
47  *
48  * Returns: TRUE on success.
49  *
50  * Since: 2.4
51  **/
52 gboolean
gimp_image_grid_get_spacing(gint32 image_ID,gdouble * xspacing,gdouble * yspacing)53 gimp_image_grid_get_spacing (gint32   image_ID,
54                              gdouble *xspacing,
55                              gdouble *yspacing)
56 {
57   GimpParam *return_vals;
58   gint nreturn_vals;
59   gboolean success = TRUE;
60 
61   return_vals = gimp_run_procedure ("gimp-image-grid-get-spacing",
62                                     &nreturn_vals,
63                                     GIMP_PDB_IMAGE, image_ID,
64                                     GIMP_PDB_END);
65 
66   *xspacing = 0.0;
67   *yspacing = 0.0;
68 
69   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
70 
71   if (success)
72     {
73       *xspacing = return_vals[1].data.d_float;
74       *yspacing = return_vals[2].data.d_float;
75     }
76 
77   gimp_destroy_params (return_vals, nreturn_vals);
78 
79   return success;
80 }
81 
82 /**
83  * gimp_image_grid_set_spacing:
84  * @image_ID: The image.
85  * @xspacing: The image's grid horizontal spacing.
86  * @yspacing: The image's grid vertical spacing.
87  *
88  * Sets the spacing of an image's grid.
89  *
90  * This procedure sets the horizontal and vertical spacing of an
91  * image's grid.
92  *
93  * Returns: TRUE on success.
94  *
95  * Since: 2.4
96  **/
97 gboolean
gimp_image_grid_set_spacing(gint32 image_ID,gdouble xspacing,gdouble yspacing)98 gimp_image_grid_set_spacing (gint32  image_ID,
99                              gdouble xspacing,
100                              gdouble yspacing)
101 {
102   GimpParam *return_vals;
103   gint nreturn_vals;
104   gboolean success = TRUE;
105 
106   return_vals = gimp_run_procedure ("gimp-image-grid-set-spacing",
107                                     &nreturn_vals,
108                                     GIMP_PDB_IMAGE, image_ID,
109                                     GIMP_PDB_FLOAT, xspacing,
110                                     GIMP_PDB_FLOAT, yspacing,
111                                     GIMP_PDB_END);
112 
113   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
114 
115   gimp_destroy_params (return_vals, nreturn_vals);
116 
117   return success;
118 }
119 
120 /**
121  * gimp_image_grid_get_offset:
122  * @image_ID: The image.
123  * @xoffset: The image's grid horizontal offset.
124  * @yoffset: The image's grid vertical offset.
125  *
126  * Gets the offset of an image's grid.
127  *
128  * This procedure retrieves the horizontal and vertical offset of an
129  * image's grid. It takes the image as parameter.
130  *
131  * Returns: TRUE on success.
132  *
133  * Since: 2.4
134  **/
135 gboolean
gimp_image_grid_get_offset(gint32 image_ID,gdouble * xoffset,gdouble * yoffset)136 gimp_image_grid_get_offset (gint32   image_ID,
137                             gdouble *xoffset,
138                             gdouble *yoffset)
139 {
140   GimpParam *return_vals;
141   gint nreturn_vals;
142   gboolean success = TRUE;
143 
144   return_vals = gimp_run_procedure ("gimp-image-grid-get-offset",
145                                     &nreturn_vals,
146                                     GIMP_PDB_IMAGE, image_ID,
147                                     GIMP_PDB_END);
148 
149   *xoffset = 0.0;
150   *yoffset = 0.0;
151 
152   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
153 
154   if (success)
155     {
156       *xoffset = return_vals[1].data.d_float;
157       *yoffset = return_vals[2].data.d_float;
158     }
159 
160   gimp_destroy_params (return_vals, nreturn_vals);
161 
162   return success;
163 }
164 
165 /**
166  * gimp_image_grid_set_offset:
167  * @image_ID: The image.
168  * @xoffset: The image's grid horizontal offset.
169  * @yoffset: The image's grid vertical offset.
170  *
171  * Sets the offset of an image's grid.
172  *
173  * This procedure sets the horizontal and vertical offset of an image's
174  * grid.
175  *
176  * Returns: TRUE on success.
177  *
178  * Since: 2.4
179  **/
180 gboolean
gimp_image_grid_set_offset(gint32 image_ID,gdouble xoffset,gdouble yoffset)181 gimp_image_grid_set_offset (gint32  image_ID,
182                             gdouble xoffset,
183                             gdouble yoffset)
184 {
185   GimpParam *return_vals;
186   gint nreturn_vals;
187   gboolean success = TRUE;
188 
189   return_vals = gimp_run_procedure ("gimp-image-grid-set-offset",
190                                     &nreturn_vals,
191                                     GIMP_PDB_IMAGE, image_ID,
192                                     GIMP_PDB_FLOAT, xoffset,
193                                     GIMP_PDB_FLOAT, yoffset,
194                                     GIMP_PDB_END);
195 
196   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
197 
198   gimp_destroy_params (return_vals, nreturn_vals);
199 
200   return success;
201 }
202 
203 /**
204  * gimp_image_grid_get_foreground_color:
205  * @image_ID: The image.
206  * @fgcolor: The image's grid foreground color.
207  *
208  * Sets the foreground color of an image's grid.
209  *
210  * This procedure gets the foreground color of an image's grid.
211  *
212  * Returns: TRUE on success.
213  *
214  * Since: 2.4
215  **/
216 gboolean
gimp_image_grid_get_foreground_color(gint32 image_ID,GimpRGB * fgcolor)217 gimp_image_grid_get_foreground_color (gint32   image_ID,
218                                       GimpRGB *fgcolor)
219 {
220   GimpParam *return_vals;
221   gint nreturn_vals;
222   gboolean success = TRUE;
223 
224   return_vals = gimp_run_procedure ("gimp-image-grid-get-foreground-color",
225                                     &nreturn_vals,
226                                     GIMP_PDB_IMAGE, image_ID,
227                                     GIMP_PDB_END);
228 
229   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
230 
231   if (success)
232     *fgcolor = return_vals[1].data.d_color;
233 
234   gimp_destroy_params (return_vals, nreturn_vals);
235 
236   return success;
237 }
238 
239 /**
240  * gimp_image_grid_set_foreground_color:
241  * @image_ID: The image.
242  * @fgcolor: The new foreground color.
243  *
244  * Gets the foreground color of an image's grid.
245  *
246  * This procedure sets the foreground color of an image's grid.
247  *
248  * Returns: TRUE on success.
249  *
250  * Since: 2.4
251  **/
252 gboolean
gimp_image_grid_set_foreground_color(gint32 image_ID,const GimpRGB * fgcolor)253 gimp_image_grid_set_foreground_color (gint32         image_ID,
254                                       const GimpRGB *fgcolor)
255 {
256   GimpParam *return_vals;
257   gint nreturn_vals;
258   gboolean success = TRUE;
259 
260   return_vals = gimp_run_procedure ("gimp-image-grid-set-foreground-color",
261                                     &nreturn_vals,
262                                     GIMP_PDB_IMAGE, image_ID,
263                                     GIMP_PDB_COLOR, fgcolor,
264                                     GIMP_PDB_END);
265 
266   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
267 
268   gimp_destroy_params (return_vals, nreturn_vals);
269 
270   return success;
271 }
272 
273 /**
274  * gimp_image_grid_get_background_color:
275  * @image_ID: The image.
276  * @bgcolor: The image's grid background color.
277  *
278  * Sets the background color of an image's grid.
279  *
280  * This procedure gets the background color of an image's grid.
281  *
282  * Returns: TRUE on success.
283  *
284  * Since: 2.4
285  **/
286 gboolean
gimp_image_grid_get_background_color(gint32 image_ID,GimpRGB * bgcolor)287 gimp_image_grid_get_background_color (gint32   image_ID,
288                                       GimpRGB *bgcolor)
289 {
290   GimpParam *return_vals;
291   gint nreturn_vals;
292   gboolean success = TRUE;
293 
294   return_vals = gimp_run_procedure ("gimp-image-grid-get-background-color",
295                                     &nreturn_vals,
296                                     GIMP_PDB_IMAGE, image_ID,
297                                     GIMP_PDB_END);
298 
299   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
300 
301   if (success)
302     *bgcolor = return_vals[1].data.d_color;
303 
304   gimp_destroy_params (return_vals, nreturn_vals);
305 
306   return success;
307 }
308 
309 /**
310  * gimp_image_grid_set_background_color:
311  * @image_ID: The image.
312  * @bgcolor: The new background color.
313  *
314  * Gets the background color of an image's grid.
315  *
316  * This procedure sets the background color of an image's grid.
317  *
318  * Returns: TRUE on success.
319  *
320  * Since: 2.4
321  **/
322 gboolean
gimp_image_grid_set_background_color(gint32 image_ID,const GimpRGB * bgcolor)323 gimp_image_grid_set_background_color (gint32         image_ID,
324                                       const GimpRGB *bgcolor)
325 {
326   GimpParam *return_vals;
327   gint nreturn_vals;
328   gboolean success = TRUE;
329 
330   return_vals = gimp_run_procedure ("gimp-image-grid-set-background-color",
331                                     &nreturn_vals,
332                                     GIMP_PDB_IMAGE, image_ID,
333                                     GIMP_PDB_COLOR, bgcolor,
334                                     GIMP_PDB_END);
335 
336   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
337 
338   gimp_destroy_params (return_vals, nreturn_vals);
339 
340   return success;
341 }
342 
343 /**
344  * gimp_image_grid_get_style:
345  * @image_ID: The image.
346  *
347  * Gets the style of an image's grid.
348  *
349  * This procedure retrieves the style of an image's grid.
350  *
351  * Returns: The image's grid style.
352  *
353  * Since: 2.4
354  **/
355 GimpGridStyle
gimp_image_grid_get_style(gint32 image_ID)356 gimp_image_grid_get_style (gint32 image_ID)
357 {
358   GimpParam *return_vals;
359   gint nreturn_vals;
360   GimpGridStyle style = 0;
361 
362   return_vals = gimp_run_procedure ("gimp-image-grid-get-style",
363                                     &nreturn_vals,
364                                     GIMP_PDB_IMAGE, image_ID,
365                                     GIMP_PDB_END);
366 
367   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
368     style = return_vals[1].data.d_int32;
369 
370   gimp_destroy_params (return_vals, nreturn_vals);
371 
372   return style;
373 }
374 
375 /**
376  * gimp_image_grid_set_style:
377  * @image_ID: The image.
378  * @style: The image's grid style.
379  *
380  * Sets the style unit of an image's grid.
381  *
382  * This procedure sets the style of an image's grid. It takes the image
383  * and the new style as parameters.
384  *
385  * Returns: TRUE on success.
386  *
387  * Since: 2.4
388  **/
389 gboolean
gimp_image_grid_set_style(gint32 image_ID,GimpGridStyle style)390 gimp_image_grid_set_style (gint32        image_ID,
391                            GimpGridStyle style)
392 {
393   GimpParam *return_vals;
394   gint nreturn_vals;
395   gboolean success = TRUE;
396 
397   return_vals = gimp_run_procedure ("gimp-image-grid-set-style",
398                                     &nreturn_vals,
399                                     GIMP_PDB_IMAGE, image_ID,
400                                     GIMP_PDB_INT32, style,
401                                     GIMP_PDB_END);
402 
403   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
404 
405   gimp_destroy_params (return_vals, nreturn_vals);
406 
407   return success;
408 }
409