pdb: add "sample-threshold" as GimpPDBContext property
and add PDB API to get/set it.
This commit is contained in:
@ -84,6 +84,8 @@ EXPORTS
|
||||
gimp_context_get_pattern
|
||||
gimp_context_get_sample_criterion
|
||||
gimp_context_get_sample_merged
|
||||
gimp_context_get_sample_threshold
|
||||
gimp_context_get_sample_threshold_int
|
||||
gimp_context_get_transform_direction
|
||||
gimp_context_get_transform_recursion
|
||||
gimp_context_get_transform_resize
|
||||
@ -107,6 +109,8 @@ EXPORTS
|
||||
gimp_context_set_pattern
|
||||
gimp_context_set_sample_criterion
|
||||
gimp_context_set_sample_merged
|
||||
gimp_context_set_sample_threshold
|
||||
gimp_context_set_sample_threshold_int
|
||||
gimp_context_set_transform_direction
|
||||
gimp_context_set_transform_recursion
|
||||
gimp_context_set_transform_resize
|
||||
|
||||
@ -1177,7 +1177,7 @@ gimp_context_get_sample_criterion (void)
|
||||
* gimp_context_set_sample_criterion:
|
||||
* @sample_criterion: The sample criterion setting.
|
||||
*
|
||||
* Set the sample merged setting.
|
||||
* Set the sample criterion setting.
|
||||
*
|
||||
* This procedure modifies the sample criterion setting. If an
|
||||
* operation depends on the colors of the pixels present in a drawable,
|
||||
@ -1209,6 +1209,136 @@ gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion)
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_sample_threshold:
|
||||
*
|
||||
* Get the sample threshold setting.
|
||||
*
|
||||
* This procedure returns the sample threshold setting.
|
||||
*
|
||||
* Returns: The sample threshold setting.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_sample_threshold (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble sample_threshold = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
sample_threshold = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return sample_threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_sample_threshold:
|
||||
* @sample_threshold: The sample threshold setting.
|
||||
*
|
||||
* Set the sample threshold setting.
|
||||
*
|
||||
* This procedure modifies the sample threshold setting. If an
|
||||
* operation depends on the colors of the pixels present in a drawable,
|
||||
* like when doing a seed fill, this setting controls what is
|
||||
* \"sufficiently close\" to be considered a similar color. If the
|
||||
* sample threshold has not been set explicitly, the default threshold
|
||||
* set in gimprc will be used. This setting affects the following
|
||||
* procedures: gimp_image_select_color(), gimp_image_select_fuzzy().
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_sample_threshold (gdouble sample_threshold)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, sample_threshold,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_sample_threshold_int:
|
||||
*
|
||||
* Get the sample threshold setting as an integer value.
|
||||
*
|
||||
* This procedure returns the sample threshold setting as an integer
|
||||
* value. See gimp_context_get_sample_threshold().
|
||||
*
|
||||
* Returns: The sample threshold setting.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gint
|
||||
gimp_context_get_sample_threshold_int (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint sample_threshold = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold-int",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
sample_threshold = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return sample_threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_sample_threshold_int:
|
||||
* @sample_threshold: The sample threshold setting.
|
||||
*
|
||||
* Set the sample threshold setting as an integer value.
|
||||
*
|
||||
* This procedure modifies the sample threshold setting as an integer
|
||||
* value. See gimp_context_set_sample_threshold().
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_sample_threshold_int (gint sample_threshold)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold-int",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_INT32, sample_threshold,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_interpolation:
|
||||
*
|
||||
|
||||
@ -28,52 +28,56 @@ G_BEGIN_DECLS
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gboolean gimp_context_push (void);
|
||||
gboolean gimp_context_pop (void);
|
||||
gboolean gimp_context_list_paint_methods (gint *num_paint_methods,
|
||||
gchar ***paint_methods);
|
||||
gchar* gimp_context_get_paint_method (void);
|
||||
gboolean gimp_context_set_paint_method (const gchar *name);
|
||||
gboolean gimp_context_get_foreground (GimpRGB *foreground);
|
||||
gboolean gimp_context_set_foreground (const GimpRGB *foreground);
|
||||
gboolean gimp_context_get_background (GimpRGB *background);
|
||||
gboolean gimp_context_set_background (const GimpRGB *background);
|
||||
gboolean gimp_context_set_default_colors (void);
|
||||
gboolean gimp_context_swap_colors (void);
|
||||
gdouble gimp_context_get_opacity (void);
|
||||
gboolean gimp_context_set_opacity (gdouble opacity);
|
||||
GimpLayerModeEffects gimp_context_get_paint_mode (void);
|
||||
gboolean gimp_context_set_paint_mode (GimpLayerModeEffects paint_mode);
|
||||
gchar* gimp_context_get_brush (void);
|
||||
gboolean gimp_context_set_brush (const gchar *name);
|
||||
gchar* gimp_context_get_pattern (void);
|
||||
gboolean gimp_context_set_pattern (const gchar *name);
|
||||
gchar* gimp_context_get_gradient (void);
|
||||
gboolean gimp_context_set_gradient (const gchar *name);
|
||||
gchar* gimp_context_get_palette (void);
|
||||
gboolean gimp_context_set_palette (const gchar *name);
|
||||
gchar* gimp_context_get_font (void);
|
||||
gboolean gimp_context_set_font (const gchar *name);
|
||||
gboolean gimp_context_get_antialias (void);
|
||||
gboolean gimp_context_set_antialias (gboolean antialias);
|
||||
gboolean gimp_context_get_feather (void);
|
||||
gboolean gimp_context_set_feather (gboolean feather);
|
||||
gboolean gimp_context_get_feather_radius (gdouble *feather_radius_x,
|
||||
gdouble *feather_radius_y);
|
||||
gboolean gimp_context_set_feather_radius (gdouble feather_radius_x,
|
||||
gdouble feather_radius_y);
|
||||
gboolean gimp_context_get_sample_merged (void);
|
||||
gboolean gimp_context_set_sample_merged (gboolean sample_merged);
|
||||
GimpSelectCriterion gimp_context_get_sample_criterion (void);
|
||||
gboolean gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
gboolean gimp_context_set_transform_direction (GimpTransformDirection transform_direction);
|
||||
GimpTransformResize gimp_context_get_transform_resize (void);
|
||||
gboolean gimp_context_set_transform_resize (GimpTransformResize transform_resize);
|
||||
gint gimp_context_get_transform_recursion (void);
|
||||
gboolean gimp_context_set_transform_recursion (gint transform_recursion);
|
||||
gboolean gimp_context_push (void);
|
||||
gboolean gimp_context_pop (void);
|
||||
gboolean gimp_context_list_paint_methods (gint *num_paint_methods,
|
||||
gchar ***paint_methods);
|
||||
gchar* gimp_context_get_paint_method (void);
|
||||
gboolean gimp_context_set_paint_method (const gchar *name);
|
||||
gboolean gimp_context_get_foreground (GimpRGB *foreground);
|
||||
gboolean gimp_context_set_foreground (const GimpRGB *foreground);
|
||||
gboolean gimp_context_get_background (GimpRGB *background);
|
||||
gboolean gimp_context_set_background (const GimpRGB *background);
|
||||
gboolean gimp_context_set_default_colors (void);
|
||||
gboolean gimp_context_swap_colors (void);
|
||||
gdouble gimp_context_get_opacity (void);
|
||||
gboolean gimp_context_set_opacity (gdouble opacity);
|
||||
GimpLayerModeEffects gimp_context_get_paint_mode (void);
|
||||
gboolean gimp_context_set_paint_mode (GimpLayerModeEffects paint_mode);
|
||||
gchar* gimp_context_get_brush (void);
|
||||
gboolean gimp_context_set_brush (const gchar *name);
|
||||
gchar* gimp_context_get_pattern (void);
|
||||
gboolean gimp_context_set_pattern (const gchar *name);
|
||||
gchar* gimp_context_get_gradient (void);
|
||||
gboolean gimp_context_set_gradient (const gchar *name);
|
||||
gchar* gimp_context_get_palette (void);
|
||||
gboolean gimp_context_set_palette (const gchar *name);
|
||||
gchar* gimp_context_get_font (void);
|
||||
gboolean gimp_context_set_font (const gchar *name);
|
||||
gboolean gimp_context_get_antialias (void);
|
||||
gboolean gimp_context_set_antialias (gboolean antialias);
|
||||
gboolean gimp_context_get_feather (void);
|
||||
gboolean gimp_context_set_feather (gboolean feather);
|
||||
gboolean gimp_context_get_feather_radius (gdouble *feather_radius_x,
|
||||
gdouble *feather_radius_y);
|
||||
gboolean gimp_context_set_feather_radius (gdouble feather_radius_x,
|
||||
gdouble feather_radius_y);
|
||||
gboolean gimp_context_get_sample_merged (void);
|
||||
gboolean gimp_context_set_sample_merged (gboolean sample_merged);
|
||||
GimpSelectCriterion gimp_context_get_sample_criterion (void);
|
||||
gboolean gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);
|
||||
gdouble gimp_context_get_sample_threshold (void);
|
||||
gboolean gimp_context_set_sample_threshold (gdouble sample_threshold);
|
||||
gint gimp_context_get_sample_threshold_int (void);
|
||||
gboolean gimp_context_set_sample_threshold_int (gint sample_threshold);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
gboolean gimp_context_set_transform_direction (GimpTransformDirection transform_direction);
|
||||
GimpTransformResize gimp_context_get_transform_resize (void);
|
||||
gboolean gimp_context_set_transform_resize (GimpTransformResize transform_resize);
|
||||
gint gimp_context_get_transform_recursion (void);
|
||||
gboolean gimp_context_set_transform_recursion (gint transform_recursion);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user