2000-05-31 14:15:06 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-05-31 14:15:06 +08:00
|
|
|
*
|
2000-06-02 05:18:04 +08:00
|
|
|
* gimpgradients_pdb.c
|
1998-01-25 18:26:47 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
1999-11-18 05:13:50 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-01-25 18:26:47 +08:00
|
|
|
* 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-05-31 14:15:06 +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
|
2000-06-02 05:18:04 +08:00
|
|
|
* Lesser General Public License for more details.
|
1998-01-25 18:26:47 +08:00
|
|
|
*
|
1999-11-18 05:13:50 +08:00
|
|
|
* 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-05-31 14:15:06 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
#include "gimp.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpgradients
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpgradients
|
|
|
|
* @short_description: Operations related to gradients.
|
|
|
|
*
|
|
|
|
* Operations related to gradients.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2002-02-21 19:16:00 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradients_refresh:
|
|
|
|
*
|
2003-12-08 19:58:45 +08:00
|
|
|
* Refresh current gradients. This function always succeeds.
|
2002-02-21 19:16:00 +08:00
|
|
|
*
|
|
|
|
* This procedure retrieves all gradients currently in the user's
|
|
|
|
* gradient path and updates the gradient dialogs accordingly.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2002-02-21 19:16:00 +08:00
|
|
|
gboolean
|
|
|
|
gimp_gradients_refresh (void)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2002-02-21 19:16:00 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_NONE);
|
2002-02-21 19:16:00 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradients-refresh",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2002-02-21 19:16:00 +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);
|
2002-02-21 19:16:00 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradients_get_list:
|
2003-09-05 01:04:36 +08:00
|
|
|
* @filter: An optional regular expression used to filter the list.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_gradients: (out): The number of loaded gradients.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Retrieve the list of loaded gradients.
|
|
|
|
*
|
|
|
|
* This procedure returns a list of the gradients that are currently
|
2006-06-14 16:32:08 +08:00
|
|
|
* loaded. You can later use the gimp_context_set_gradient() function
|
2004-09-23 23:05:48 +08:00
|
|
|
* to set the active gradient.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (array length=num_gradients) (element-type gchar*) (transfer full):
|
|
|
|
* The list of gradient names.
|
|
|
|
* The returned value must be freed with g_strfreev().
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-05-31 14:15:06 +08:00
|
|
|
gchar **
|
2003-09-05 01:04:36 +08:00
|
|
|
gimp_gradients_get_list (const gchar *filter,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint *num_gradients)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2003-09-04 20:02:31 +08:00
|
|
|
gchar **gradient_list = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
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-gradients-get-list",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-06-02 05:18:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
*num_gradients = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*num_gradients = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
gradient_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-09-04 20:02:31 +08:00
|
|
|
return gradient_list;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|