2000-06-09 02:10:03 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-06-09 02:10:03 +08:00
|
|
|
*
|
2011-03-08 20:58:56 +08:00
|
|
|
* gimp_pdb.c
|
2000-06-09 02:10:03 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-06-09 02:10:03 +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.
|
2000-06-09 02:10:03 +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/>.
|
2000-06-09 02:10:03 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2000-06-09 02:10:03 +08:00
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2000-06-09 02:10:03 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-08-10 17:08:06 +08:00
|
|
|
* SECTION: gimp
|
|
|
|
* @title: gimp
|
2019-07-31 18:16:38 +08:00
|
|
|
* @short_description: Main functions needed for building a GIMP plug-in.
|
2010-07-07 17:43:10 +08:00
|
|
|
*
|
2019-07-31 18:16:38 +08:00
|
|
|
* Main functions needed for building a GIMP plug-in.
|
|
|
|
* This header includes all other GIMP Library headers.
|
|
|
|
*
|
|
|
|
* Also contains some miscellaneous procedures that don't fit in any
|
|
|
|
* other category.
|
2010-07-07 17:43:10 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_version:
|
|
|
|
*
|
2006-12-22 17:49:36 +08:00
|
|
|
* Returns the host GIMP version.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* This procedure returns the version number of the currently running
|
2006-12-22 17:49:36 +08:00
|
|
|
* GIMP.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2019-08-01 04:51:35 +08:00
|
|
|
* Returns: (transfer full): GIMP version number.
|
2019-08-05 04:09:04 +08:00
|
|
|
* The returned value must be freed with g_free().
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-06-09 02:10:03 +08:00
|
|
|
gchar *
|
|
|
|
gimp_version (void)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-06-09 02:10:03 +08:00
|
|
|
gchar *version = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_NONE);
|
2000-06-09 02:10:03 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-version",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-06-09 02:10:03 +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
|
|
|
version = GIMP_VALUES_DUP_STRING (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2000-06-09 02:10:03 +08:00
|
|
|
|
|
|
|
return version;
|
|
|
|
}
|
2005-07-25 07:34:25 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_getpid:
|
|
|
|
*
|
2006-12-22 17:49:36 +08:00
|
|
|
* Returns the PID of the host GIMP process.
|
2005-07-25 07:34:25 +08:00
|
|
|
*
|
2006-12-22 17:49:36 +08:00
|
|
|
* This procedure returns the process ID of the currently running GIMP.
|
2005-07-25 07:34:25 +08:00
|
|
|
*
|
|
|
|
* Returns: The PID.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-07-25 07:34:25 +08:00
|
|
|
gint
|
|
|
|
gimp_getpid (void)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-07-25 07:34:25 +08:00
|
|
|
gint pid = 0;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_NONE);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-getpid",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-07-25 07:34:25 +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
|
|
|
pid = GIMP_VALUES_GET_INT (return_vals, 1);
|
2005-07-25 07:34:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-07-25 07:34:25 +08:00
|
|
|
|
|
|
|
return pid;
|
|
|
|
}
|
2011-03-08 21:31:04 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_attach_parasite:
|
|
|
|
* @parasite: The parasite to attach.
|
|
|
|
*
|
|
|
|
* Add a global parasite.
|
|
|
|
*
|
|
|
|
* This procedure attaches a global parasite. It has no return values.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.8
|
2011-03-08 21:31:04 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_attach_parasite (const GimpParasite *parasite)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 21:31:04 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_PARASITE, parasite,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-attach-parasite",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 21:31:04 +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);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_detach_parasite:
|
|
|
|
* @name: The name of the parasite to detach.
|
|
|
|
*
|
|
|
|
* Removes a global parasite.
|
|
|
|
*
|
|
|
|
* This procedure detaches a global parasite from. It has no return
|
|
|
|
* values.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.8
|
2011-03-08 21:31:04 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_detach_parasite (const gchar *name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 21:31:04 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-detach-parasite",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2011-03-08 21:31:04 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_get_parasite:
|
|
|
|
* @name: The name of the parasite to find.
|
|
|
|
*
|
|
|
|
* Look up a global parasite.
|
|
|
|
*
|
|
|
|
* Finds and returns the global parasite that was previously attached.
|
|
|
|
*
|
2019-08-01 04:51:35 +08:00
|
|
|
* Returns: (transfer full): The found parasite.
|
2011-03-08 21:31:04 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.8
|
2011-03-08 21:31:04 +08:00
|
|
|
**/
|
|
|
|
GimpParasite *
|
|
|
|
gimp_get_parasite (const gchar *name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 21:31:04 +08:00
|
|
|
GimpParasite *parasite = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-get-parasite",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 21:31:04 +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
|
|
|
parasite = GIMP_VALUES_DUP_PARASITE (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
|
|
|
return parasite;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_get_parasite_list:
|
|
|
|
*
|
|
|
|
* List all parasites.
|
|
|
|
*
|
|
|
|
* Returns a list of all currently attached global parasites.
|
|
|
|
*
|
2021-12-02 05:35:25 +08:00
|
|
|
* Returns: (array zero-terminated=1) (transfer full):
|
2019-08-05 04:09:04 +08:00
|
|
|
* The names of currently attached parasites.
|
|
|
|
* The returned value must be freed with g_strfreev().
|
2011-03-08 21:31:04 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.8
|
2011-03-08 21:31:04 +08:00
|
|
|
**/
|
|
|
|
gchar **
|
2021-12-02 05:35:25 +08:00
|
|
|
gimp_get_parasite_list (void)
|
2011-03-08 21:31:04 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2011-03-08 21:31:04 +08:00
|
|
|
gchar **parasites = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_NONE);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-get-parasite-list",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2011-03-08 21:31:04 +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
|
|
|
parasites = GIMP_VALUES_DUP_STRV (return_vals, 1);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
|
|
|
return parasites;
|
|
|
|
}
|
2017-02-18 22:08:25 +08:00
|
|
|
|
|
|
|
/**
|
2019-09-12 04:32:44 +08:00
|
|
|
* gimp_temp_file:
|
2017-02-18 22:08:25 +08:00
|
|
|
* @extension: The extension the file will have.
|
|
|
|
*
|
2019-09-12 04:32:44 +08:00
|
|
|
* Generates a unique temporary file.
|
2017-02-18 22:08:25 +08:00
|
|
|
*
|
2019-09-12 04:32:44 +08:00
|
|
|
* Generates a unique file using the temp path supplied in the user's
|
|
|
|
* gimprc.
|
2017-02-18 22:08:25 +08:00
|
|
|
*
|
2019-09-12 04:32:44 +08:00
|
|
|
* Returns: (transfer full): The new temp file.
|
2017-02-18 22:08:25 +08:00
|
|
|
**/
|
2019-09-12 04:32:44 +08:00
|
|
|
GFile *
|
|
|
|
gimp_temp_file (const gchar *extension)
|
2017-02-18 22:08:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-09-12 04:32:44 +08:00
|
|
|
GFile *file = NULL;
|
2017-02-18 22:08:25 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, extension,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-17 04:07:55 +08:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-temp-file",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2017-02-18 22:08:25 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-12 04:32:44 +08:00
|
|
|
file = GIMP_VALUES_DUP_FILE (return_vals, 1);
|
2017-02-18 22:08:25 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2017-02-18 22:08:25 +08:00
|
|
|
|
2019-09-12 04:32:44 +08:00
|
|
|
return file;
|
2017-02-18 22:08:25 +08:00
|
|
|
}
|