PIKApp/libpika/pikabuffer_pdb.c

296 lines
7.9 KiB
C
Raw Normal View History

2023-09-26 00:35:21 +02:00
/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* pikabuffer_pdb.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* 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
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include "stamp-pdbgen.h"
#include "pika.h"
/**
* SECTION: pikabuffer
* @title: pikabuffer
* @short_description: Functions for manipulating cut buffers.
*
* Functions related to named cut buffers.
**/
/**
* pika_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.
*
* Returns: (array zero-terminated=1) (transfer full):
* The list of buffer names.
* The returned value must be freed with g_strfreev().
*
* Since: 2.4
**/
gchar **
pika_buffers_get_list (const gchar *filter)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gchar **buffer_list = NULL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, filter,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffers-get-list",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
buffer_list = PIKA_VALUES_DUP_STRV (return_vals, 1);
pika_value_array_unref (return_vals);
return buffer_list;
}
/**
* pika_buffer_rename:
* @buffer_name: The buffer name.
* @new_name: The buffer's new name.
*
* Renames a named buffer.
*
* This procedure renames a named buffer.
*
* Returns: (transfer full): The real name given to the buffer.
* The returned value must be freed with g_free().
*
* Since: 2.4
**/
gchar *
pika_buffer_rename (const gchar *buffer_name,
const gchar *new_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gchar *real_name = NULL;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_STRING, new_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffer-rename",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
real_name = PIKA_VALUES_DUP_STRING (return_vals, 1);
pika_value_array_unref (return_vals);
return real_name;
}
/**
* pika_buffer_delete:
* @buffer_name: The buffer name.
*
* Deletes a named buffer.
*
* This procedure deletes a named buffer.
*
* Returns: TRUE on success.
*
* Since: 2.4
**/
gboolean
pika_buffer_delete (const gchar *buffer_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffer-delete",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* pika_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.
*
* Since: 2.4
**/
gint
pika_buffer_get_width (const gchar *buffer_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gint width = 0;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffer-get-width",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
width = PIKA_VALUES_GET_INT (return_vals, 1);
pika_value_array_unref (return_vals);
return width;
}
/**
* pika_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.
*
* Since: 2.4
**/
gint
pika_buffer_get_height (const gchar *buffer_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gint height = 0;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffer-get-height",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
height = PIKA_VALUES_GET_INT (return_vals, 1);
pika_value_array_unref (return_vals);
return height;
}
/**
* pika_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.
*
* Since: 2.4
**/
gint
pika_buffer_get_bytes (const gchar *buffer_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gint bytes = 0;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffer-get-bytes",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
bytes = PIKA_VALUES_GET_INT (return_vals, 1);
pika_value_array_unref (return_vals);
return bytes;
}
/**
* pika_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.
*
* Since: 2.4
**/
PikaImageBaseType
pika_buffer_get_image_type (const gchar *buffer_name)
{
PikaValueArray *args;
PikaValueArray *return_vals;
PikaImageBaseType image_type = 0;
args = pika_value_array_new_from_types (NULL,
G_TYPE_STRING, buffer_name,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-buffer-get-image-type",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
image_type = PIKA_VALUES_GET_ENUM (return_vals, 1);
pika_value_array_unref (return_vals);
return image_type;
}