2000-05-31 14:15:06 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2000-06-02 05:18:04 +08:00
|
|
|
* Copyright (C) 1995-2000 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
|
|
|
*
|
|
|
|
* 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
|
2000-05-31 14:15:06 +08:00
|
|
|
* version 2 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
|
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
|
1998-04-13 13:44:11 +08:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2000-05-31 14:15:06 +08:00
|
|
|
*/
|
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
/* NOTE: This file is autogenerated by pdbgen.pl */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
#include "gimp.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
gchar **
|
|
|
|
gimp_gradients_get_list (gint *num_gradients)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpParam *return_vals;
|
2000-06-02 05:18:04 +08:00
|
|
|
gint nreturn_vals;
|
|
|
|
gchar **gradient_names = NULL;
|
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_gradients_get_list",
|
|
|
|
&nreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_END);
|
2000-06-02 05:18:04 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
*num_gradients = 0;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
*num_gradients = return_vals[1].data.d_int32;
|
2000-06-02 05:18:04 +08:00
|
|
|
gradient_names = g_new (gchar *, *num_gradients);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0; i < *num_gradients; i++)
|
|
|
|
gradient_names[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
return gradient_names;
|
|
|
|
}
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
gchar *
|
|
|
|
gimp_gradients_get_active (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpParam *return_vals;
|
2000-06-02 05:18:04 +08:00
|
|
|
gint nreturn_vals;
|
|
|
|
gchar *name = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_gradients_get_active",
|
|
|
|
&nreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_END);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
2000-06-02 05:18:04 +08:00
|
|
|
name = g_strdup (return_vals[1].data.d_string);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
return name;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_gradients_set_active (gchar *name)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpParam *return_vals;
|
2000-06-02 05:18:04 +08:00
|
|
|
gint nreturn_vals;
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean success = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_gradients_set_active",
|
|
|
|
&nreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_STRING, name,
|
|
|
|
GIMP_PDB_END);
|
2000-06-02 05:18:04 +08:00
|
|
|
|
2000-08-23 09:44:59 +08:00
|
|
|
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
return success;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gdouble *
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_gradients_sample_uniform (gint num_samples)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpParam *return_vals;
|
2000-06-02 05:18:04 +08:00
|
|
|
gint nreturn_vals;
|
|
|
|
gdouble *color_samples = NULL;
|
|
|
|
gint num_color_samples;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_gradients_sample_uniform",
|
|
|
|
&nreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_INT32, num_samples,
|
|
|
|
GIMP_PDB_END);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-06-02 05:18:04 +08:00
|
|
|
num_color_samples = return_vals[1].data.d_int32;
|
|
|
|
color_samples = g_new (gdouble, num_color_samples);
|
|
|
|
memcpy (color_samples, return_vals[2].data.d_floatarray,
|
|
|
|
num_color_samples * sizeof (gdouble));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
return color_samples;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gdouble *
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_gradients_sample_custom (gint num_samples,
|
|
|
|
gdouble *positions)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpParam *return_vals;
|
2000-06-02 05:18:04 +08:00
|
|
|
gint nreturn_vals;
|
|
|
|
gdouble *color_samples = NULL;
|
|
|
|
gint num_color_samples;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_gradients_sample_custom",
|
|
|
|
&nreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_INT32, num_samples,
|
|
|
|
GIMP_PDB_FLOATARRAY, positions,
|
|
|
|
GIMP_PDB_END);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-06-02 05:18:04 +08:00
|
|
|
num_color_samples = return_vals[1].data.d_int32;
|
|
|
|
color_samples = g_new (gdouble, num_color_samples);
|
|
|
|
memcpy (color_samples, return_vals[2].data.d_floatarray,
|
|
|
|
num_color_samples * sizeof (gdouble));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
return color_samples;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|