2004-05-30 22:04:16 +00:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
2004-09-28 22:01:21 +00:00
|
|
|
* gimpgradient_pdb.c
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2004-05-30 22:04:16 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-17 22:28:01 +00:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2004-05-30 22:04:16 +00: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-17 22:28:01 +00:00
|
|
|
* License along with this library. If not, see
|
2018-07-11 23:27:07 +02:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2004-05-30 22:04:16 +00:00
|
|
|
*/
|
|
|
|
|
2007-01-09 10:52:47 +00:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 15:13:17 +02:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2004-05-30 22:04:16 +00:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 11:43:10 +02:00
|
|
|
|
|
|
|
/**
|
2019-07-31 10:04:43 +02:00
|
|
|
* SECTION: gimpgradient
|
2010-07-07 11:43:10 +02:00
|
|
|
* @title: gimpgradient
|
2022-09-05 19:28:35 -04:00
|
|
|
* @short_description: Installable object used by the gradient rendering tool.
|
2010-07-07 11:43:10 +02:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Installable object used by the gradient rendering tool.
|
2010-07-07 11:43:10 +02:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2004-09-28 22:01:21 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradient_new:
|
|
|
|
* @name: The requested name of the new gradient.
|
|
|
|
*
|
|
|
|
* Creates a new gradient
|
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Creates a new gradient having no segments.
|
2004-09-28 22:01:21 +00:00
|
|
|
*
|
2023-07-11 16:13:36 +02:00
|
|
|
* Returns: (transfer none): The gradient.
|
2004-09-28 22:01:21 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2022-09-05 19:28:35 -04:00
|
|
|
GimpGradient *
|
2004-09-28 22:01:21 +00:00
|
|
|
gimp_gradient_new (const gchar *name)
|
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2022-09-05 19:28:35 -04:00
|
|
|
GimpGradient *gradient = NULL;
|
2004-09-28 22:01:21 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, name,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-new",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-09-28 22:01:21 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2022-09-05 19:28:35 -04:00
|
|
|
gradient = GIMP_VALUES_GET_GRADIENT (return_vals, 1);
|
2004-09-28 22:01:21 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-09-28 22:01:21 +00:00
|
|
|
|
2022-09-05 19:28:35 -04:00
|
|
|
return gradient;
|
2004-09-28 22:01:21 +00:00
|
|
|
}
|
|
|
|
|
2023-05-31 16:12:04 +02:00
|
|
|
/**
|
|
|
|
* gimp_gradient_get_by_name:
|
|
|
|
* @name: The name of the gradient.
|
|
|
|
*
|
|
|
|
* Returns the gradient with the given name.
|
|
|
|
*
|
2024-03-11 13:10:47 -04:00
|
|
|
* Returns an existing gradient having the given name. Returns %NULL
|
|
|
|
* when no gradient exists of that name.
|
2023-05-31 16:12:04 +02:00
|
|
|
*
|
2024-03-11 13:10:47 -04:00
|
|
|
* Returns: (nullable) (transfer none): The gradient.
|
2023-05-31 16:12:04 +02:00
|
|
|
*
|
|
|
|
* Since: 3.0
|
|
|
|
**/
|
|
|
|
GimpGradient *
|
|
|
|
gimp_gradient_get_by_name (const gchar *name)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
GimpGradient *gradient = NULL;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, name,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-get-by-name",
|
|
|
|
args);
|
2023-05-31 16:12:04 +02:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
|
|
|
gradient = GIMP_VALUES_GET_GRADIENT (return_vals, 1);
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return gradient;
|
|
|
|
}
|
|
|
|
|
2008-05-17 09:19:58 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradient_get_number_of_segments:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
2008-05-17 09:19:58 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the number of segments of the gradient
|
2008-05-17 09:19:58 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the number of segments of the gradient
|
2008-05-17 09:19:58 +00:00
|
|
|
*
|
|
|
|
* Returns: Number of segments.
|
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.6
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2008-05-17 09:19:58 +00:00
|
|
|
gint
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_get_number_of_segments (GimpGradient *gradient)
|
2008-05-17 09:19:58 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2008-05-17 09:19:58 +00:00
|
|
|
gint num_segments = 0;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-get-number-of-segments",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2008-05-17 09:19:58 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 02:49:33 +02:00
|
|
|
num_segments = GIMP_VALUES_GET_INT (return_vals, 1);
|
2008-05-17 09:19:58 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2008-05-17 09:19:58 +00:00
|
|
|
|
|
|
|
return num_segments;
|
|
|
|
}
|
|
|
|
|
2004-10-05 23:28:17 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradient_get_uniform_samples:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
2004-10-05 23:28:17 +00:00
|
|
|
* @num_samples: The number of samples to take.
|
|
|
|
* @reverse: Use the reverse gradient.
|
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sample the gradient in uniform parts.
|
2004-10-05 23:28:17 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Samples colors uniformly across the gradient. It returns a list of
|
2024-11-03 13:12:33 +01:00
|
|
|
* colors 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-05 23:28:17 +00:00
|
|
|
*
|
2024-11-03 13:12:33 +01:00
|
|
|
* Returns: (array zero-terminated=1) (transfer full): Color samples.
|
|
|
|
* The returned value must be freed with gimp_color_array_free().
|
2004-10-05 23:28:17 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2024-11-03 13:12:33 +01:00
|
|
|
GeglColor **
|
|
|
|
gimp_gradient_get_uniform_samples (GimpGradient *gradient,
|
|
|
|
gint num_samples,
|
|
|
|
gboolean reverse)
|
2004-10-05 23:28:17 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2024-11-03 13:12:33 +01:00
|
|
|
GeglColor **color_samples = NULL;
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, num_samples,
|
2019-08-08 13:01:50 +02:00
|
|
|
G_TYPE_BOOLEAN, reverse,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-get-uniform-samples",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2024-11-03 13:12:33 +01:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
|
|
|
color_samples = gimp_color_array_copy (g_value_get_boxed (gimp_value_array_index (return_vals, 1)));
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2024-11-03 13:12:33 +01:00
|
|
|
return color_samples;
|
2004-10-05 23:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_get_custom_samples:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
2004-10-05 23:28:17 +00:00
|
|
|
* @num_samples: The number of samples to take.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @positions: (array length=num_samples) (element-type gdouble): The list of positions to sample along the gradient.
|
2004-10-05 23:28:17 +00:00
|
|
|
* @reverse: Use the reverse gradient.
|
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sample the gradient in custom positions.
|
2004-10-05 23:28:17 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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
|
2024-11-03 13:20:36 +01:00
|
|
|
* endpoint corresponds to 1.0. Returns a list of colors, one for each
|
|
|
|
* sample.
|
2004-10-05 23:28:17 +00:00
|
|
|
*
|
2024-11-03 13:20:36 +01:00
|
|
|
* Returns: (array zero-terminated=1) (transfer full): Color samples.
|
|
|
|
* The returned value must be freed with gimp_color_array_free().
|
2004-10-05 23:28:17 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2024-11-03 13:20:36 +01:00
|
|
|
GeglColor **
|
|
|
|
gimp_gradient_get_custom_samples (GimpGradient *gradient,
|
|
|
|
gsize num_samples,
|
|
|
|
const gdouble *positions,
|
|
|
|
gboolean reverse)
|
2004-10-05 23:28:17 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2024-11-03 13:20:36 +01:00
|
|
|
GeglColor **color_samples = NULL;
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2024-11-03 13:20:36 +01:00
|
|
|
g_return_val_if_fail (num_samples >= 1, NULL);
|
2024-10-25 16:56:48 +02:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
app, libgimp*, pdb, plug-ins: rename various public API name s/float/double/.
Several types functions were using the wording "float" historically to
mean double-precision, e.g. the float array type (which was in fact a
double array). Or the scanner function gimp_scanner_parse_float() was in
fact returning a double value. What if we wanted someday to actually add
float (usually this naming means in C the single-precision IEEE 754
floating point representation) support? How would we name this?
Now technically it's not entirely wrong (a double is still a floating
point). So I've been wondering if that is because maybe we never planned
to have float and double precision may be good enough for all usage in a
plug-in API (which doesn't have to be as generic so the higher precision
is enough)? But how can we be sure? Also we already had some functions
using the wording double (e.g. gimp_procedure_add_double_argument()), so
let's just go the safe route and use the accurate wording.
The additional change in PDB is internal, but there too, I was also
finding very confusing that we were naming double-precision float as
'float' type. So I took the opportunity to update this. It doesn't
change any signature.
In fact the whole commit doesn't change any type or code logic, only
naming, except for one bug fix in the middle which I encountered while
renaming: in gimp_scanner_parse_deprecated_color(), I discovered a
hidden bug in scanning (color-hsv*) values, which was mistakenly using a
double type for an array of float.
2024-11-02 14:03:37 +01:00
|
|
|
GIMP_TYPE_DOUBLE_ARRAY, NULL,
|
2019-08-08 13:01:50 +02:00
|
|
|
G_TYPE_BOOLEAN, reverse,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
app, libgimp*, pdb, plug-ins: rename various public API name s/float/double/.
Several types functions were using the wording "float" historically to
mean double-precision, e.g. the float array type (which was in fact a
double array). Or the scanner function gimp_scanner_parse_float() was in
fact returning a double value. What if we wanted someday to actually add
float (usually this naming means in C the single-precision IEEE 754
floating point representation) support? How would we name this?
Now technically it's not entirely wrong (a double is still a floating
point). So I've been wondering if that is because maybe we never planned
to have float and double precision may be good enough for all usage in a
plug-in API (which doesn't have to be as generic so the higher precision
is enough)? But how can we be sure? Also we already had some functions
using the wording double (e.g. gimp_procedure_add_double_argument()), so
let's just go the safe route and use the accurate wording.
The additional change in PDB is internal, but there too, I was also
finding very confusing that we were naming double-precision float as
'float' type. So I took the opportunity to update this. It doesn't
change any signature.
In fact the whole commit doesn't change any type or code logic, only
naming, except for one bug fix in the middle which I encountered while
renaming: in gimp_scanner_parse_deprecated_color(), I discovered a
hidden bug in scanning (color-hsv*) values, which was mistakenly using a
double type for an array of float.
2024-11-02 14:03:37 +01:00
|
|
|
gimp_value_set_double_array (gimp_value_array_index (args, 1), positions, num_samples);
|
2019-07-30 10:51:16 +02:00
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-get-custom-samples",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2024-11-03 13:20:36 +01:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
|
|
|
color_samples = gimp_color_array_copy (g_value_get_boxed (gimp_value_array_index (return_vals, 1)));
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-10-05 23:28:17 +00:00
|
|
|
|
2024-11-03 13:20:36 +01:00
|
|
|
return color_samples;
|
2004-10-05 23:28:17 +00:00
|
|
|
}
|
|
|
|
|
2004-05-30 22:04:16 +00:00
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_left_color:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the left endpoint color of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
2023-11-26 21:37:52 +01:00
|
|
|
* Returns: (transfer full): The return color.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2023-11-26 21:37:52 +01:00
|
|
|
GeglColor *
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_left_color (GimpGradient *gradient,
|
2023-11-26 21:37:52 +01:00
|
|
|
gint segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2023-11-26 21:37:52 +01:00
|
|
|
GeglColor *color = NULL;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-left-color",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-11-26 21:37:52 +01:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
|
|
|
color = g_value_dup_object (gimp_value_array_index (return_vals, 1));
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-11-26 21:37:52 +01:00
|
|
|
return color;
|
2004-05-30 22:04:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_left_color:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2004-05-30 22:04:16 +00:00
|
|
|
* @color: The color to set.
|
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the left endpoint color of a segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the color of the left endpoint the indexed segment of the
|
2023-11-26 21:37:52 +01:00
|
|
|
* gradient. The alpha channel of the [class@Gegl.Color] is taken into
|
|
|
|
* account.
|
2022-09-05 19:28:35 -04:00
|
|
|
* Returns an error when gradient is not editable or index is out of
|
|
|
|
* range.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2023-11-26 21:37:52 +01:00
|
|
|
gimp_gradient_segment_set_left_color (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
GeglColor *color)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2023-11-26 21:37:52 +01:00
|
|
|
GEGL_TYPE_COLOR, color,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-set-left-color",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_right_color:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the right endpoint color of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
2023-11-26 21:37:52 +01:00
|
|
|
* Returns: (transfer full): The return color.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2023-11-26 21:37:52 +01:00
|
|
|
GeglColor *
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_right_color (GimpGradient *gradient,
|
2023-11-26 21:37:52 +01:00
|
|
|
gint segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2023-11-26 21:37:52 +01:00
|
|
|
GeglColor *color = NULL;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-right-color",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-11-26 21:37:52 +01:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
|
|
|
color = g_value_dup_object (gimp_value_array_index (return_vals, 1));
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-11-26 21:37:52 +01:00
|
|
|
return color;
|
2004-05-30 22:04:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_right_color:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2004-05-30 22:04:16 +00:00
|
|
|
* @color: The color to set.
|
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the right endpoint color of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2023-11-26 21:37:52 +01:00
|
|
|
* Sets the right endpoint color of the segment of the gradient. The
|
|
|
|
* alpha channel of the [class@Gegl.Color] is taken into account.
|
2022-09-05 19:28:35 -04:00
|
|
|
* Returns an error when gradient is not editable or segment index is
|
|
|
|
* out of range.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2023-11-26 21:37:52 +01:00
|
|
|
gimp_gradient_segment_set_right_color (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
GeglColor *color)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2023-11-26 21:37:52 +01:00
|
|
|
GEGL_TYPE_COLOR, color,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-set-right-color",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_left_pos:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @pos: (out): The return position.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the left endpoint position of a segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_left_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble *pos)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-left-pos",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*pos = 0.0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_left_pos:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2006-03-21 21:48:21 +00:00
|
|
|
* @pos: The position to set the guidepoint to.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @final_pos: (out): The return position.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the left endpoint position of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_set_left_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble pos,
|
|
|
|
gdouble *final_pos)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 13:01:50 +02:00
|
|
|
G_TYPE_DOUBLE, pos,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-set-left-pos",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*final_pos = 0.0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_middle_pos:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @pos: (out): The return position.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the midpoint position of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_middle_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble *pos)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-middle-pos",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*pos = 0.0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_middle_pos:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2006-03-21 21:48:21 +00:00
|
|
|
* @pos: The position to set the guidepoint to.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @final_pos: (out): The return position.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the midpoint position of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_set_middle_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble pos,
|
|
|
|
gdouble *final_pos)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 13:01:50 +02:00
|
|
|
G_TYPE_DOUBLE, pos,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-set-middle-pos",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*final_pos = 0.0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_right_pos:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @pos: (out): The return position.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the right endpoint position of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_right_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble *pos)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-right-pos",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*pos = 0.0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_set_right_pos:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
|
|
|
* @pos: The position to set the right endpoint to.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @final_pos: (out): The return position.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the right endpoint position of the segment
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_set_right_pos (GimpGradient *gradient,
|
|
|
|
gint segment,
|
|
|
|
gdouble pos,
|
|
|
|
gdouble *final_pos)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-08-08 13:01:50 +02:00
|
|
|
G_TYPE_DOUBLE, pos,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-set-right-pos",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*final_pos = 0.0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*final_pos = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_get_blending_function:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @blend_func: (out): The blending function of the segment.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the gradient segment's blending function
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the blending function of the segment at the index.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_blending_function (GimpGradient *gradient,
|
2006-04-12 10:27:31 +00:00
|
|
|
gint segment,
|
|
|
|
GimpGradientSegmentType *blend_func)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-blending-function",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
*blend_func = 0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*blend_func = GIMP_VALUES_GET_ENUM (return_vals, 1);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-02 17:45:56 +00:00
|
|
|
* gimp_gradient_segment_get_coloring_type:
|
2022-09-05 19:28:35 -04:00
|
|
|
* @gradient: The gradient.
|
|
|
|
* @segment: The index of a segment within the gradient.
|
2019-07-31 22:51:35 +02:00
|
|
|
* @coloring_type: (out): The coloring type of the segment.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the gradient segment's coloring type
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Gets the coloring type of the segment at the index.
|
|
|
|
* Returns an error when the segment index is out of range.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_get_coloring_type (GimpGradient *gradient,
|
2006-04-12 10:27:31 +00:00
|
|
|
gint segment,
|
|
|
|
GimpGradientSegmentColor *coloring_type)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-get-coloring-type",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2004-06-02 17:45:56 +00:00
|
|
|
*coloring_type = 0;
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2004-06-02 17:45:56 +00:00
|
|
|
if (success)
|
2019-09-04 02:49:33 +02:00
|
|
|
*coloring_type = GIMP_VALUES_GET_ENUM (return_vals, 1);
|
2004-06-02 17:45:56 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-02 17:45:56 +00:00
|
|
|
* gimp_gradient_segment_range_set_blending_function:
|
2022-09-05 19:28:35 -04: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-18 17:25:15 +00:00
|
|
|
* @blending_function: The blending function.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the blending function of a range of segments
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_set_blending_function (GimpGradient *gradient,
|
2006-04-12 10:27:31 +00:00
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
GimpGradientSegmentType blending_function)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-08-08 13:01:50 +02:00
|
|
|
GIMP_TYPE_GRADIENT_SEGMENT_TYPE, blending_function,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-set-blending-function",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2004-06-02 17:45:56 +00:00
|
|
|
* gimp_gradient_segment_range_set_coloring_type:
|
2022-09-05 19:28:35 -04: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-18 17:25:15 +00:00
|
|
|
* @coloring_type: The coloring type.
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04:00
|
|
|
* Sets the coloring type of a range of segments
|
2004-05-30 22:04:16 +00:00
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_set_coloring_type (GimpGradient *gradient,
|
2006-04-12 10:27:31 +00:00
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
GimpGradientSegmentColor coloring_type)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-08-08 13:01:50 +02:00
|
|
|
GIMP_TYPE_GRADIENT_SEGMENT_COLOR, coloring_type,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-set-coloring-type",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_flip:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Flip the segment range
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_flip (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-flip",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_replicate:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Replicate the segment range
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_replicate (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
gint replicate_times)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
|
|
|
G_TYPE_INT, replicate_times,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-replicate",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_split_midpoint:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Splits each segment in the segment range at midpoint
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_split_midpoint (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-split-midpoint",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_split_uniform:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
* @split_parts: The number of uniform divisions to split each segment to.
|
|
|
|
*
|
|
|
|
* Splits each segment in the segment range uniformly
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_split_uniform (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
gint split_parts)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
|
|
|
G_TYPE_INT, split_parts,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-split-uniform",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_delete:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Delete the segment range
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_delete (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-delete",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_redistribute_handles:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Uniformly redistribute the segment range's handles
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_redistribute_handles (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-redistribute-handles",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_blend_colors:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Blend the colors of the segment range.
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_blend_colors (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-blend-colors",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_blend_opacity:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Blend the opacity of the segment range.
|
|
|
|
*
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_blend_opacity (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-30 22:04:16 +00:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-blend-opacity",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_gradient_segment_range_move:
|
2022-09-05 19:28:35 -04: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-30 22:04:16 +00: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-05 19:28:35 -04: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-30 22:04:16 +00:00
|
|
|
*
|
|
|
|
* Returns: The final delta by which the range moved.
|
2004-06-01 22:50:37 +00:00
|
|
|
*
|
2015-05-31 21:18:09 +02:00
|
|
|
* Since: 2.2
|
2010-09-15 22:07:36 +02:00
|
|
|
**/
|
2004-05-30 22:04:16 +00:00
|
|
|
gdouble
|
2022-09-05 19:28:35 -04:00
|
|
|
gimp_gradient_segment_range_move (GimpGradient *gradient,
|
|
|
|
gint start_segment,
|
|
|
|
gint end_segment,
|
|
|
|
gdouble delta,
|
|
|
|
gboolean control_compress)
|
2004-05-30 22:04:16 +00:00
|
|
|
{
|
2019-07-30 10:51:16 +02:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-04-02 11:22:47 +00:00
|
|
|
gdouble final_delta = 0.0;
|
2004-05-30 22:04:16 +00:00
|
|
|
|
2019-08-08 13:01:50 +02:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2022-09-05 19:28:35 -04:00
|
|
|
GIMP_TYPE_GRADIENT, gradient,
|
2019-08-15 14:04:56 +02:00
|
|
|
G_TYPE_INT, start_segment,
|
|
|
|
G_TYPE_INT, end_segment,
|
2019-08-08 13:01:50 +02:00
|
|
|
G_TYPE_DOUBLE, delta,
|
|
|
|
G_TYPE_BOOLEAN, control_compress,
|
2019-07-30 10:51:16 +02:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2023-10-16 22:07:55 +02:00
|
|
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-gradient-segment-range-move",
|
|
|
|
args);
|
2019-07-30 10:51:16 +02:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 01:49:35 +02:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 02:49:33 +02:00
|
|
|
final_delta = GIMP_VALUES_GET_DOUBLE (return_vals, 1);
|
2019-07-30 10:51:16 +02:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-30 22:04:16 +00:00
|
|
|
|
|
|
|
return final_delta;
|
|
|
|
}
|