Commit 6d91f4c9 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

set_blending_function() and set_coloring_type() work on segment ranges,

2004-06-02  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/gradient_edit.pdb: set_blending_function() and
	set_coloring_type() work on segment ranges, renamed them
	accordingly. Spotted by Shlomi Fish.

	* app/pdb/gradient_edit_cmds.c
	* libgimp/gimpgradientedit_pdb.[ch]: regenerated.
parent f4a9e554
2004-06-02 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/gradient_edit.pdb: set_blending_function() and
set_coloring_type() work on segment ranges, renamed them
accordingly. Spotted by Shlomi Fish.
* app/pdb/gradient_edit_cmds.c
* libgimp/gimpgradientedit_pdb.[ch]: regenerated.
2004-06-02 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdnd.[ch]: removed utility funtion
......
......@@ -49,9 +49,9 @@ static ProcRecord gradient_segment_set_middle_pos_proc;
static ProcRecord gradient_segment_get_right_pos_proc;
static ProcRecord gradient_segment_set_right_pos_proc;
static ProcRecord gradient_segment_get_blending_function_proc;
static ProcRecord gradient_segment_set_blending_function_proc;
static ProcRecord gradient_segment_get_coloring_type_proc;
static ProcRecord gradient_segment_set_coloring_type_proc;
static ProcRecord gradient_segment_range_set_blending_function_proc;
static ProcRecord gradient_segment_range_set_coloring_type_proc;
static ProcRecord gradient_segment_range_flip_proc;
static ProcRecord gradient_segment_range_replicate_proc;
static ProcRecord gradient_segment_range_split_midpoint_proc;
......@@ -76,9 +76,9 @@ register_gradient_edit_procs (Gimp *gimp)
procedural_db_register (gimp, &gradient_segment_get_right_pos_proc);
procedural_db_register (gimp, &gradient_segment_set_right_pos_proc);
procedural_db_register (gimp, &gradient_segment_get_blending_function_proc);
procedural_db_register (gimp, &gradient_segment_set_blending_function_proc);
procedural_db_register (gimp, &gradient_segment_get_coloring_type_proc);
procedural_db_register (gimp, &gradient_segment_set_coloring_type_proc);
procedural_db_register (gimp, &gradient_segment_range_set_blending_function_proc);
procedural_db_register (gimp, &gradient_segment_range_set_coloring_type_proc);
procedural_db_register (gimp, &gradient_segment_range_flip_proc);
procedural_db_register (gimp, &gradient_segment_range_replicate_proc);
procedural_db_register (gimp, &gradient_segment_range_split_midpoint_proc);
......@@ -1225,9 +1225,107 @@ static ProcRecord gradient_segment_get_blending_function_proc =
};
static Argument *
gradient_segment_set_blending_function_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
gradient_segment_get_coloring_type_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
gint32 segment;
gint32 coloring_type = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
segment = args[1].value.pdb_int;
if (segment < 0)
success = FALSE;
if (success)
{
if (strlen (name))
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
else
{
gradient = gimp_context_get_gradient (context);
}
success = (gradient != NULL);
if (success)
{
GimpGradientSegment *seg;
seg = gimp_gradient_segment_get_nth (gradient->segments, segment);
success = (seg != NULL);
if (success)
{
coloring_type = gimp_gradient_segment_get_coloring_type (gradient, seg);
}
}
}
return_args = procedural_db_return_args (&gradient_segment_get_coloring_type_proc, success);
if (success)
return_args[1].value.pdb_int = coloring_type;
return return_args;
}
static ProcArg gradient_segment_get_coloring_type_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The name of the gradient to operate on"
},
{
GIMP_PDB_INT32,
"segment",
"The index of the segment within the gradient"
}
};
static ProcArg gradient_segment_get_coloring_type_outargs[] =
{
{
GIMP_PDB_INT32,
"coloring_type",
"The coloring type of the segment: { GIMP_GRADIENT_SEGMENT_RGB (0), GIMP_GRADIENT_SEGMENT_HSV_CCW (1), GIMP_GRADIENT_SEGMENT_HSV_CW (2) }"
}
};
static ProcRecord gradient_segment_get_coloring_type_proc =
{
"gimp_gradient_segment_get_coloring_type",
"Retrieves the gradient segment's coloring type",
"This procedure retrieves the coloring type of the segment at the specified gradient name and segment index.",
"Shlomi Fish",
"Shlomi Fish",
"2003",
GIMP_INTERNAL,
2,
gradient_segment_get_coloring_type_inargs,
1,
gradient_segment_get_coloring_type_outargs,
{ { gradient_segment_get_coloring_type_invoker } }
};
static Argument *
gradient_segment_range_set_blending_function_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
......@@ -1301,10 +1399,10 @@ gradient_segment_set_blending_function_invoker (Gimp *gimp,
}
}
return procedural_db_return_args (&gradient_segment_set_blending_function_proc, success);
return procedural_db_return_args (&gradient_segment_range_set_blending_function_proc, success);
}
static ProcArg gradient_segment_set_blending_function_inargs[] =
static ProcArg gradient_segment_range_set_blending_function_inargs[] =
{
{
GIMP_PDB_STRING,
......@@ -1328,9 +1426,9 @@ static ProcArg gradient_segment_set_blending_function_inargs[] =
}
};
static ProcRecord gradient_segment_set_blending_function_proc =
static ProcRecord gradient_segment_range_set_blending_function_proc =
{
"gimp_gradient_segment_set_blending_function",
"gimp_gradient_segment_range_set_blending_function",
"Change the blending function of a segments range",
"This function changes the blending function of a segment range to the specified blending function.",
"Shlomi Fish",
......@@ -1338,114 +1436,16 @@ static ProcRecord gradient_segment_set_blending_function_proc =
"2003",
GIMP_INTERNAL,
4,
gradient_segment_set_blending_function_inargs,
gradient_segment_range_set_blending_function_inargs,
0,
NULL,
{ { gradient_segment_set_blending_function_invoker } }
{ { gradient_segment_range_set_blending_function_invoker } }
};
static Argument *
gradient_segment_get_coloring_type_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *name;
gint32 segment;
gint32 coloring_type = 0;
GimpGradient *gradient = NULL;
name = (gchar *) args[0].value.pdb_pointer;
if (name == NULL || !g_utf8_validate (name, -1, NULL))
success = FALSE;
segment = args[1].value.pdb_int;
if (segment < 0)
success = FALSE;
if (success)
{
if (strlen (name))
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (gimp->gradient_factory->container,
name);
}
else
{
gradient = gimp_context_get_gradient (context);
}
success = (gradient != NULL);
if (success)
{
GimpGradientSegment *seg;
seg = gimp_gradient_segment_get_nth (gradient->segments, segment);
success = (seg != NULL);
if (success)
{
coloring_type = gimp_gradient_segment_get_coloring_type (gradient, seg);
}
}
}
return_args = procedural_db_return_args (&gradient_segment_get_coloring_type_proc, success);
if (success)
return_args[1].value.pdb_int = coloring_type;
return return_args;
}
static ProcArg gradient_segment_get_coloring_type_inargs[] =
{
{
GIMP_PDB_STRING,
"name",
"The name of the gradient to operate on"
},
{
GIMP_PDB_INT32,
"segment",
"The index of the segment within the gradient"
}
};
static ProcArg gradient_segment_get_coloring_type_outargs[] =
{
{
GIMP_PDB_INT32,
"coloring_type",
"The coloring type of the segment: { GIMP_GRADIENT_SEGMENT_RGB (0), GIMP_GRADIENT_SEGMENT_HSV_CCW (1), GIMP_GRADIENT_SEGMENT_HSV_CW (2) }"
}
};
static ProcRecord gradient_segment_get_coloring_type_proc =
{
"gimp_gradient_segment_get_coloring_type",
"Retrieves the gradient segment's coloring type",
"This procedure retrieves the coloring type of the segment at the specified gradient name and segment index.",
"Shlomi Fish",
"Shlomi Fish",
"2003",
GIMP_INTERNAL,
2,
gradient_segment_get_coloring_type_inargs,
1,
gradient_segment_get_coloring_type_outargs,
{ { gradient_segment_get_coloring_type_invoker } }
};
static Argument *
gradient_segment_set_coloring_type_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
gradient_segment_range_set_coloring_type_invoker (Gimp *gimp,
GimpContext *context,
Argument *args)
{
gboolean success = TRUE;
gchar *name;
......@@ -1519,10 +1519,10 @@ gradient_segment_set_coloring_type_invoker (Gimp *gimp,
}
}
return procedural_db_return_args (&gradient_segment_set_coloring_type_proc, success);
return procedural_db_return_args (&gradient_segment_range_set_coloring_type_proc, success);
}
static ProcArg gradient_segment_set_coloring_type_inargs[] =
static ProcArg gradient_segment_range_set_coloring_type_inargs[] =
{
{
GIMP_PDB_STRING,
......@@ -1546,9 +1546,9 @@ static ProcArg gradient_segment_set_coloring_type_inargs[] =
}
};
static ProcRecord gradient_segment_set_coloring_type_proc =
static ProcRecord gradient_segment_range_set_coloring_type_proc =
{
"gimp_gradient_segment_set_coloring_type",
"gimp_gradient_segment_range_set_coloring_type",
"Change the coloring type of a segments range",
"This function changes the coloring type of a segment range to the specified coloring type.",
"Shlomi Fish",
......@@ -1556,10 +1556,10 @@ static ProcRecord gradient_segment_set_coloring_type_proc =
"2003",
GIMP_INTERNAL,
4,
gradient_segment_set_coloring_type_inargs,
gradient_segment_range_set_coloring_type_inargs,
0,
NULL,
{ { gradient_segment_set_coloring_type_invoker } }
{ { gradient_segment_range_set_coloring_type_invoker } }
};
static Argument *
......
......@@ -522,90 +522,90 @@ gimp_gradient_segment_get_blending_function (const gchar *name,
}
/**
* gimp_gradient_segment_set_blending_function:
* gimp_gradient_segment_get_coloring_type:
* @name: The name of the gradient to operate on.
* @start_segment: The index of the first segment to operate on.
* @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
* @blending_function: The Blending Function.
* @segment: The index of the segment within the gradient.
* @coloring_type: The coloring type of the segment.
*
* Change the blending function of a segments range
* Retrieves the gradient segment's coloring type
*
* This function changes the blending function of a segment range to
* the specified blending function.
* This procedure retrieves the coloring type of the segment at the
* specified gradient name and segment index.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
*/
gboolean
gimp_gradient_segment_set_blending_function (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentType blending_function)
gimp_gradient_segment_get_coloring_type (const gchar *name,
gint segment,
GimpGradientSegmentColor *coloring_type)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_gradient_segment_set_blending_function",
return_vals = gimp_run_procedure ("gimp_gradient_segment_get_coloring_type",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, start_segment,
GIMP_PDB_INT32, end_segment,
GIMP_PDB_INT32, blending_function,
GIMP_PDB_INT32, segment,
GIMP_PDB_END);
*coloring_type = 0;
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
if (success)
*coloring_type = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_gradient_segment_get_coloring_type:
* gimp_gradient_segment_range_set_blending_function:
* @name: The name of the gradient to operate on.
* @segment: The index of the segment within the gradient.
* @coloring_type: The coloring type of the segment.
* @start_segment: The index of the first segment to operate on.
* @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
* @blending_function: The Blending Function.
*
* Retrieves the gradient segment's coloring type
* Change the blending function of a segments range
*
* This procedure retrieves the coloring type of the segment at the
* specified gradient name and segment index.
* This function changes the blending function of a segment range to
* the specified blending function.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.2
*/
gboolean
gimp_gradient_segment_get_coloring_type (const gchar *name,
gint segment,
GimpGradientSegmentColor *coloring_type)
gimp_gradient_segment_range_set_blending_function (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentType blending_function)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_gradient_segment_get_coloring_type",
return_vals = gimp_run_procedure ("gimp_gradient_segment_range_set_blending_function",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, segment,
GIMP_PDB_INT32, start_segment,
GIMP_PDB_INT32, end_segment,
GIMP_PDB_INT32, blending_function,
GIMP_PDB_END);
*coloring_type = 0;
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
if (success)
*coloring_type = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_gradient_segment_set_coloring_type:
* gimp_gradient_segment_range_set_coloring_type:
* @name: The name of the gradient to operate on.
* @start_segment: The index of the first segment to operate on.
* @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
......@@ -621,16 +621,16 @@ gimp_gradient_segment_get_coloring_type (const gchar *name,
* Since: GIMP 2.2
*/
gboolean
gimp_gradient_segment_set_coloring_type (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentColor coloring_type)
gimp_gradient_segment_range_set_coloring_type (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentColor coloring_type)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_gradient_segment_set_coloring_type",
return_vals = gimp_run_procedure ("gimp_gradient_segment_range_set_coloring_type",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_INT32, start_segment,
......
......@@ -29,88 +29,88 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_gradient_segment_get_left_color (const gchar *name,
gint segment,
GimpRGB *color,
gdouble *opacity);
gboolean gimp_gradient_segment_set_left_color (const gchar *name,
gint segment,
const GimpRGB *color,
gdouble opacity);
gboolean gimp_gradient_segment_get_right_color (const gchar *name,
gint segment,
GimpRGB *color,
gdouble *opacity);
gboolean gimp_gradient_segment_set_right_color (const gchar *name,
gint segment,
const GimpRGB *color,
gdouble opacity);
gboolean gimp_gradient_segment_get_left_pos (const gchar *name,
gint segment,
gdouble *pos);
gboolean gimp_gradient_segment_set_left_pos (const gchar *name,
gint segment,
gdouble pos,
gdouble *final_pos);
gboolean gimp_gradient_segment_get_middle_pos (const gchar *name,
gint segment,
gdouble *pos);
gboolean gimp_gradient_segment_set_middle_pos (const gchar *name,
gint segment,
gdouble pos,
gdouble *final_pos);
gboolean gimp_gradient_segment_get_right_pos (const gchar *name,
gint segment,
gdouble *pos);
gboolean gimp_gradient_segment_set_right_pos (const gchar *name,
gint segment,
gdouble pos,
gdouble *final_pos);
gboolean gimp_gradient_segment_get_blending_function (const gchar *name,
gint segment,
GimpGradientSegmentType *blend_func);
gboolean gimp_gradient_segment_set_blending_function (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentType blending_function);
gboolean gimp_gradient_segment_get_coloring_type (const gchar *name,
gint segment,
GimpGradientSegmentColor *coloring_type);
gboolean gimp_gradient_segment_set_coloring_type (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentColor coloring_type);
gboolean gimp_gradient_segment_range_flip (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_replicate (const gchar *name,
gint start_segment,
gint end_segment,
gint replicate_times);
gboolean gimp_gradient_segment_range_split_midpoint (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_split_uniform (const gchar *name,
gint start_segment,
gint end_segment,
gint split_parts);
gboolean gimp_gradient_segment_range_delete (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_redistribute_handles (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_blend_colors (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_blend_opacity (const gchar *name,
gint start_segment,
gint end_segment);
gdouble gimp_gradient_segment_range_move (const gchar *name,
gint start_segment,
gint end_segment,
gdouble delta,
gboolean control_compress);
gboolean gimp_gradient_segment_get_left_color (const gchar *name,
gint segment,
GimpRGB *color,
gdouble *opacity);
gboolean gimp_gradient_segment_set_left_color (const gchar *name,
gint segment,
const GimpRGB *color,
gdouble opacity);
gboolean gimp_gradient_segment_get_right_color (const gchar *name,
gint segment,
GimpRGB *color,
gdouble *opacity);
gboolean gimp_gradient_segment_set_right_color (const gchar *name,
gint segment,
const GimpRGB *color,
gdouble opacity);
gboolean gimp_gradient_segment_get_left_pos (const gchar *name,
gint segment,
gdouble *pos);
gboolean gimp_gradient_segment_set_left_pos (const gchar *name,
gint segment,
gdouble pos,
gdouble *final_pos);
gboolean gimp_gradient_segment_get_middle_pos (const gchar *name,
gint segment,
gdouble *pos);
gboolean gimp_gradient_segment_set_middle_pos (const gchar *name,
gint segment,
gdouble pos,
gdouble *final_pos);
gboolean gimp_gradient_segment_get_right_pos (const gchar *name,
gint segment,
gdouble *pos);
gboolean gimp_gradient_segment_set_right_pos (const gchar *name,
gint segment,
gdouble pos,
gdouble *final_pos);
gboolean gimp_gradient_segment_get_blending_function (const gchar *name,
gint segment,
GimpGradientSegmentType *blend_func);
gboolean gimp_gradient_segment_get_coloring_type (const gchar *name,
gint segment,
GimpGradientSegmentColor *coloring_type);
gboolean gimp_gradient_segment_range_set_blending_function (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentType blending_function);
gboolean gimp_gradient_segment_range_set_coloring_type (const gchar *name,
gint start_segment,
gint end_segment,
GimpGradientSegmentColor coloring_type);
gboolean gimp_gradient_segment_range_flip (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_replicate (const gchar *name,
gint start_segment,
gint end_segment,
gint replicate_times);
gboolean gimp_gradient_segment_range_split_midpoint (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_split_uniform (const gchar *name,
gint start_segment,
gint end_segment,
gint split_parts);
gboolean gimp_gradient_segment_range_delete (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_redistribute_handles (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_blend_colors (const gchar *name,
gint start_segment,
gint end_segment);
gboolean gimp_gradient_segment_range_blend_opacity (const gchar *name,
gint start_segment,
gint end_segment);
gdouble gimp_gradient_segment_range_move (const gchar *name,
gint start_segment,
gint end_segment,
gdouble delta,
gboolean control_compress);
G_END_DECLS
......
......@@ -407,7 +407,7 @@ CODE
);
}
sub gradient_segment_set_blending_function
sub gradient_segment_range_set_blending_function
{
&_gen_gradient_operate_on_segments_range(
'blurb' => "Change the blending function of a segments range",
......@@ -430,7 +430,7 @@ CODE
);
}
sub gradient_segment_set_coloring_type
sub gradient_segment_range_set_coloring_type
{
&_gen_gradient_operate_on_segments_range(
'blurb' => "Change the coloring type of a segments range",
......@@ -651,9 +651,9 @@ CODE
gradient_segment_get_middle_pos gradient_segment_set_middle_pos
gradient_segment_get_right_pos gradient_segment_set_right_pos
gradient_segment_get_blending_function
gradient_segment_set_blending_function
gradient_segment_get_coloring_type
gradient_segment_set_coloring_type
gradient_segment_range_set_blending_function
gradient_segment_range_set_coloring_type
gradient_segment_range_flip
gradient_segment_range_replicate
gradient_segment_range_split_midpoint
......
......@@ -407,7 +407,7 @@ CODE
);
}
sub gradient_segment_set_blending_function
sub gradient_segment_range_set_blending_function
{
&_gen_gradient_operate_on_segments_range(
'blurb' => "Change the blending function of a segments range",
......@@ -430,7 +430,7 @@ CODE
);
}
sub gradient_segment_set_coloring_type
sub gradient_segment_range_set_coloring_type
{
&_gen_gradient_operate_on_segments_range(
'blurb' => "Change the coloring type of a segments range",
......@@ -651,9 +651,9 @@ CODE
gradient_segment_get_middle_pos gradient_segment_set_middle_pos
gradient_segment_get_right_pos gradient_segment_set_right_pos
gradient_segment_get_blending_function
gradient_segment_set_blending_function
gradient_segment_get_coloring_type
gradient_segment_set_coloring_type
gradient_segment_range_set_blending_function
gradient_segment_range_set_coloring_type
gradient_segment_range_flip
gradient_segment_range_replicate
gradient_segment_range_split_midpoint
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment