2005-09-27 17:05:55 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpbuffer_pdb.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2005-09-27 17:05:55 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2005-09-27 17:05:55 +08:00
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2005-09-27 17:05:55 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2005-09-27 17:05:55 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpbuffer
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpbuffer
|
|
|
|
* @short_description: Functions for manipulating cut buffers.
|
|
|
|
*
|
|
|
|
* Functions related to named cut buffers.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2005-09-28 02:29:27 +08:00
|
|
|
/**
|
|
|
|
* gimp_buffers_get_list:
|
|
|
|
* @filter: An optional regular expression used to filter the list.
|
|
|
|
*
|
|
|
|
* Retrieve a complete listing of the available buffers.
|
|
|
|
*
|
|
|
|
* This procedure returns a complete listing of available named
|
|
|
|
* buffers.
|
|
|
|
*
|
2021-12-02 05:35:25 +08:00
|
|
|
* Returns: (array zero-terminated=1) (transfer full):
|
2019-08-05 04:09:04 +08:00
|
|
|
* The list of buffer names.
|
|
|
|
* The returned value must be freed with g_strfreev().
|
2005-09-28 02:29:27 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-28 02:29:27 +08:00
|
|
|
gchar **
|
2021-12-02 05:35:25 +08:00
|
|
|
gimp_buffers_get_list (const gchar *filter)
|
2005-09-28 02:29:27 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-28 02:29:27 +08:00
|
|
|
gchar **buffer_list = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, filter,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffers-get-list",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-28 02:29:27 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2021-12-02 05:35:25 +08:00
|
|
|
buffer_list = GIMP_VALUES_DUP_STRV (return_vals, 1);
|
2005-09-28 02:29:27 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-28 02:29:27 +08:00
|
|
|
|
|
|
|
return buffer_list;
|
|
|
|
}
|
|
|
|
|
2005-09-27 17:05:55 +08:00
|
|
|
/**
|
|
|
|
* gimp_buffer_rename:
|
|
|
|
* @buffer_name: The buffer name.
|
|
|
|
* @new_name: The buffer's new name.
|
|
|
|
*
|
|
|
|
* Renames a named buffer.
|
|
|
|
*
|
|
|
|
* This procedure renames a named buffer.
|
|
|
|
*
|
2019-08-01 04:51:35 +08:00
|
|
|
* Returns: (transfer full): The real name given to the buffer.
|
2019-08-05 04:09:04 +08:00
|
|
|
* The returned value must be freed with g_free().
|
2005-09-27 17:05:55 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-27 17:05:55 +08:00
|
|
|
gchar *
|
|
|
|
gimp_buffer_rename (const gchar *buffer_name,
|
2006-04-12 18:27:31 +08:00
|
|
|
const gchar *new_name)
|
2005-09-27 17:05:55 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-27 17:05:55 +08:00
|
|
|
gchar *real_name = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
|
|
|
G_TYPE_STRING, new_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffer-rename",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
return real_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_buffer_delete:
|
|
|
|
* @buffer_name: The buffer name.
|
|
|
|
*
|
|
|
|
* Deletes a named buffer.
|
|
|
|
*
|
|
|
|
* This procedure deletes a named buffer.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-27 17:05:55 +08:00
|
|
|
gboolean
|
|
|
|
gimp_buffer_delete (const gchar *buffer_name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-27 17:05:55 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffer-delete",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_buffer_get_width:
|
|
|
|
* @buffer_name: The buffer name.
|
|
|
|
*
|
|
|
|
* Retrieves the specified buffer's width.
|
|
|
|
*
|
|
|
|
* This procedure retrieves the specified named buffer's width.
|
|
|
|
*
|
|
|
|
* Returns: The buffer width.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-27 17:05:55 +08:00
|
|
|
gint
|
|
|
|
gimp_buffer_get_width (const gchar *buffer_name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-27 17:05:55 +08:00
|
|
|
gint width = 0;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffer-get-width",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
width = GIMP_VALUES_GET_INT (return_vals, 1);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_buffer_get_height:
|
|
|
|
* @buffer_name: The buffer name.
|
|
|
|
*
|
|
|
|
* Retrieves the specified buffer's height.
|
|
|
|
*
|
|
|
|
* This procedure retrieves the specified named buffer's height.
|
|
|
|
*
|
|
|
|
* Returns: The buffer height.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-27 17:05:55 +08:00
|
|
|
gint
|
|
|
|
gimp_buffer_get_height (const gchar *buffer_name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-27 17:05:55 +08:00
|
|
|
gint height = 0;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffer-get-height",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
height = GIMP_VALUES_GET_INT (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_buffer_get_bytes:
|
|
|
|
* @buffer_name: The buffer name.
|
|
|
|
*
|
|
|
|
* Retrieves the specified buffer's bytes.
|
|
|
|
*
|
|
|
|
* This procedure retrieves the specified named buffer's bytes.
|
|
|
|
*
|
|
|
|
* Returns: The buffer bpp.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-27 17:05:55 +08:00
|
|
|
gint
|
|
|
|
gimp_buffer_get_bytes (const gchar *buffer_name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-27 17:05:55 +08:00
|
|
|
gint bytes = 0;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffer-get-bytes",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
bytes = GIMP_VALUES_GET_INT (return_vals, 1);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
return bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_buffer_get_image_type:
|
|
|
|
* @buffer_name: The buffer name.
|
|
|
|
*
|
|
|
|
* Retrieves the specified buffer's image type.
|
|
|
|
*
|
|
|
|
* This procedure retrieves the specified named buffer's image type.
|
|
|
|
*
|
|
|
|
* Returns: The buffer image type.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-27 17:05:55 +08:00
|
|
|
GimpImageBaseType
|
|
|
|
gimp_buffer_get_image_type (const gchar *buffer_name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-27 17:05:55 +08:00
|
|
|
GimpImageBaseType image_type = 0;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-buffer-get-image-type",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
image_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
|
|
|
return image_type;
|
|
|
|
}
|