app: s/sprintf/g_snprintf/ in xcf_save_image()
[gimp.git] / libgimp / gimpgradient_pdb.c
blobf47ee8f48c75d23ecd193e72dc3311aaeb7736e4
1 /* LIBGIMP - The GIMP Library
2 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
4 * gimpgradient_pdb.c
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <https://www.gnu.org/licenses/>.
21 /* NOTE: This file is auto-generated by pdbgen.pl */
23 #include "config.h"
25 #include <string.h>
27 #include "gimp.h"
30 /**
31 * SECTION: gimpgradient
32 * @title: gimpgradient
33 * @short_description: Functions operating on a single gradient.
35 * Functions operating on a single gradient.
36 **/
39 /**
40 * gimp_gradient_new:
41 * @name: The requested name of the new gradient.
43 * Creates a new gradient
45 * This procedure creates a new, uninitialized gradient
47 * Returns: The actual new gradient name.
49 * Since: 2.2
50 **/
51 gchar *
52 gimp_gradient_new (const gchar *name)
54 GimpParam *return_vals;
55 gint nreturn_vals;
56 gchar *actual_name = NULL;
58 return_vals = gimp_run_procedure ("gimp-gradient-new",
59 &nreturn_vals,
60 GIMP_PDB_STRING, name,
61 GIMP_PDB_END);
63 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
64 actual_name = g_strdup (return_vals[1].data.d_string);
66 gimp_destroy_params (return_vals, nreturn_vals);
68 return actual_name;
71 /**
72 * gimp_gradient_duplicate:
73 * @name: The gradient name.
75 * Duplicates a gradient
77 * This procedure creates an identical gradient by a different name
79 * Returns: The name of the gradient's copy.
81 * Since: 2.2
82 **/
83 gchar *
84 gimp_gradient_duplicate (const gchar *name)
86 GimpParam *return_vals;
87 gint nreturn_vals;
88 gchar *copy_name = NULL;
90 return_vals = gimp_run_procedure ("gimp-gradient-duplicate",
91 &nreturn_vals,
92 GIMP_PDB_STRING, name,
93 GIMP_PDB_END);
95 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
96 copy_name = g_strdup (return_vals[1].data.d_string);
98 gimp_destroy_params (return_vals, nreturn_vals);
100 return copy_name;
104 * gimp_gradient_is_editable:
105 * @name: The gradient name.
107 * Tests if gradient can be edited
109 * Returns TRUE if you have permission to change the gradient
111 * Returns: TRUE if the gradient can be edited.
113 * Since: 2.4
115 gboolean
116 gimp_gradient_is_editable (const gchar *name)
118 GimpParam *return_vals;
119 gint nreturn_vals;
120 gboolean editable = FALSE;
122 return_vals = gimp_run_procedure ("gimp-gradient-is-editable",
123 &nreturn_vals,
124 GIMP_PDB_STRING, name,
125 GIMP_PDB_END);
127 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
128 editable = return_vals[1].data.d_int32;
130 gimp_destroy_params (return_vals, nreturn_vals);
132 return editable;
136 * gimp_gradient_rename:
137 * @name: The gradient name.
138 * @new_name: The new name of the gradient.
140 * Rename a gradient
142 * This procedure renames a gradient
144 * Returns: The actual new name of the gradient.
146 * Since: 2.2
148 gchar *
149 gimp_gradient_rename (const gchar *name,
150 const gchar *new_name)
152 GimpParam *return_vals;
153 gint nreturn_vals;
154 gchar *actual_name = NULL;
156 return_vals = gimp_run_procedure ("gimp-gradient-rename",
157 &nreturn_vals,
158 GIMP_PDB_STRING, name,
159 GIMP_PDB_STRING, new_name,
160 GIMP_PDB_END);
162 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
163 actual_name = g_strdup (return_vals[1].data.d_string);
165 gimp_destroy_params (return_vals, nreturn_vals);
167 return actual_name;
171 * gimp_gradient_delete:
172 * @name: The gradient name.
174 * Deletes a gradient
176 * This procedure deletes a gradient
178 * Returns: TRUE on success.
180 * Since: 2.2
182 gboolean
183 gimp_gradient_delete (const gchar *name)
185 GimpParam *return_vals;
186 gint nreturn_vals;
187 gboolean success = TRUE;
189 return_vals = gimp_run_procedure ("gimp-gradient-delete",
190 &nreturn_vals,
191 GIMP_PDB_STRING, name,
192 GIMP_PDB_END);
194 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
196 gimp_destroy_params (return_vals, nreturn_vals);
198 return success;
202 * gimp_gradient_get_number_of_segments:
203 * @name: The gradient name.
205 * Returns the number of segments of the specified gradient
207 * This procedure returns the number of segments of the specified
208 * gradient.
210 * Returns: Number of segments.
212 * Since: 2.6
214 gint
215 gimp_gradient_get_number_of_segments (const gchar *name)
217 GimpParam *return_vals;
218 gint nreturn_vals;
219 gint num_segments = 0;
221 return_vals = gimp_run_procedure ("gimp-gradient-get-number-of-segments",
222 &nreturn_vals,
223 GIMP_PDB_STRING, name,
224 GIMP_PDB_END);
226 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
227 num_segments = return_vals[1].data.d_int32;
229 gimp_destroy_params (return_vals, nreturn_vals);
231 return num_segments;
235 * gimp_gradient_get_uniform_samples:
236 * @name: The gradient name.
237 * @num_samples: The number of samples to take.
238 * @reverse: Use the reverse gradient.
239 * @num_color_samples: Length of the color_samples array (4 * num_samples).
240 * @color_samples: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
242 * Sample the specified in uniform parts.
244 * This procedure samples the active gradient in the specified number
245 * of uniform parts. It returns a list of floating-point values which
246 * correspond to the RGBA values for each sample. The minimum number of
247 * samples to take is 2, in which case the returned colors will
248 * correspond to the { 0.0, 1.0 } positions in the gradient. For
249 * example, if the number of samples is 3, the procedure will return
250 * the colors at positions { 0.0, 0.5, 1.0 }.
252 * Returns: TRUE on success.
254 * Since: 2.2
256 gboolean
257 gimp_gradient_get_uniform_samples (const gchar *name,
258 gint num_samples,
259 gboolean reverse,
260 gint *num_color_samples,
261 gdouble **color_samples)
263 GimpParam *return_vals;
264 gint nreturn_vals;
265 gboolean success = TRUE;
267 return_vals = gimp_run_procedure ("gimp-gradient-get-uniform-samples",
268 &nreturn_vals,
269 GIMP_PDB_STRING, name,
270 GIMP_PDB_INT32, num_samples,
271 GIMP_PDB_INT32, reverse,
272 GIMP_PDB_END);
274 *num_color_samples = 0;
275 *color_samples = NULL;
277 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
279 if (success)
281 *num_color_samples = return_vals[1].data.d_int32;
282 *color_samples = g_new (gdouble, *num_color_samples);
283 memcpy (*color_samples,
284 return_vals[2].data.d_floatarray,
285 *num_color_samples * sizeof (gdouble));
288 gimp_destroy_params (return_vals, nreturn_vals);
290 return success;
294 * gimp_gradient_get_custom_samples:
295 * @name: The gradient name.
296 * @num_samples: The number of samples to take.
297 * @positions: The list of positions to sample along the gradient.
298 * @reverse: Use the reverse gradient.
299 * @num_color_samples: Length of the color_samples array (4 * num_samples).
300 * @color_samples: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
302 * Sample the specified gradient in custom positions.
304 * This procedure samples the active gradient in the specified number
305 * of points. The procedure will sample the gradient in the specified
306 * positions from the list. The left endpoint of the gradient
307 * corresponds to position 0.0, and the right endpoint corresponds to
308 * 1.0. The procedure returns a list of floating-point values which
309 * correspond to the RGBA values for each sample.
311 * Returns: TRUE on success.
313 * Since: 2.2
315 gboolean
316 gimp_gradient_get_custom_samples (const gchar *name,
317 gint num_samples,
318 const gdouble *positions,
319 gboolean reverse,
320 gint *num_color_samples,
321 gdouble **color_samples)
323 GimpParam *return_vals;
324 gint nreturn_vals;
325 gboolean success = TRUE;
327 return_vals = gimp_run_procedure ("gimp-gradient-get-custom-samples",
328 &nreturn_vals,
329 GIMP_PDB_STRING, name,
330 GIMP_PDB_INT32, num_samples,
331 GIMP_PDB_FLOATARRAY, positions,
332 GIMP_PDB_INT32, reverse,
333 GIMP_PDB_END);
335 *num_color_samples = 0;
336 *color_samples = NULL;
338 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
340 if (success)
342 *num_color_samples = return_vals[1].data.d_int32;
343 *color_samples = g_new (gdouble, *num_color_samples);
344 memcpy (*color_samples,
345 return_vals[2].data.d_floatarray,
346 *num_color_samples * sizeof (gdouble));
349 gimp_destroy_params (return_vals, nreturn_vals);
351 return success;
355 * gimp_gradient_segment_get_left_color:
356 * @name: The gradient name.
357 * @segment: The index of the segment within the gradient.
358 * @color: The return color.
359 * @opacity: The opacity of the endpoint.
361 * Retrieves the left endpoint color of the specified segment
363 * This procedure retrieves the left endpoint color of the specified
364 * segment of the specified gradient.
366 * Returns: TRUE on success.
368 * Since: 2.2
370 gboolean
371 gimp_gradient_segment_get_left_color (const gchar *name,
372 gint segment,
373 GimpRGB *color,
374 gdouble *opacity)
376 GimpParam *return_vals;
377 gint nreturn_vals;
378 gboolean success = TRUE;
380 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-left-color",
381 &nreturn_vals,
382 GIMP_PDB_STRING, name,
383 GIMP_PDB_INT32, segment,
384 GIMP_PDB_END);
386 *opacity = 0.0;
388 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
390 if (success)
392 *color = return_vals[1].data.d_color;
393 *opacity = return_vals[2].data.d_float;
396 gimp_destroy_params (return_vals, nreturn_vals);
398 return success;
402 * gimp_gradient_segment_set_left_color:
403 * @name: The gradient name.
404 * @segment: The index of the segment within the gradient.
405 * @color: The color to set.
406 * @opacity: The opacity to set for the endpoint.
408 * Sets the left endpoint color of the specified segment
410 * This procedure sets the left endpoint color of the specified segment
411 * of the specified gradient.
413 * Returns: TRUE on success.
415 * Since: 2.2
417 gboolean
418 gimp_gradient_segment_set_left_color (const gchar *name,
419 gint segment,
420 const GimpRGB *color,
421 gdouble opacity)
423 GimpParam *return_vals;
424 gint nreturn_vals;
425 gboolean success = TRUE;
427 return_vals = gimp_run_procedure ("gimp-gradient-segment-set-left-color",
428 &nreturn_vals,
429 GIMP_PDB_STRING, name,
430 GIMP_PDB_INT32, segment,
431 GIMP_PDB_COLOR, color,
432 GIMP_PDB_FLOAT, opacity,
433 GIMP_PDB_END);
435 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
437 gimp_destroy_params (return_vals, nreturn_vals);
439 return success;
443 * gimp_gradient_segment_get_right_color:
444 * @name: The gradient name.
445 * @segment: The index of the segment within the gradient.
446 * @color: The return color.
447 * @opacity: The opacity of the endpoint.
449 * Retrieves the right endpoint color of the specified segment
451 * This procedure retrieves the right endpoint color of the specified
452 * segment of the specified gradient.
454 * Returns: TRUE on success.
456 * Since: 2.2
458 gboolean
459 gimp_gradient_segment_get_right_color (const gchar *name,
460 gint segment,
461 GimpRGB *color,
462 gdouble *opacity)
464 GimpParam *return_vals;
465 gint nreturn_vals;
466 gboolean success = TRUE;
468 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-right-color",
469 &nreturn_vals,
470 GIMP_PDB_STRING, name,
471 GIMP_PDB_INT32, segment,
472 GIMP_PDB_END);
474 *opacity = 0.0;
476 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
478 if (success)
480 *color = return_vals[1].data.d_color;
481 *opacity = return_vals[2].data.d_float;
484 gimp_destroy_params (return_vals, nreturn_vals);
486 return success;
490 * gimp_gradient_segment_set_right_color:
491 * @name: The gradient name.
492 * @segment: The index of the segment within the gradient.
493 * @color: The color to set.
494 * @opacity: The opacity to set for the endpoint.
496 * Sets the right endpoint color of the specified segment
498 * This procedure sets the right endpoint color of the specified
499 * segment of the specified gradient.
501 * Returns: TRUE on success.
503 * Since: 2.2
505 gboolean
506 gimp_gradient_segment_set_right_color (const gchar *name,
507 gint segment,
508 const GimpRGB *color,
509 gdouble opacity)
511 GimpParam *return_vals;
512 gint nreturn_vals;
513 gboolean success = TRUE;
515 return_vals = gimp_run_procedure ("gimp-gradient-segment-set-right-color",
516 &nreturn_vals,
517 GIMP_PDB_STRING, name,
518 GIMP_PDB_INT32, segment,
519 GIMP_PDB_COLOR, color,
520 GIMP_PDB_FLOAT, opacity,
521 GIMP_PDB_END);
523 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
525 gimp_destroy_params (return_vals, nreturn_vals);
527 return success;
531 * gimp_gradient_segment_get_left_pos:
532 * @name: The gradient name.
533 * @segment: The index of the segment within the gradient.
534 * @pos: The return position.
536 * Retrieves the left endpoint position of the specified segment
538 * This procedure retrieves the left endpoint position of the specified
539 * segment of the specified gradient.
541 * Returns: TRUE on success.
543 * Since: 2.2
545 gboolean
546 gimp_gradient_segment_get_left_pos (const gchar *name,
547 gint segment,
548 gdouble *pos)
550 GimpParam *return_vals;
551 gint nreturn_vals;
552 gboolean success = TRUE;
554 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-left-pos",
555 &nreturn_vals,
556 GIMP_PDB_STRING, name,
557 GIMP_PDB_INT32, segment,
558 GIMP_PDB_END);
560 *pos = 0.0;
562 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
564 if (success)
565 *pos = return_vals[1].data.d_float;
567 gimp_destroy_params (return_vals, nreturn_vals);
569 return success;
573 * gimp_gradient_segment_set_left_pos:
574 * @name: The gradient name.
575 * @segment: The index of the segment within the gradient.
576 * @pos: The position to set the guidepoint to.
577 * @final_pos: The return position.
579 * Sets the left endpoint position of the specified segment
581 * This procedure sets the left endpoint position of the specified
582 * segment of the specified gradient. The final position will be
583 * between the position of the middle point to the left to the middle
584 * point of the current segment.
585 * This procedure returns the final position.
587 * Returns: TRUE on success.
589 * Since: 2.2
591 gboolean
592 gimp_gradient_segment_set_left_pos (const gchar *name,
593 gint segment,
594 gdouble pos,
595 gdouble *final_pos)
597 GimpParam *return_vals;
598 gint nreturn_vals;
599 gboolean success = TRUE;
601 return_vals = gimp_run_procedure ("gimp-gradient-segment-set-left-pos",
602 &nreturn_vals,
603 GIMP_PDB_STRING, name,
604 GIMP_PDB_INT32, segment,
605 GIMP_PDB_FLOAT, pos,
606 GIMP_PDB_END);
608 *final_pos = 0.0;
610 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
612 if (success)
613 *final_pos = return_vals[1].data.d_float;
615 gimp_destroy_params (return_vals, nreturn_vals);
617 return success;
621 * gimp_gradient_segment_get_middle_pos:
622 * @name: The gradient name.
623 * @segment: The index of the segment within the gradient.
624 * @pos: The return position.
626 * Retrieves the middle point position of the specified segment
628 * This procedure retrieves the middle point position of the specified
629 * segment of the specified gradient.
631 * Returns: TRUE on success.
633 * Since: 2.2
635 gboolean
636 gimp_gradient_segment_get_middle_pos (const gchar *name,
637 gint segment,
638 gdouble *pos)
640 GimpParam *return_vals;
641 gint nreturn_vals;
642 gboolean success = TRUE;
644 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-middle-pos",
645 &nreturn_vals,
646 GIMP_PDB_STRING, name,
647 GIMP_PDB_INT32, segment,
648 GIMP_PDB_END);
650 *pos = 0.0;
652 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
654 if (success)
655 *pos = return_vals[1].data.d_float;
657 gimp_destroy_params (return_vals, nreturn_vals);
659 return success;
663 * gimp_gradient_segment_set_middle_pos:
664 * @name: The gradient name.
665 * @segment: The index of the segment within the gradient.
666 * @pos: The position to set the guidepoint to.
667 * @final_pos: The return position.
669 * Sets the middle point position of the specified segment
671 * This procedure sets the middle point position of the specified
672 * segment of the specified gradient. The final position will be
673 * between the two endpoints of the segment.
674 * This procedure returns the final position.
676 * Returns: TRUE on success.
678 * Since: 2.2
680 gboolean
681 gimp_gradient_segment_set_middle_pos (const gchar *name,
682 gint segment,
683 gdouble pos,
684 gdouble *final_pos)
686 GimpParam *return_vals;
687 gint nreturn_vals;
688 gboolean success = TRUE;
690 return_vals = gimp_run_procedure ("gimp-gradient-segment-set-middle-pos",
691 &nreturn_vals,
692 GIMP_PDB_STRING, name,
693 GIMP_PDB_INT32, segment,
694 GIMP_PDB_FLOAT, pos,
695 GIMP_PDB_END);
697 *final_pos = 0.0;
699 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
701 if (success)
702 *final_pos = return_vals[1].data.d_float;
704 gimp_destroy_params (return_vals, nreturn_vals);
706 return success;
710 * gimp_gradient_segment_get_right_pos:
711 * @name: The gradient name.
712 * @segment: The index of the segment within the gradient.
713 * @pos: The return position.
715 * Retrieves the right endpoint position of the specified segment
717 * This procedure retrieves the right endpoint position of the
718 * specified segment of the specified gradient.
720 * Returns: TRUE on success.
722 * Since: 2.2
724 gboolean
725 gimp_gradient_segment_get_right_pos (const gchar *name,
726 gint segment,
727 gdouble *pos)
729 GimpParam *return_vals;
730 gint nreturn_vals;
731 gboolean success = TRUE;
733 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-right-pos",
734 &nreturn_vals,
735 GIMP_PDB_STRING, name,
736 GIMP_PDB_INT32, segment,
737 GIMP_PDB_END);
739 *pos = 0.0;
741 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
743 if (success)
744 *pos = return_vals[1].data.d_float;
746 gimp_destroy_params (return_vals, nreturn_vals);
748 return success;
752 * gimp_gradient_segment_set_right_pos:
753 * @name: The gradient name.
754 * @segment: The index of the segment within the gradient.
755 * @pos: The position to set the guidepoint to.
756 * @final_pos: The return position.
758 * Sets the right endpoint position of the specified segment
760 * This procedure sets the right endpoint position of the specified
761 * segment of the specified gradient. The final position will be
762 * between the position of the middle point of the current segment and
763 * the middle point of the segment to the right.
764 * This procedure returns the final position.
766 * Returns: TRUE on success.
768 * Since: 2.2
770 gboolean
771 gimp_gradient_segment_set_right_pos (const gchar *name,
772 gint segment,
773 gdouble pos,
774 gdouble *final_pos)
776 GimpParam *return_vals;
777 gint nreturn_vals;
778 gboolean success = TRUE;
780 return_vals = gimp_run_procedure ("gimp-gradient-segment-set-right-pos",
781 &nreturn_vals,
782 GIMP_PDB_STRING, name,
783 GIMP_PDB_INT32, segment,
784 GIMP_PDB_FLOAT, pos,
785 GIMP_PDB_END);
787 *final_pos = 0.0;
789 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
791 if (success)
792 *final_pos = return_vals[1].data.d_float;
794 gimp_destroy_params (return_vals, nreturn_vals);
796 return success;
800 * gimp_gradient_segment_get_blending_function:
801 * @name: The gradient name.
802 * @segment: The index of the segment within the gradient.
803 * @blend_func: The blending function of the segment.
805 * Retrieves the gradient segment's blending function
807 * This procedure retrieves the blending function of the segment at the
808 * specified gradient name and segment index.
810 * Returns: TRUE on success.
812 * Since: 2.2
814 gboolean
815 gimp_gradient_segment_get_blending_function (const gchar *name,
816 gint segment,
817 GimpGradientSegmentType *blend_func)
819 GimpParam *return_vals;
820 gint nreturn_vals;
821 gboolean success = TRUE;
823 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-blending-function",
824 &nreturn_vals,
825 GIMP_PDB_STRING, name,
826 GIMP_PDB_INT32, segment,
827 GIMP_PDB_END);
829 *blend_func = 0;
831 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
833 if (success)
834 *blend_func = return_vals[1].data.d_int32;
836 gimp_destroy_params (return_vals, nreturn_vals);
838 return success;
842 * gimp_gradient_segment_get_coloring_type:
843 * @name: The gradient name.
844 * @segment: The index of the segment within the gradient.
845 * @coloring_type: The coloring type of the segment.
847 * Retrieves the gradient segment's coloring type
849 * This procedure retrieves the coloring type of the segment at the
850 * specified gradient name and segment index.
852 * Returns: TRUE on success.
854 * Since: 2.2
856 gboolean
857 gimp_gradient_segment_get_coloring_type (const gchar *name,
858 gint segment,
859 GimpGradientSegmentColor *coloring_type)
861 GimpParam *return_vals;
862 gint nreturn_vals;
863 gboolean success = TRUE;
865 return_vals = gimp_run_procedure ("gimp-gradient-segment-get-coloring-type",
866 &nreturn_vals,
867 GIMP_PDB_STRING, name,
868 GIMP_PDB_INT32, segment,
869 GIMP_PDB_END);
871 *coloring_type = 0;
873 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
875 if (success)
876 *coloring_type = return_vals[1].data.d_int32;
878 gimp_destroy_params (return_vals, nreturn_vals);
880 return success;
884 * gimp_gradient_segment_range_set_blending_function:
885 * @name: The gradient name.
886 * @start_segment: The index of the first segment to operate on.
887 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
888 * @blending_function: The blending function.
890 * Change the blending function of a segments range
892 * This function changes the blending function of a segment range to
893 * the specified blending function.
895 * Returns: TRUE on success.
897 * Since: 2.2
899 gboolean
900 gimp_gradient_segment_range_set_blending_function (const gchar *name,
901 gint start_segment,
902 gint end_segment,
903 GimpGradientSegmentType blending_function)
905 GimpParam *return_vals;
906 gint nreturn_vals;
907 gboolean success = TRUE;
909 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-set-blending-function",
910 &nreturn_vals,
911 GIMP_PDB_STRING, name,
912 GIMP_PDB_INT32, start_segment,
913 GIMP_PDB_INT32, end_segment,
914 GIMP_PDB_INT32, blending_function,
915 GIMP_PDB_END);
917 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
919 gimp_destroy_params (return_vals, nreturn_vals);
921 return success;
925 * gimp_gradient_segment_range_set_coloring_type:
926 * @name: The gradient name.
927 * @start_segment: The index of the first segment to operate on.
928 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
929 * @coloring_type: The coloring type.
931 * Change the coloring type of a segments range
933 * This function changes the coloring type of a segment range to the
934 * specified coloring type.
936 * Returns: TRUE on success.
938 * Since: 2.2
940 gboolean
941 gimp_gradient_segment_range_set_coloring_type (const gchar *name,
942 gint start_segment,
943 gint end_segment,
944 GimpGradientSegmentColor coloring_type)
946 GimpParam *return_vals;
947 gint nreturn_vals;
948 gboolean success = TRUE;
950 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-set-coloring-type",
951 &nreturn_vals,
952 GIMP_PDB_STRING, name,
953 GIMP_PDB_INT32, start_segment,
954 GIMP_PDB_INT32, end_segment,
955 GIMP_PDB_INT32, coloring_type,
956 GIMP_PDB_END);
958 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
960 gimp_destroy_params (return_vals, nreturn_vals);
962 return success;
966 * gimp_gradient_segment_range_flip:
967 * @name: The gradient name.
968 * @start_segment: The index of the first segment to operate on.
969 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
971 * Flip the segment range
973 * This function flips a segment range.
975 * Returns: TRUE on success.
977 * Since: 2.2
979 gboolean
980 gimp_gradient_segment_range_flip (const gchar *name,
981 gint start_segment,
982 gint end_segment)
984 GimpParam *return_vals;
985 gint nreturn_vals;
986 gboolean success = TRUE;
988 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-flip",
989 &nreturn_vals,
990 GIMP_PDB_STRING, name,
991 GIMP_PDB_INT32, start_segment,
992 GIMP_PDB_INT32, end_segment,
993 GIMP_PDB_END);
995 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
997 gimp_destroy_params (return_vals, nreturn_vals);
999 return success;
1003 * gimp_gradient_segment_range_replicate:
1004 * @name: The gradient name.
1005 * @start_segment: The index of the first segment to operate on.
1006 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1007 * @replicate_times: The number of times to replicate.
1009 * Replicate the segment range
1011 * This function replicates a segment range a given number of times.
1012 * Instead of the original segment range, several smaller scaled copies
1013 * of it will appear in equal widths.
1015 * Returns: TRUE on success.
1017 * Since: 2.2
1019 gboolean
1020 gimp_gradient_segment_range_replicate (const gchar *name,
1021 gint start_segment,
1022 gint end_segment,
1023 gint replicate_times)
1025 GimpParam *return_vals;
1026 gint nreturn_vals;
1027 gboolean success = TRUE;
1029 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-replicate",
1030 &nreturn_vals,
1031 GIMP_PDB_STRING, name,
1032 GIMP_PDB_INT32, start_segment,
1033 GIMP_PDB_INT32, end_segment,
1034 GIMP_PDB_INT32, replicate_times,
1035 GIMP_PDB_END);
1037 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1039 gimp_destroy_params (return_vals, nreturn_vals);
1041 return success;
1045 * gimp_gradient_segment_range_split_midpoint:
1046 * @name: The gradient name.
1047 * @start_segment: The index of the first segment to operate on.
1048 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1050 * Splits each segment in the segment range at midpoint
1052 * This function splits each segment in the segment range at its
1053 * midpoint.
1055 * Returns: TRUE on success.
1057 * Since: 2.2
1059 gboolean
1060 gimp_gradient_segment_range_split_midpoint (const gchar *name,
1061 gint start_segment,
1062 gint end_segment)
1064 GimpParam *return_vals;
1065 gint nreturn_vals;
1066 gboolean success = TRUE;
1068 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-split-midpoint",
1069 &nreturn_vals,
1070 GIMP_PDB_STRING, name,
1071 GIMP_PDB_INT32, start_segment,
1072 GIMP_PDB_INT32, end_segment,
1073 GIMP_PDB_END);
1075 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1077 gimp_destroy_params (return_vals, nreturn_vals);
1079 return success;
1083 * gimp_gradient_segment_range_split_uniform:
1084 * @name: The gradient name.
1085 * @start_segment: The index of the first segment to operate on.
1086 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1087 * @split_parts: The number of uniform divisions to split each segment to.
1089 * Splits each segment in the segment range uniformly
1091 * This function splits each segment in the segment range uniformly
1092 * according to the number of times specified by the parameter.
1094 * Returns: TRUE on success.
1096 * Since: 2.2
1098 gboolean
1099 gimp_gradient_segment_range_split_uniform (const gchar *name,
1100 gint start_segment,
1101 gint end_segment,
1102 gint split_parts)
1104 GimpParam *return_vals;
1105 gint nreturn_vals;
1106 gboolean success = TRUE;
1108 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-split-uniform",
1109 &nreturn_vals,
1110 GIMP_PDB_STRING, name,
1111 GIMP_PDB_INT32, start_segment,
1112 GIMP_PDB_INT32, end_segment,
1113 GIMP_PDB_INT32, split_parts,
1114 GIMP_PDB_END);
1116 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1118 gimp_destroy_params (return_vals, nreturn_vals);
1120 return success;
1124 * gimp_gradient_segment_range_delete:
1125 * @name: The gradient name.
1126 * @start_segment: The index of the first segment to operate on.
1127 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1129 * Delete the segment range
1131 * This function deletes a segment range.
1133 * Returns: TRUE on success.
1135 * Since: 2.2
1137 gboolean
1138 gimp_gradient_segment_range_delete (const gchar *name,
1139 gint start_segment,
1140 gint end_segment)
1142 GimpParam *return_vals;
1143 gint nreturn_vals;
1144 gboolean success = TRUE;
1146 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-delete",
1147 &nreturn_vals,
1148 GIMP_PDB_STRING, name,
1149 GIMP_PDB_INT32, start_segment,
1150 GIMP_PDB_INT32, end_segment,
1151 GIMP_PDB_END);
1153 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1155 gimp_destroy_params (return_vals, nreturn_vals);
1157 return success;
1161 * gimp_gradient_segment_range_redistribute_handles:
1162 * @name: The gradient name.
1163 * @start_segment: The index of the first segment to operate on.
1164 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1166 * Uniformly redistribute the segment range's handles
1168 * This function redistributes the handles of the specified segment
1169 * range of the specified gradient, so they'll be evenly spaced.
1171 * Returns: TRUE on success.
1173 * Since: 2.2
1175 gboolean
1176 gimp_gradient_segment_range_redistribute_handles (const gchar *name,
1177 gint start_segment,
1178 gint end_segment)
1180 GimpParam *return_vals;
1181 gint nreturn_vals;
1182 gboolean success = TRUE;
1184 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-redistribute-handles",
1185 &nreturn_vals,
1186 GIMP_PDB_STRING, name,
1187 GIMP_PDB_INT32, start_segment,
1188 GIMP_PDB_INT32, end_segment,
1189 GIMP_PDB_END);
1191 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1193 gimp_destroy_params (return_vals, nreturn_vals);
1195 return success;
1199 * gimp_gradient_segment_range_blend_colors:
1200 * @name: The gradient name.
1201 * @start_segment: The index of the first segment to operate on.
1202 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1204 * Blend the colors of the segment range.
1206 * This function blends the colors (but not the opacity) of the
1207 * segments' range of the gradient. Using it, the colors' transition
1208 * will be uniform across the range.
1210 * Returns: TRUE on success.
1212 * Since: 2.2
1214 gboolean
1215 gimp_gradient_segment_range_blend_colors (const gchar *name,
1216 gint start_segment,
1217 gint end_segment)
1219 GimpParam *return_vals;
1220 gint nreturn_vals;
1221 gboolean success = TRUE;
1223 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-blend-colors",
1224 &nreturn_vals,
1225 GIMP_PDB_STRING, name,
1226 GIMP_PDB_INT32, start_segment,
1227 GIMP_PDB_INT32, end_segment,
1228 GIMP_PDB_END);
1230 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1232 gimp_destroy_params (return_vals, nreturn_vals);
1234 return success;
1238 * gimp_gradient_segment_range_blend_opacity:
1239 * @name: The gradient name.
1240 * @start_segment: The index of the first segment to operate on.
1241 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1243 * Blend the opacity of the segment range.
1245 * This function blends the opacity (but not the colors) of the
1246 * segments' range of the gradient. Using it, the opacity's transition
1247 * will be uniform across the range.
1249 * Returns: TRUE on success.
1251 * Since: 2.2
1253 gboolean
1254 gimp_gradient_segment_range_blend_opacity (const gchar *name,
1255 gint start_segment,
1256 gint end_segment)
1258 GimpParam *return_vals;
1259 gint nreturn_vals;
1260 gboolean success = TRUE;
1262 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-blend-opacity",
1263 &nreturn_vals,
1264 GIMP_PDB_STRING, name,
1265 GIMP_PDB_INT32, start_segment,
1266 GIMP_PDB_INT32, end_segment,
1267 GIMP_PDB_END);
1269 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
1271 gimp_destroy_params (return_vals, nreturn_vals);
1273 return success;
1277 * gimp_gradient_segment_range_move:
1278 * @name: The gradient name.
1279 * @start_segment: The index of the first segment to operate on.
1280 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
1281 * @delta: The delta to move the segment range.
1282 * @control_compress: Whether or not to compress the neighboring segments.
1284 * Move the position of an entire segment range by a delta.
1286 * This function moves the position of an entire segment range by a
1287 * delta. The actual delta (which is returned) will be limited by the
1288 * control points of the neighboring segments.
1290 * Returns: The final delta by which the range moved.
1292 * Since: 2.2
1294 gdouble
1295 gimp_gradient_segment_range_move (const gchar *name,
1296 gint start_segment,
1297 gint end_segment,
1298 gdouble delta,
1299 gboolean control_compress)
1301 GimpParam *return_vals;
1302 gint nreturn_vals;
1303 gdouble final_delta = 0.0;
1305 return_vals = gimp_run_procedure ("gimp-gradient-segment-range-move",
1306 &nreturn_vals,
1307 GIMP_PDB_STRING, name,
1308 GIMP_PDB_INT32, start_segment,
1309 GIMP_PDB_INT32, end_segment,
1310 GIMP_PDB_FLOAT, delta,
1311 GIMP_PDB_INT32, control_compress,
1312 GIMP_PDB_END);
1314 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
1315 final_delta = return_vals[1].data.d_float;
1317 gimp_destroy_params (return_vals, nreturn_vals);
1319 return final_delta;