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"
|
|
|
|
|
|
|
|
#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.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_buffers: (out): The number of buffers.
|
2005-09-28 02:29:27 +08:00
|
|
|
*
|
|
|
|
* Retrieve a complete listing of the available buffers.
|
|
|
|
*
|
|
|
|
* This procedure returns a complete listing of available named
|
|
|
|
* buffers.
|
|
|
|
*
|
2019-08-01 01:19:06 +08:00
|
|
|
* Returns: (array length=num_buffers) (element-type gchar*) (transfer
|
2019-08-01 04:51:35 +08:00
|
|
|
* full): The list of buffer names. The returned value must be freed
|
2019-08-01 01:19:06 +08:00
|
|
|
* 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 **
|
|
|
|
gimp_buffers_get_list (const gchar *filter,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *num_buffers)
|
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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), filter);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffers-get-list",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-28 02:29:27 +08:00
|
|
|
|
|
|
|
*num_buffers = 0;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2005-09-28 02:29:27 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*num_buffers = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
buffer_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
|
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.
|
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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 1), new_name);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffer-rename",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
real_name = g_value_dup_string (gimp_value_array_index (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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffer-delete",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-width",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
width = g_value_get_int (gimp_value_array_index (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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-height",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
height = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-bytes",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
bytes = g_value_get_int (gimp_value_array_index (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-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
|
|
|
|
|
|
|
|
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-image-type",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
2005-09-27 17:05:55 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
image_type = g_value_get_enum (gimp_value_array_index (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;
|
|
|
|
}
|