Commit 50536e1c authored by Michael Natterer's avatar Michael Natterer 😴

Bug 795230 - Rename Blend tool and provide PDB compatibility

Add new PDB group "drawable_edit" which has all procedures from the
"edit" group which are not cut/copy/paste.

The new group's procedures don't have opacity, paint_mode
etc. arguments but take them from the context instead. Unlike the old
gimp-edit-fill, gimp-drawable-edit-fill now uses the context's opacity
and paint_mode.

The new gimp-drawable-edit-gradient-fill procedure uses even more
context properties which are also newly added with this commit
(gradient_color_space, gradient_repeat_mode, gradient_reverse).

And some cleanup in context.pdb.

This is still WIP, nothing in the edit group is depcreated yet.
parent 1a277f2c
......@@ -45,6 +45,7 @@ libappinternal_procs_a_SOURCES = \
display-cmds.c \
drawable-cmds.c \
drawable-color-cmds.c \
drawable-edit-cmds.c \
drawable-transform-cmds.c \
dynamics-cmds.c \
edit-cmds.c \
......
This diff is collapsed.
This diff is collapsed.
......@@ -1272,9 +1272,9 @@ register_edit_procs (GimpPDB *pdb)
"gimp-edit-clear",
"Clear selected area of drawable.",
"This procedure clears the specified drawable. If the drawable has an alpha channel, the cleared pixels will become transparent. If the drawable does not have an alpha channel, cleared pixels will be set to the background color. This procedure only affects regions within a selection if there is a selection active.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
"",
"",
"",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
......
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 816 procedures registered total */
/* 828 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......@@ -46,6 +46,7 @@ internal_procs_init (GimpPDB *pdb)
register_display_procs (pdb);
register_drawable_procs (pdb);
register_drawable_color_procs (pdb);
register_drawable_edit_procs (pdb);
register_drawable_transform_procs (pdb);
register_dynamics_procs (pdb);
register_edit_procs (pdb);
......
......@@ -35,6 +35,7 @@ void register_debug_procs (GimpPDB *pdb);
void register_display_procs (GimpPDB *pdb);
void register_drawable_procs (GimpPDB *pdb);
void register_drawable_color_procs (GimpPDB *pdb);
void register_drawable_edit_procs (GimpPDB *pdb);
void register_drawable_transform_procs (GimpPDB *pdb);
void register_dynamics_procs (GimpPDB *pdb);
void register_edit_procs (GimpPDB *pdb);
......
......@@ -44,6 +44,7 @@
<xi:include href="xml/gimpdisplay.xml" />
<xi:include href="xml/gimpdrawable.xml" />
<xi:include href="xml/gimpdrawablecolor.xml" />
<xi:include href="xml/gimpdrawableedit.xml" />
<xi:include href="xml/gimpdrawabletransform.xml" />
<xi:include href="xml/gimpedit.xml" />
<xi:include href="xml/gimpfileops.xml" />
......
......@@ -421,6 +421,16 @@ gimp_drawable_posterize
gimp_drawable_threshold
</SECTION>
<SECTION>
<FILE>gimpdrawableedit</FILE>
gimp_drawable_edit_clear
gimp_drawable_edit_fill
gimp_drawable_edit_bucket_fill
gimp_drawable_edit_gradient_fill
gimp_drawable_edit_stroke_selection
gimp_drawable_edit_stroke_item
</SECTION>
<SECTION>
<FILE>gimpdrawabletransform</FILE>
gimp_drawable_transform_flip_simple
......
......@@ -103,6 +103,7 @@ PDB_WRAPPERS_C = \
gimpdisplay_pdb.c \
gimpdrawable_pdb.c \
gimpdrawablecolor_pdb.c \
gimpdrawableedit_pdb.c \
gimpdrawabletransform_pdb.c \
gimpdynamics_pdb.c \
gimpedit_pdb.c \
......@@ -161,6 +162,7 @@ PDB_WRAPPERS_H = \
gimpdisplay_pdb.h \
gimpdrawable_pdb.h \
gimpdrawablecolor_pdb.h \
gimpdrawableedit_pdb.h \
gimpdrawabletransform_pdb.h \
gimpdynamics_pdb.h \
gimpedit_pdb.h \
......
......@@ -85,6 +85,9 @@ EXPORTS
gimp_context_get_font
gimp_context_get_foreground
gimp_context_get_gradient
gimp_context_get_gradient_blend_color_space
gimp_context_get_gradient_repeat_mode
gimp_context_get_gradient_reverse
gimp_context_get_ink_angle
gimp_context_get_ink_blob_angle
gimp_context_get_ink_blob_aspect_ratio
......@@ -141,6 +144,9 @@ EXPORTS
gimp_context_set_font
gimp_context_set_foreground
gimp_context_set_gradient
gimp_context_set_gradient_blend_color_space
gimp_context_set_gradient_repeat_mode
gimp_context_set_gradient_reverse
gimp_context_set_ink_angle
gimp_context_set_ink_blob_angle
gimp_context_set_ink_blob_aspect_ratio
......@@ -205,6 +211,12 @@ EXPORTS
gimp_drawable_delete
gimp_drawable_desaturate
gimp_drawable_detach
gimp_drawable_edit_bucket_fill
gimp_drawable_edit_clear
gimp_drawable_edit_fill
gimp_drawable_edit_gradient_fill
gimp_drawable_edit_stroke_item
gimp_drawable_edit_stroke_selection
gimp_drawable_equalize
gimp_drawable_fill
gimp_drawable_flush
......
......@@ -39,6 +39,7 @@
#include <libgimp/gimpdisplay_pdb.h>
#include <libgimp/gimpdrawable_pdb.h>
#include <libgimp/gimpdrawablecolor_pdb.h>
#include <libgimp/gimpdrawableedit_pdb.h>
#include <libgimp/gimpdrawabletransform_pdb.h>
#include <libgimp/gimpdynamics_pdb.h>
#include <libgimp/gimpedit_pdb.h>
......
......@@ -672,8 +672,9 @@ gimp_context_get_line_width (void)
* Set the line width setting.
*
* This procedure modifies the line width setting for stroking lines.
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -736,8 +737,9 @@ gimp_context_get_line_width_unit (void)
*
* This procedure modifies the line width unit setting for stroking
* lines.
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -800,8 +802,9 @@ gimp_context_get_line_cap_style (void)
*
* This procedure modifies the line cap style setting for stroking
* lines.
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -864,8 +867,9 @@ gimp_context_get_line_join_style (void)
*
* This procedure modifies the line join style setting for stroking
* lines.
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -931,8 +935,9 @@ gimp_context_get_line_miter_limit (void)
* A mitered join is converted to a bevelled join if the miter would
* extend to a distance of more than (miter-limit * line-width) from
* the actual join point.
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -995,8 +1000,9 @@ gimp_context_get_line_dash_offset (void)
*
* This procedure modifies the line dash offset setting for stroking
* lines.
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -1077,8 +1083,9 @@ gimp_context_get_line_dash_pattern (gint *num_dashes,
* The unit of the dash pattern segments is the actual line width used
* for the stroke operation, in other words a segment length of 1.0
* results in a square segment shape (or gap shape).
* This setting affects the following procedures: gimp_edit_stroke(),
* gimp_edit_stroke_vectors().
* This setting affects the following procedures:
* gimp_drawable_edit_stroke_selection_(),
* gimp_drawable_edit_stroke_item().
*
* Returns: TRUE on success.
*
......@@ -1899,6 +1906,193 @@ gimp_context_set_gradient (const gchar *name)
return success;
}
/**
* gimp_context_get_gradient_blend_color_space:
*
* Get the gradient blend color space.
*
* Get the gradient blend color space for paint tools and the gradient
* tool.
*
* Returns: Color blend space.
*
* Since: 2.10
**/
GimpGradientBlendColorSpace
gimp_context_get_gradient_blend_color_space (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpGradientBlendColorSpace blend_color_space = 0;
return_vals = gimp_run_procedure ("gimp-context-get-gradient-blend-color-space",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
blend_color_space = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return blend_color_space;
}
/**
* gimp_context_set_gradient_blend_color_space:
* @blend_color_space: Blend color space.
*
* Set the gradient blend color space.
*
* Set the gradient blend color space for paint tools and the gradient
* tool.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace blend_color_space)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-blend-color-space",
&nreturn_vals,
GIMP_PDB_INT32, blend_color_space,
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_gradient_repeat_mode:
*
* Get the gradient repeat mode.
*
* Get the gradient repeat mode for paint tools and the gradient tool.
*
* Returns: Repeat mode.
*
* Since: 2.10
**/
GimpRepeatMode
gimp_context_get_gradient_repeat_mode (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpRepeatMode repeat_mode = 0;
return_vals = gimp_run_procedure ("gimp-context-get-gradient-repeat-mode",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
repeat_mode = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return repeat_mode;
}
/**
* gimp_context_set_gradient_repeat_mode:
* @repeat_mode: Repeat mode.
*
* Set the gradient repeat mode.
*
* Set the gradient repeat mode for paint tools and the gradient tool.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_repeat_mode (GimpRepeatMode repeat_mode)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-repeat-mode",
&nreturn_vals,
GIMP_PDB_INT32, repeat_mode,
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_gradient_reverse:
*
* Get the gradient reverse setting.
*
* Get the gradient reverse setting for paint tools and the gradient
* tool.
*
* Returns: Reverse.
*
* Since: 2.10
**/
gboolean
gimp_context_get_gradient_reverse (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean reverse = FALSE;
return_vals = gimp_run_procedure ("gimp-context-get-gradient-reverse",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
reverse = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return reverse;
}
/**
* gimp_context_set_gradient_reverse:
* @reverse: Reverse.
*
* Set the gradient reverse setting.
*
* Set the gradient reverse setting for paint tools and the gradient
* tool.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_gradient_reverse (gboolean reverse)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-gradient-reverse",
&nreturn_vals,
GIMP_PDB_INT32, reverse,
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_palette:
*
......@@ -2647,6 +2841,71 @@ gimp_context_set_diagonal_neighbors (gboolean diagonal_neighbors)
return success;
}
/**
* gimp_context_get_distance_metric:
*
* Get the distance metric used in some computations.
*
* This procedure returns the distance metric in the current context.
* See gimp_context_set_distance_metric() to know more about its usage.
*
* Returns: The distance metric.
*
* Since: 2.10
**/
GeglDistanceMetric
gimp_context_get_distance_metric (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GeglDistanceMetric metric = 0;
return_vals = gimp_run_procedure ("gimp-context-get-distance-metric",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
metric = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return metric;
}
/**
* gimp_context_set_distance_metric:
* @metric: The distance metric.
*
* Set the distance metric used in some computations.
*
* This procedure modifies the distance metric used in some
* computations, such as gimp_drawable_edit_gradient_fill(). In
* particular, it does not change the metric used in generic distance
* computation on canvas, as in the Measure tool.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_distance_metric (GeglDistanceMetric metric)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-distance-metric",
&nreturn_vals,
GIMP_PDB_INT32, metric,
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:
*
......@@ -3398,68 +3657,3 @@ gimp_context_set_ink_blob_angle (gdouble angle)
return success;
}
/**
* gimp_context_get_distance_metric:
*
* Get the distance metric used in some computations.
*
* This procedure returns the distance metric in the current context.
* See gimp_context_set_distance_metric() to know more about its usage.
*
* Returns: The distance metric.
*
* Since: 2.10
**/
GeglDistanceMetric
gimp_context_get_distance_metric (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GeglDistanceMetric metric = 0;
return_vals = gimp_run_procedure ("gimp-context-get-distance-metric",
&nreturn_vals,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
metric = return_vals[1].data.d_int32;
gimp_destroy_params (return_vals, nreturn_vals);
return metric;
}
/**
* gimp_context_set_distance_metric:
* @metric: The distance metric.
*
* Set the distance metric used in some computations.
*
* This procedure modifies the distance metric used in some
* computations, such as gimp_edit_blend(). In particular, it does not
* change the metric used in generic distance computation on canvas, as
* in the Measure tool.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_context_set_distance_metric (GeglDistanceMetric metric)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-context-set-distance-metric",
&nreturn_vals,
GIMP_PDB_INT32, metric,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
This diff is collapsed.
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpdrawableedit_pdb.c
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* 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
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* SECTION: gimpdrawableedit
* @title: gimpdrawableedit
* @short_description: Drawable edit functions (clear, fill, gradient, stroke etc.)
*
* Drawable edit functions (clear, fill, gradient, stroke etc.)
**/
/**
* gimp_drawable_edit_clear:
* @drawable_ID: The drawable to clear from.
*
* Clear selected area of drawable.
*
* This procedure clears the specified drawable. If the drawable has an
* alpha channel, the cleared pixels will become transparent. If the
* drawable does not have an alpha channel, cleared pixels will be set
* to the background color. This procedure only affects regions within
* a selection if there is a selection active.
* This procedure is affected by the following context setters:
* gimp_context_set_background().
*
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_clear (gint32 drawable_ID)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-drawable-edit-clear",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_drawable_edit_fill:
* @drawable_ID: The drawable to fill to.
* @fill_type: The type of fill.
*
* Fill selected area of drawable.
*
* This procedure fills the specified drawable according to fill mode.
* This procedure only affects regions within a selection if there is a
* selection active. If you want to fill the whole drawable, regardless
* of the selection, use gimp_drawable_fill().
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_foreground(), gimp_context_set_background(),
* gimp_context_set_pattern().
*
* Returns: TRUE on success.
**/
gboolean
gimp_drawable_edit_fill (gint32 drawable_ID,
GimpFillType fill_type)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-drawable-edit-fill",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, fill_type,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_drawable_edit_bucket_fill:
* @drawable_ID: The affected drawable.
* @fill_type: The type of fill.
* @x: The x coordinate of this bucket fill's application.
* @y: The y coordinate of this bucket fill's application.
*
* Fill the area by a seed fill starting at the specified coordinates.
*
* This procedure does a seed fill at the specified coordinates, using
* various parameters from the current context.
* In the case of merged sampling, the x and y coordinates are relative
* to the image's origin; otherwise, they are relative to the
* drawable's origin.
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_foreground(), gimp_context_set_background(),
* gimp_context_set_pattern(), gimp_context_set_sample_threshold(),
* gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(),
* gimp_context_set_diagonal_neighbors(), gimp_context_set_antialias().
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
GimpFillType fill_type,
gdouble x,
gdouble y)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-drawable-edit-bucket-fill",
&nreturn_vals,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_INT32, fill_type,
GIMP_PDB_FLOAT, x,
GIMP_PDB_FLOAT, y,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_drawable_edit_gradient_fill:
* @drawable_ID: The affected drawable.
* @gradient_type: The type of gradient.
* @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
* @supersample: Do adaptive supersampling.
* @supersample_max_depth: Maximum recursion levels for supersampling.
* @supersample_threshold: Supersampling threshold.
* @dither: Use dithering to reduce banding.
* @x1: The x coordinate of this gradient's starting point.
* @y1: The y coordinate of this gradient's starting point.
* @x2: The x coordinate of this gradient's ending point.
* @y2: The y coordinate of this gradient's ending point.
*
* Draw a gradient between the starting and ending coordinates with the
* specified gradient type.
*
* This tool requires information on the gradient type. It creates the
* specified variety of gradient using the starting and ending
* coordinates as defined for each gradient type. For shapeburst
* gradient types, the context's distance metric is also relevant and
* can be updated with gimp_context_set_distance_metric().
* This procedure is affected by the following context setters:
* gimp_context_set_opacity(), gimp_context_set_paint_mode(),
* gimp_context_set_foreground(), gimp_context_set_background(),
* gimp_context_set_gradient() and all gradient property settings,
* gimp_context_set_distance_metric().
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
GimpGradientType gradient_type,
gdouble offset,
gboolean supersample,
gint supersample_max_depth,
gdouble supersample_threshold,
gboolean dither,
gdouble x1,
gdouble y1,
gdouble x2,