2004-05-31 06:04:16 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
2004-09-29 06:01:21 +08:00
|
|
|
* gimpgradient_pdb.c
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2004-05-31 06:04:16 +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.
|
2004-05-31 06:04:16 +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/>.
|
2004-05-31 06:04:16 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpgradient
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpgradient
|
2022-09-06 07:28:35 +08:00
|
|
|
* @short_description: Installable object used by the gradient rendering tool.
|
2010-07-07 17:43:10 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Installable object used by the gradient rendering tool.
|
2010-07-07 17:43:10 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2004-09-29 06:01:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_new:
|
|
|
|
* @name: The requested name of the new gradient.
|
|
|
|
*
|
|
|
|
* Creates a new gradient
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Creates a new gradient having no segments.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Returns: (transfer full): The gradient.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2022-09-06 07:28:35 +08:00
|
|
|
GimpGradient *
|
2004-09-29 06:01:21 +08:00
|
|
|
gimp_gradient_new (const gchar *name)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2022-09-06 07:28:35 +08:00
|
|
|
GimpGradient *gradient = NULL;
|
2004-09-29 06:01:21 +08:00
|
|
|
|
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-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-new",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2022-09-06 07:28:35 +08:00
|
|
|
gradient = GIMP_VALUES_GET_GRADIENT (return_vals, 1);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2022-09-06 07:28:35 +08:00
|
|
|
return gradient;
|
2004-09-29 06:01:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_duplicate:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
|
|
|
* Duplicates a gradient
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Returns a copy having a different, unique ID
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Returns: (transfer full): A copy of the gradient.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2022-09-06 07:28:35 +08:00
|
|
|
GimpGradient *
|
|
|
|
gimp_gradient_duplicate (GimpGradient *gradient)
|
2004-09-29 06:01:21 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2022-09-06 07:28:35 +08:00
|
|
|
GimpGradient *gradient_copy = NULL;
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
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-gradient-duplicate",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2022-09-06 07:28:35 +08:00
|
|
|
gradient_copy = GIMP_VALUES_GET_GRADIENT (return_vals, 1);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2022-09-06 07:28:35 +08:00
|
|
|
return gradient_copy;
|
2004-09-29 06:01:21 +08:00
|
|
|
}
|
|
|
|
|
2005-01-04 01:58:25 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_is_editable:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2005-01-04 01:58:25 +08:00
|
|
|
*
|
|
|
|
* Tests if gradient can be edited
|
|
|
|
*
|
2006-03-22 05:48:21 +08:00
|
|
|
* Returns TRUE if you have permission to change the gradient
|
2005-01-04 01:58:25 +08:00
|
|
|
*
|
2006-03-25 05:57:47 +08:00
|
|
|
* Returns: TRUE if the gradient can be edited.
|
2005-01-04 01:58:25 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-01-04 01:58:25 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_is_editable (GimpGradient *gradient)
|
2005-01-04 01:58:25 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-01-04 01:58:25 +08:00
|
|
|
gboolean editable = FALSE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2005-01-04 01:58:25 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-is-editable",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-01-04 01:58: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
|
|
|
editable = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-01-04 01:58:25 +08:00
|
|
|
|
|
|
|
return editable;
|
|
|
|
}
|
|
|
|
|
2004-09-29 06:01:21 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_rename:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2004-09-29 06:01:21 +08:00
|
|
|
* @new_name: The new name of the gradient.
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Renames a gradient. When the name is in use, renames to a unique
|
|
|
|
* name.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Renames a gradient. The name is the same as the ID. When the
|
|
|
|
* proposed name is already used, GIMP generates a unique name, which
|
|
|
|
* get_id() will return.
|
|
|
|
* Returns a reference to a renamed gradient, which you should assign
|
|
|
|
* to the original var or a differently named var. Any existing
|
|
|
|
* references will be invalid. Resources in plugins are proxies holding
|
|
|
|
* an ID, which can be invalid when the resource is renamed.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Returns: (transfer full): A reference to the renamed gradient.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2022-09-06 07:28:35 +08:00
|
|
|
GimpGradient *
|
|
|
|
gimp_gradient_rename (GimpGradient *gradient,
|
|
|
|
const gchar *new_name)
|
2004-09-29 06:01:21 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2022-09-06 07:28:35 +08:00
|
|
|
GimpGradient *gradient_renamed = NULL;
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, new_name,
|
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-gradient-rename",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2022-09-06 07:28:35 +08:00
|
|
|
gradient_renamed = GIMP_VALUES_GET_GRADIENT (return_vals, 1);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2022-09-06 07:28:35 +08:00
|
|
|
return gradient_renamed;
|
2004-09-29 06:01:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_delete:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
|
|
|
* Deletes a gradient
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Deletes a gradient. Returns an error if the gradient is not
|
|
|
|
* deletable. Deletes the gradient's data. You should not use the
|
|
|
|
* gradient afterwards.
|
2004-09-29 06:01:21 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-09-29 06:01:21 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_delete (GimpGradient *gradient)
|
2004-09-29 06:01:21 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-09-29 06:01:21 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-delete",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-09-29 06:01:21 +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);
|
2004-09-29 06:01:21 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2008-05-17 17:19:58 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_get_number_of_segments:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2008-05-17 17:19:58 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the number of segments of the gradient
|
2008-05-17 17:19:58 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the number of segments of the gradient
|
2008-05-17 17:19:58 +08:00
|
|
|
*
|
|
|
|
* Returns: Number of segments.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.6
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2008-05-17 17:19:58 +08:00
|
|
|
gint
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_get_number_of_segments (GimpGradient *gradient)
|
2008-05-17 17:19:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2008-05-17 17:19:58 +08:00
|
|
|
gint num_segments = 0;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
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-gradient-get-number-of-segments",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2008-05-17 17:19:58 +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
|
|
|
num_segments = GIMP_VALUES_GET_INT (return_vals, 1);
|
2008-05-17 17:19:58 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2008-05-17 17:19:58 +08:00
|
|
|
|
|
|
|
return num_segments;
|
|
|
|
}
|
|
|
|
|
2004-10-06 07:28:17 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_get_uniform_samples:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2004-10-06 07:28:17 +08:00
|
|
|
* @num_samples: The number of samples to take.
|
|
|
|
* @reverse: Use the reverse gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_color_samples: (out): Length of the color_samples array (4 * num_samples).
|
|
|
|
* @color_samples: (out) (array length=num_color_samples) (element-type gdouble) (transfer full): Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
|
2004-10-06 07:28:17 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sample the gradient in uniform parts.
|
2004-10-06 07:28:17 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Samples colors uniformly across the gradient. It returns a list of
|
|
|
|
* floating-point values which correspond to the RGBA values for each
|
|
|
|
* sample. The minimum number of samples to take is 2, in which case
|
|
|
|
* the returned colors will correspond to the { 0.0, 1.0 } positions in
|
|
|
|
* the gradient. For example, if the number of samples is 3, the
|
|
|
|
* procedure will return the colors at positions { 0.0, 0.5, 1.0 }.
|
2004-10-06 07:28:17 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-10-06 07:28:17 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_get_uniform_samples (GimpGradient *gradient,
|
|
|
|
gint num_samples,
|
|
|
|
gboolean reverse,
|
|
|
|
gint *num_color_samples,
|
|
|
|
gdouble **color_samples)
|
2004-10-06 07:28:17 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-10-06 07:28:17 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, num_samples,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_BOOLEAN, reverse,
|
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-gradient-get-uniform-samples",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
*num_color_samples = 0;
|
|
|
|
*color_samples = NULL;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*num_color_samples = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
*color_samples = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
|
2004-10-06 07:28:17 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_get_custom_samples:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
2004-10-06 07:28:17 +08:00
|
|
|
* @num_samples: The number of samples to take.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @positions: (array length=num_samples) (element-type gdouble): The list of positions to sample along the gradient.
|
2004-10-06 07:28:17 +08:00
|
|
|
* @reverse: Use the reverse gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_color_samples: (out): Length of the color_samples array (4 * num_samples).
|
|
|
|
* @color_samples: (out) (array length=num_color_samples) (element-type gdouble) (transfer full): Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
|
2004-10-06 07:28:17 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sample the gradient in custom positions.
|
2004-10-06 07:28:17 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Samples the color of the gradient at positions from a list. The left
|
|
|
|
* endpoint of the gradient corresponds to position 0.0, and the right
|
|
|
|
* endpoint corresponds to 1.0. Returns a list of floating-point
|
|
|
|
* values, four for each sample (RGBA.)
|
2004-10-06 07:28:17 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-10-06 07:28:17 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_get_custom_samples (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint num_samples,
|
|
|
|
const gdouble *positions,
|
|
|
|
gboolean reverse,
|
|
|
|
gint *num_color_samples,
|
|
|
|
gdouble **color_samples)
|
2004-10-06 07:28:17 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-10-06 07:28:17 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, num_samples,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_FLOAT_ARRAY, NULL,
|
|
|
|
G_TYPE_BOOLEAN, reverse,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_float_array (gimp_value_array_index (args, 2), positions, num_samples);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-get-custom-samples",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
*num_color_samples = 0;
|
|
|
|
*color_samples = NULL;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*num_color_samples = GIMP_VALUES_GET_INT (return_vals, 1);
|
|
|
|
*color_samples = GIMP_VALUES_DUP_FLOAT_ARRAY (return_vals, 2);
|
2004-10-06 07:28:17 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-10-06 07:28:17 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2022-09-06 07:28:35 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_id_is_valid:
|
|
|
|
* @id: The gradient ID.
|
|
|
|
*
|
|
|
|
* Whether the ID is a valid reference to installed data.
|
|
|
|
*
|
|
|
|
* Returns TRUE if this ID is valid.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if the gradient ID is valid.
|
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_gradient_id_is_valid (const gchar *id)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean valid = FALSE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, id,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-id-is-valid",
|
|
|
|
args);
|
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
|
|
|
valid = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_left_color:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 21:39:13 +08:00
|
|
|
* @color: (out caller-allocates): The return color.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @opacity: (out): The opacity of the endpoint.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the left endpoint color of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the left endpoint color of the indexed segment of the gradient.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_left_color (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
GimpRGB *color,
|
|
|
|
gdouble *opacity)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-left-color",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*opacity = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
|
|
|
|
*opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
|
2004-05-31 06:04:16 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_left_color:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2004-05-31 06:04:16 +08:00
|
|
|
* @color: The color to set.
|
|
|
|
* @opacity: The opacity to set for the endpoint.
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the left endpoint color of a segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the color of the left endpoint the indexed segment of the
|
|
|
|
* gradient.
|
|
|
|
* Returns an error when gradient is not editable or index is out of
|
|
|
|
* range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_set_left_color (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint segment,
|
|
|
|
const GimpRGB *color,
|
|
|
|
gdouble opacity)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_RGB, color,
|
|
|
|
G_TYPE_DOUBLE, opacity,
|
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-gradient-segment-set-left-color",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_right_color:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 21:39:13 +08:00
|
|
|
* @color: (out caller-allocates): The return color.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @opacity: (out): The opacity of the endpoint.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the right endpoint color of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the color of the right endpoint color of the segment of the
|
|
|
|
* gradient.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_right_color (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
GimpRGB *color,
|
|
|
|
gdouble *opacity)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-right-color",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*opacity = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
|
|
|
|
*opacity = GIMP_VALUES_GET_DOUBLE (return_vals, 2);
|
2004-05-31 06:04:16 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_right_color:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2004-05-31 06:04:16 +08:00
|
|
|
* @color: The color to set.
|
|
|
|
* @opacity: The opacity to set for the endpoint.
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the right endpoint color of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the right endpoint color of the segment of the gradient.
|
|
|
|
* Returns an error when gradient is not editable or segment index is
|
|
|
|
* out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_set_right_color (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint segment,
|
|
|
|
const GimpRGB *color,
|
|
|
|
gdouble opacity)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_RGB, color,
|
|
|
|
G_TYPE_DOUBLE, opacity,
|
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-gradient-segment-set-right-color",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_left_pos:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @pos: (out): The return position.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the left endpoint position of a segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the position of the left endpoint of the segment of the
|
|
|
|
* gradient.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_left_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble *pos)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-left-pos",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*pos = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_left_pos:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2006-03-22 05:48:21 +08:00
|
|
|
* @pos: The position to set the guidepoint to.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @final_pos: (out): The return position.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the left endpoint position of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the position of the left endpoint of the segment of the
|
|
|
|
* gradient. The final position will be the given fraction from the
|
|
|
|
* midpoint to the left to the midpoint of the current segment.
|
|
|
|
* Returns the final position. Returns an error when gradient is not
|
|
|
|
* editable or segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_set_left_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble pos,
|
|
|
|
gdouble *final_pos)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_DOUBLE, pos,
|
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-gradient-segment-set-left-pos",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*final_pos = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_middle_pos:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @pos: (out): The return position.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the midpoint position of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the position of the midpoint of the segment of the gradient.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_middle_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble *pos)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-middle-pos",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*pos = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_middle_pos:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2006-03-22 05:48:21 +08:00
|
|
|
* @pos: The position to set the guidepoint to.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @final_pos: (out): The return position.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the midpoint position of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the midpoint position of the segment of the gradient. The final
|
|
|
|
* position will be the given fraction between the two endpoints of the
|
|
|
|
* segment.
|
|
|
|
* Returns the final position. Returns an error when gradient is not
|
|
|
|
* editable or segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_set_middle_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble pos,
|
|
|
|
gdouble *final_pos)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_DOUBLE, pos,
|
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-gradient-segment-set-middle-pos",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*final_pos = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_right_pos:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @pos: (out): The return position.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the right endpoint position of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the position of the right endpoint of the segment of the
|
|
|
|
* gradient.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_right_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble *pos)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-right-pos",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*pos = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_right_pos:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
|
|
|
* @pos: The position to set the right endpoint to.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @final_pos: (out): The return position.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the right endpoint position of the segment
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the right endpoint position of the segment of the gradient. The
|
|
|
|
* final position will be the given fraction from the midpoint of the
|
|
|
|
* current segment to the midpoint of the segment to the right.
|
|
|
|
* Returns the final position. Returns an error when gradient is not
|
|
|
|
* editable or segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_set_right_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble pos,
|
|
|
|
gdouble *final_pos)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_DOUBLE, pos,
|
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-gradient-segment-set-right-pos",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*final_pos = 0.0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_blending_function:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @blend_func: (out): The blending function of the segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the gradient segment's blending function
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the blending function of the segment at the index.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_blending_function (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint segment,
|
|
|
|
GimpGradientSegmentType *blend_func)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-blending-function",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
*blend_func = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*blend_func = GIMP_VALUES_GET_ENUM (return_vals, 1);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-03 01:45:56 +08:00
|
|
|
* gimp_gradient_segment_get_coloring_type:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @coloring_type: (out): The coloring type of the segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the gradient segment's coloring type
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Gets the coloring type of the segment at the index.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_get_coloring_type (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint segment,
|
|
|
|
GimpGradientSegmentColor *coloring_type)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, segment,
|
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-gradient-segment-get-coloring-type",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2004-06-03 01:45:56 +08:00
|
|
|
*coloring_type = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2004-06-03 01:45:56 +08:00
|
|
|
if (success)
|
2019-09-04 08:49:33 +08:00
|
|
|
*coloring_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
|
2004-06-03 01:45:56 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-03 01:45:56 +08:00
|
|
|
* gimp_gradient_segment_range_set_blending_function:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2006-05-19 01:25:15 +08:00
|
|
|
* @blending_function: The blending function.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the blending function of a range of segments
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the blending function of a range of segments.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_set_blending_function (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
GimpGradientSegmentType blending_function)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_GRADIENT_SEGMENT_TYPE, blending_function,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-set-blending-function",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +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);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-03 01:45:56 +08:00
|
|
|
* gimp_gradient_segment_range_set_coloring_type:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2006-05-19 01:25:15 +08:00
|
|
|
* @coloring_type: The coloring type.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the coloring type of a range of segments
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Sets the coloring type of a range of segments.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_set_coloring_type (GimpGradient *gradient,
|
2006-04-12 18:27:31 +08:00
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
GimpGradientSegmentColor coloring_type)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_GRADIENT_SEGMENT_COLOR, coloring_type,
|
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-gradient-segment-range-set-coloring-type",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_flip:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Flip the segment range
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Reverses the order of segments in a range, and swaps the left and
|
|
|
|
* right colors in each segment. As if the range as a 1D line were
|
|
|
|
* rotated in a plane.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_flip (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-flip",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +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);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_replicate:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
|
|
|
* @replicate_times: The number of replicas for each segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Replicate the segment range
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Replicates a segment range a given number of times. Instead of the
|
|
|
|
* original segment range, several smaller scaled copies of it will
|
|
|
|
* appear in equal widths.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_replicate (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
gint replicate_times)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
|
|
|
G_TYPE_INT, replicate_times,
|
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-gradient-segment-range-replicate",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_split_midpoint:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Splits each segment in the segment range at midpoint
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Splits each segment in the segment range at its midpoint.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-split-midpoint",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +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);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_split_uniform:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
* @split_parts: The number of uniform divisions to split each segment to.
|
|
|
|
*
|
|
|
|
* Splits each segment in the segment range uniformly
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Splits each segment in the segment range uniformly into to the
|
|
|
|
* number of parts given.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_split_uniform (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
gint split_parts)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
|
|
|
G_TYPE_INT, split_parts,
|
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-gradient-segment-range-split-uniform",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_delete:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Delete the segment range
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Deletes a range of segments.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable. Deleting all the segments is undefined behavior.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_delete (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-delete",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +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);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_redistribute_handles:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Uniformly redistribute the segment range's handles
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Redistributes the handles of the segment range of the gradient, so
|
|
|
|
* they'll be evenly spaced. A handle is where two segments meet.
|
|
|
|
* Segments will then have the same width.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_redistribute_handles (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
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-gradient-segment-range-redistribute-handles",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_blend_colors:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Blend the colors of the segment range.
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Blends the colors (but not the opacity) of the range of segments.
|
|
|
|
* The colors' transition will then be uniform across the range.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_blend_colors (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-blend-colors",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +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);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_blend_opacity:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Blend the opacity of the segment range.
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Blends the opacity (but not the colors) of the range of segments.
|
|
|
|
* The opacity's transition will then be uniform across the range.
|
|
|
|
* Returns an error when a segment index is out of range, or gradient
|
|
|
|
* is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_blend_opacity (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-31 06:04:16 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
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-gradient-segment-range-blend-opacity",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_move:
|
2022-09-06 07:28:35 +08:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @start_segment: Index of the first segment to operate on.
|
|
|
|
* @end_segment: Index of the last segment to operate on. If negative, the range will extend to the end segment.
|
2004-05-31 06:04:16 +08:00
|
|
|
* @delta: The delta to move the segment range.
|
|
|
|
* @control_compress: Whether or not to compress the neighboring segments.
|
|
|
|
*
|
|
|
|
* Move the position of an entire segment range by a delta.
|
|
|
|
*
|
2022-09-06 07:28:35 +08:00
|
|
|
* Moves the position of an entire segment range by a delta. The actual
|
|
|
|
* delta (which is returned) will be limited by the control points of
|
|
|
|
* the neighboring segments.
|
|
|
|
* Returns the actual delta. Returns an error when a segment index is
|
|
|
|
* out of range, or gradient is not editable.
|
2004-05-31 06:04:16 +08:00
|
|
|
*
|
|
|
|
* Returns: The final delta by which the range moved.
|
2004-06-02 06:50:37 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-31 06:04:16 +08:00
|
|
|
gdouble
|
2022-09-06 07:28:35 +08:00
|
|
|
gimp_gradient_segment_range_move (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
gdouble delta,
|
|
|
|
gboolean control_compress)
|
2004-05-31 06:04:16 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-04-02 19:22:47 +08:00
|
|
|
gdouble final_delta = 0.0;
|
2004-05-31 06:04:16 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-06 07:28:35 +08:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_DOUBLE, delta,
|
|
|
|
G_TYPE_BOOLEAN, control_compress,
|
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-gradient-segment-range-move",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
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
|
|
|
final_delta = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-31 06:04:16 +08:00
|
|
|
|
|
|
|
return final_delta;
|
|
|
|
}
|