app: s/sprintf/g_snprintf/ in xcf_save_image()
[gimp.git] / libgimp / gimpbuffer_pdb.c
blobafe8ee09b3dfa44f8dd5a7e1e34802747e5ac3a9
1 /* LIBGIMP - The GIMP Library
2 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
4 * gimpbuffer_pdb.c
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.
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.
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/>.
21 /* NOTE: This file is auto-generated by pdbgen.pl */
23 #include "config.h"
25 #include "gimp.h"
28 /**
29 * SECTION: gimpbuffer
30 * @title: gimpbuffer
31 * @short_description: Functions for manipulating cut buffers.
33 * Functions related to named cut buffers.
34 **/
37 /**
38 * gimp_buffers_get_list:
39 * @filter: An optional regular expression used to filter the list.
40 * @num_buffers: The number of buffers.
42 * Retrieve a complete listing of the available buffers.
44 * This procedure returns a complete listing of available named
45 * buffers.
47 * Returns: The list of buffer names. The returned value must be freed
48 * with g_strfreev().
50 * Since: 2.4
51 **/
52 gchar **
53 gimp_buffers_get_list (const gchar *filter,
54 gint *num_buffers)
56 GimpParam *return_vals;
57 gint nreturn_vals;
58 gchar **buffer_list = NULL;
59 gint i;
61 return_vals = gimp_run_procedure ("gimp-buffers-get-list",
62 &nreturn_vals,
63 GIMP_PDB_STRING, filter,
64 GIMP_PDB_END);
66 *num_buffers = 0;
68 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
70 *num_buffers = return_vals[1].data.d_int32;
71 if (*num_buffers > 0)
73 buffer_list = g_new0 (gchar *, *num_buffers + 1);
74 for (i = 0; i < *num_buffers; i++)
75 buffer_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
79 gimp_destroy_params (return_vals, nreturn_vals);
81 return buffer_list;
84 /**
85 * gimp_buffer_rename:
86 * @buffer_name: The buffer name.
87 * @new_name: The buffer's new name.
89 * Renames a named buffer.
91 * This procedure renames a named buffer.
93 * Returns: The real name given to the buffer.
95 * Since: 2.4
96 **/
97 gchar *
98 gimp_buffer_rename (const gchar *buffer_name,
99 const gchar *new_name)
101 GimpParam *return_vals;
102 gint nreturn_vals;
103 gchar *real_name = NULL;
105 return_vals = gimp_run_procedure ("gimp-buffer-rename",
106 &nreturn_vals,
107 GIMP_PDB_STRING, buffer_name,
108 GIMP_PDB_STRING, new_name,
109 GIMP_PDB_END);
111 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
112 real_name = g_strdup (return_vals[1].data.d_string);
114 gimp_destroy_params (return_vals, nreturn_vals);
116 return real_name;
120 * gimp_buffer_delete:
121 * @buffer_name: The buffer name.
123 * Deletes a named buffer.
125 * This procedure deletes a named buffer.
127 * Returns: TRUE on success.
129 * Since: 2.4
131 gboolean
132 gimp_buffer_delete (const gchar *buffer_name)
134 GimpParam *return_vals;
135 gint nreturn_vals;
136 gboolean success = TRUE;
138 return_vals = gimp_run_procedure ("gimp-buffer-delete",
139 &nreturn_vals,
140 GIMP_PDB_STRING, buffer_name,
141 GIMP_PDB_END);
143 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
145 gimp_destroy_params (return_vals, nreturn_vals);
147 return success;
151 * gimp_buffer_get_width:
152 * @buffer_name: The buffer name.
154 * Retrieves the specified buffer's width.
156 * This procedure retrieves the specified named buffer's width.
158 * Returns: The buffer width.
160 * Since: 2.4
162 gint
163 gimp_buffer_get_width (const gchar *buffer_name)
165 GimpParam *return_vals;
166 gint nreturn_vals;
167 gint width = 0;
169 return_vals = gimp_run_procedure ("gimp-buffer-get-width",
170 &nreturn_vals,
171 GIMP_PDB_STRING, buffer_name,
172 GIMP_PDB_END);
174 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
175 width = return_vals[1].data.d_int32;
177 gimp_destroy_params (return_vals, nreturn_vals);
179 return width;
183 * gimp_buffer_get_height:
184 * @buffer_name: The buffer name.
186 * Retrieves the specified buffer's height.
188 * This procedure retrieves the specified named buffer's height.
190 * Returns: The buffer height.
192 * Since: 2.4
194 gint
195 gimp_buffer_get_height (const gchar *buffer_name)
197 GimpParam *return_vals;
198 gint nreturn_vals;
199 gint height = 0;
201 return_vals = gimp_run_procedure ("gimp-buffer-get-height",
202 &nreturn_vals,
203 GIMP_PDB_STRING, buffer_name,
204 GIMP_PDB_END);
206 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
207 height = return_vals[1].data.d_int32;
209 gimp_destroy_params (return_vals, nreturn_vals);
211 return height;
215 * gimp_buffer_get_bytes:
216 * @buffer_name: The buffer name.
218 * Retrieves the specified buffer's bytes.
220 * This procedure retrieves the specified named buffer's bytes.
222 * Returns: The buffer bpp.
224 * Since: 2.4
226 gint
227 gimp_buffer_get_bytes (const gchar *buffer_name)
229 GimpParam *return_vals;
230 gint nreturn_vals;
231 gint bytes = 0;
233 return_vals = gimp_run_procedure ("gimp-buffer-get-bytes",
234 &nreturn_vals,
235 GIMP_PDB_STRING, buffer_name,
236 GIMP_PDB_END);
238 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
239 bytes = return_vals[1].data.d_int32;
241 gimp_destroy_params (return_vals, nreturn_vals);
243 return bytes;
247 * gimp_buffer_get_image_type:
248 * @buffer_name: The buffer name.
250 * Retrieves the specified buffer's image type.
252 * This procedure retrieves the specified named buffer's image type.
254 * Returns: The buffer image type.
256 * Since: 2.4
258 GimpImageBaseType
259 gimp_buffer_get_image_type (const gchar *buffer_name)
261 GimpParam *return_vals;
262 gint nreturn_vals;
263 GimpImageBaseType image_type = 0;
265 return_vals = gimp_run_procedure ("gimp-buffer-get-image-type",
266 &nreturn_vals,
267 GIMP_PDB_STRING, buffer_name,
268 GIMP_PDB_END);
270 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
271 image_type = return_vals[1].data.d_int32;
273 gimp_destroy_params (return_vals, nreturn_vals);
275 return image_type;