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"
|
|
|
|
|
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-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
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
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-version",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("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-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
version = g_value_dup_string (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
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-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
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
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-getpid",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("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-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
pid = g_value_get_int (gimp_value_array_index (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-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
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
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-attach-parasite",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("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-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);
|
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-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
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);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-detach-parasite",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("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-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (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-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
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
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-get-parasite",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("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-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
|
|
|
parasite = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2011-03-08 21:31:04 +08:00
|
|
|
|
|
|
|
return parasite;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_get_parasite_list:
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_parasites: (out): The number of attached parasites.
|
2011-03-08 21:31:04 +08:00
|
|
|
*
|
|
|
|
* List all parasites.
|
|
|
|
*
|
|
|
|
* Returns a list of all currently attached global parasites.
|
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (array length=num_parasites) (element-type gchar*) (transfer full):
|
|
|
|
* 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 **
|
|
|
|
gimp_get_parasite_list (gint *num_parasites)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
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
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-get-parasite-list",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("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
|
|
|
|
|
|
|
*num_parasites = 0;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2011-03-08 21:31:04 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*num_parasites = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
parasites = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_temp_name:
|
|
|
|
* @extension: The extension the file will have.
|
|
|
|
*
|
|
|
|
* Generates a unique filename.
|
|
|
|
*
|
|
|
|
* Generates a unique filename using the temp path supplied in the
|
|
|
|
* user's gimprc.
|
|
|
|
*
|
2019-08-01 04:51:35 +08:00
|
|
|
* Returns: (transfer full): The new temp filename.
|
2019-08-05 04:09:04 +08:00
|
|
|
* The returned value must be freed with g_free().
|
2017-02-18 22:08:25 +08:00
|
|
|
**/
|
|
|
|
gchar *
|
|
|
|
gimp_temp_name (const gchar *extension)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2017-02-18 22:08:25 +08:00
|
|
|
gchar *name = NULL;
|
|
|
|
|
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);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-temp-name",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-temp-name",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2017-02-18 22:08:25 +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)
|
|
|
|
name = g_value_dup_string (gimp_value_array_index (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
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|