gimpgradients_pdb.c 3.02 KB
Newer Older
1
/* LIBGIMP - The GIMP Library
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3
 *
4
 * gimpgradients_pdb.c
Manish Singh's avatar
Manish Singh committed
5
 *
6
 * This library is free software: you can redistribute it and/or
Marc Lehmann's avatar
Marc Lehmann committed
7
 * modify it under the terms of the GNU Lesser General Public
Manish Singh's avatar
Manish Singh committed
8
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10 11 12 13
 *
 * 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
14
 * Lesser General Public License for more details.
Manish Singh's avatar
Manish Singh committed
15
 *
Marc Lehmann's avatar
Marc Lehmann committed
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library.  If not, see
18
 * <https://www.gnu.org/licenses/>.
19 20
 */

21
/* NOTE: This file is auto-generated by pdbgen.pl */
Elliot Lee's avatar
Elliot Lee committed
22

Sven Neumann's avatar
Sven Neumann committed
23 24
#include "config.h"

25
#include "gimp.h"
Elliot Lee's avatar
Elliot Lee committed
26

27 28 29 30 31 32 33 34 35 36

/**
 * SECTION: gimpgradients
 * @title: gimpgradients
 * @short_description: Operations related to gradients.
 *
 * Operations related to gradients.
 **/


37 38 39
/**
 * gimp_gradients_refresh:
 *
40
 * Refresh current gradients. This function always succeeds.
41 42 43 44 45
 *
 * This procedure retrieves all gradients currently in the user's
 * gradient path and updates the gradient dialogs accordingly.
 *
 * Returns: TRUE on success.
46
 **/
47 48 49 50 51 52 53
gboolean
gimp_gradients_refresh (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

54
  return_vals = gimp_run_procedure ("gimp-gradients-refresh",
55 56
                                    &nreturn_vals,
                                    GIMP_PDB_END);
57 58 59 60 61 62 63 64

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

65 66
/**
 * gimp_gradients_get_list:
67
 * @filter: An optional regular expression used to filter the list.
68 69 70 71 72
 * @num_gradients: The number of loaded gradients.
 *
 * Retrieve the list of loaded gradients.
 *
 * This procedure returns a list of the gradients that are currently
73
 * loaded. You can later use the gimp_context_set_gradient() function
74
 * to set the active gradient.
75
 *
76 77
 * Returns: The list of gradient names. The returned value must be
 * freed with g_strfreev().
78
 **/
79
gchar **
80
gimp_gradients_get_list (const gchar *filter,
81
                         gint        *num_gradients)
Elliot Lee's avatar
Elliot Lee committed
82
{
83
  GimpParam *return_vals;
84
  gint nreturn_vals;
85
  gchar **gradient_list = NULL;
86
  gint i;
Elliot Lee's avatar
Elliot Lee committed
87

88
  return_vals = gimp_run_procedure ("gimp-gradients-get-list",
89 90 91
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, filter,
                                    GIMP_PDB_END);
92

Elliot Lee's avatar
Elliot Lee committed
93 94
  *num_gradients = 0;

95
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
Elliot Lee's avatar
Elliot Lee committed
96 97
    {
      *num_gradients = return_vals[1].data.d_int32;
98 99 100 101 102 103
      if (*num_gradients > 0)
        {
          gradient_list = g_new0 (gchar *, *num_gradients + 1);
          for (i = 0; i < *num_gradients; i++)
            gradient_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
        }
Elliot Lee's avatar
Elliot Lee committed
104 105 106 107
    }

  gimp_destroy_params (return_vals, nreturn_vals);

108
  return gradient_list;
Elliot Lee's avatar
Elliot Lee committed
109
}