mirror of https://github.com/GNOME/gimp.git
added _defaults() variants (flip_defaults, rotate_defaults, ...) for all
2004-11-02 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable_transform.pdb: added _defaults() variants (flip_defaults, rotate_defaults, ...) for all transform functions which finally call gimp_drawable_transform_affine(). The _defaults() functions don't take the whole interpolation_type, supersample etc. parameter overkill, but only a "interpolation" boolean like the old PDB wrappers. * libgimp/gimp.def: changed accordingly. * app/pdb/drawable_transform_cmds.c * app/pdb/internal_procs.c * libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
This commit is contained in:
parent
bde607ff99
commit
2fef83bafb
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2004-11-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/drawable_transform.pdb: added _defaults()
|
||||
variants (flip_defaults, rotate_defaults, ...) for all transform
|
||||
functions which finally call gimp_drawable_transform_affine().
|
||||
The _defaults() functions don't take the whole interpolation_type,
|
||||
supersample etc. parameter overkill, but only a "interpolation"
|
||||
boolean like the old PDB wrappers.
|
||||
|
||||
* libgimp/gimp.def: changed accordingly.
|
||||
|
||||
* app/pdb/drawable_transform_cmds.c
|
||||
* app/pdb/internal_procs.c
|
||||
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
|
||||
|
||||
2004-11-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/drawable_transform.pdb: renamed flip() and
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -74,7 +74,7 @@ void register_transform_tools_procs (Gimp *gimp);
|
|||
void register_undo_procs (Gimp *gimp);
|
||||
void register_unit_procs (Gimp *gimp);
|
||||
|
||||
/* 425 procedures registered total */
|
||||
/* 432 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (Gimp *gimp,
|
||||
|
@ -89,124 +89,124 @@ internal_procs_init (Gimp *gimp,
|
|||
(* status_callback) (NULL, _("Brush UI"), 0.019);
|
||||
register_brush_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Brushes"), 0.026);
|
||||
(* status_callback) (NULL, _("Brushes"), 0.025);
|
||||
register_brushes_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Channel"), 0.04);
|
||||
(* status_callback) (NULL, _("Channel"), 0.039);
|
||||
register_channel_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Color"), 0.061);
|
||||
(* status_callback) (NULL, _("Color"), 0.06);
|
||||
register_color_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Context"), 0.096);
|
||||
(* status_callback) (NULL, _("Context"), 0.095);
|
||||
register_context_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Convert"), 0.148);
|
||||
(* status_callback) (NULL, _("Convert"), 0.146);
|
||||
register_convert_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Display procedures"), 0.155);
|
||||
(* status_callback) (NULL, _("Display procedures"), 0.153);
|
||||
register_display_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Drawable procedures"), 0.165);
|
||||
(* status_callback) (NULL, _("Drawable procedures"), 0.162);
|
||||
register_drawable_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Transformation procedures"), 0.242);
|
||||
(* status_callback) (NULL, _("Transformation procedures"), 0.238);
|
||||
register_drawable_transform_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Edit procedures"), 0.264);
|
||||
(* status_callback) (NULL, _("Edit procedures"), 0.275);
|
||||
register_edit_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("File Operations"), 0.282);
|
||||
(* status_callback) (NULL, _("File Operations"), 0.294);
|
||||
register_fileops_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Floating selections"), 0.304);
|
||||
(* status_callback) (NULL, _("Floating selections"), 0.315);
|
||||
register_floating_sel_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Font UI"), 0.318);
|
||||
(* status_callback) (NULL, _("Font UI"), 0.329);
|
||||
register_font_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Fonts"), 0.325);
|
||||
(* status_callback) (NULL, _("Fonts"), 0.336);
|
||||
register_fonts_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gimprc procedures"), 0.329);
|
||||
(* status_callback) (NULL, _("Gimprc procedures"), 0.34);
|
||||
register_gimprc_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gradient"), 0.344);
|
||||
(* status_callback) (NULL, _("Gradient"), 0.354);
|
||||
register_gradient_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gradient UI"), 0.412);
|
||||
(* status_callback) (NULL, _("Gradient UI"), 0.421);
|
||||
register_gradient_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Gradients"), 0.419);
|
||||
(* status_callback) (NULL, _("Gradients"), 0.428);
|
||||
register_gradients_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Guide procedures"), 0.431);
|
||||
(* status_callback) (NULL, _("Guide procedures"), 0.44);
|
||||
register_guides_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Help procedures"), 0.445);
|
||||
(* status_callback) (NULL, _("Help procedures"), 0.454);
|
||||
register_help_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Image"), 0.447);
|
||||
(* status_callback) (NULL, _("Image"), 0.456);
|
||||
register_image_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Layer"), 0.598);
|
||||
(* status_callback) (NULL, _("Layer"), 0.604);
|
||||
register_layer_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Message procedures"), 0.659);
|
||||
(* status_callback) (NULL, _("Message procedures"), 0.664);
|
||||
register_message_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Miscellaneous"), 0.666);
|
||||
(* status_callback) (NULL, _("Miscellaneous"), 0.671);
|
||||
register_misc_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Paint Tool procedures"), 0.671);
|
||||
(* status_callback) (NULL, _("Paint Tool procedures"), 0.676);
|
||||
register_paint_tools_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Palette"), 0.706);
|
||||
(* status_callback) (NULL, _("Palette"), 0.711);
|
||||
register_palette_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Palette UI"), 0.732);
|
||||
(* status_callback) (NULL, _("Palette UI"), 0.736);
|
||||
register_palette_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Palettes"), 0.739);
|
||||
(* status_callback) (NULL, _("Palettes"), 0.743);
|
||||
register_palettes_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Parasite procedures"), 0.748);
|
||||
(* status_callback) (NULL, _("Parasite procedures"), 0.752);
|
||||
register_parasite_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Paths"), 0.776);
|
||||
(* status_callback) (NULL, _("Paths"), 0.78);
|
||||
register_paths_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Pattern"), 0.812);
|
||||
(* status_callback) (NULL, _("Pattern"), 0.815);
|
||||
register_pattern_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Pattern UI"), 0.816);
|
||||
(* status_callback) (NULL, _("Pattern UI"), 0.819);
|
||||
register_pattern_select_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Patterns"), 0.824);
|
||||
(* status_callback) (NULL, _("Patterns"), 0.826);
|
||||
register_patterns_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Plug-in"), 0.833);
|
||||
(* status_callback) (NULL, _("Plug-in"), 0.836);
|
||||
register_plug_in_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Procedural database"), 0.845);
|
||||
(* status_callback) (NULL, _("Procedural database"), 0.847);
|
||||
register_procedural_db_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Progress"), 0.866);
|
||||
(* status_callback) (NULL, _("Progress"), 0.868);
|
||||
register_progress_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Image mask"), 0.878);
|
||||
(* status_callback) (NULL, _("Image mask"), 0.88);
|
||||
register_selection_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Selection Tool procedures"), 0.92);
|
||||
(* status_callback) (NULL, _("Selection Tool procedures"), 0.921);
|
||||
register_selection_tools_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Text procedures"), 0.932);
|
||||
(* status_callback) (NULL, _("Text procedures"), 0.933);
|
||||
register_text_tool_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Transform Tool procedures"), 0.941);
|
||||
(* status_callback) (NULL, _("Transform Tool procedures"), 0.942);
|
||||
register_transform_tools_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Undo"), 0.955);
|
||||
(* status_callback) (NULL, _("Undo"), 0.956);
|
||||
register_undo_procs (gimp);
|
||||
|
||||
(* status_callback) (NULL, _("Units"), 0.972);
|
||||
|
|
|
@ -133,13 +133,20 @@ EXPORTS
|
|||
gimp_drawable_set_visible
|
||||
gimp_drawable_transform_flip_simple
|
||||
gimp_drawable_transform_flip
|
||||
gimp_drawable_transform_flip_defaults
|
||||
gimp_drawable_transform_perspective
|
||||
gimp_drawable_transform_perspective_defaults
|
||||
gimp_drawable_transform_rotate_simple
|
||||
gimp_drawable_transform_rotate
|
||||
gimp_drawable_transform_rotate_defaults
|
||||
gimp_drawable_transform_scale
|
||||
gimp_drawable_transform_scale_defaults
|
||||
gimp_drawable_transform_shear
|
||||
gimp_drawable_transform_shear_defaults
|
||||
gimp_drawable_transform_2d
|
||||
gimp_drawable_transform_2d_defaults
|
||||
gimp_drawable_transform_matrix
|
||||
gimp_drawable_transform_matrix_defaults
|
||||
gimp_drawable_type
|
||||
gimp_drawable_type_with_alpha
|
||||
gimp_drawable_update
|
||||
|
|
|
@ -145,6 +145,58 @@ gimp_drawable_transform_flip (gint32 drawable_ID,
|
|||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_flip_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @x0: horz. coord. of one end of axis.
|
||||
* @y0: vert. coord. of one end of axis.
|
||||
* @x1: horz. coord. of other end of axis.
|
||||
* @y1: vert. coord. of other end of axis.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Flip the specified drawable around a given line.
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_flip() which
|
||||
* uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The flipped drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_flip_defaults (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_flip_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_FLOAT, x0,
|
||||
GIMP_PDB_FLOAT, y0,
|
||||
GIMP_PDB_FLOAT, x1,
|
||||
GIMP_PDB_FLOAT, y1,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_perspective:
|
||||
* @drawable_ID: The affected drawable.
|
||||
|
@ -231,6 +283,71 @@ gimp_drawable_transform_perspective (gint32 drawable_ID,
|
|||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_perspective_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @x0: The new x coordinate of upper-left corner of original bounding box.
|
||||
* @y0: The new y coordinate of upper-left corner of original bounding box.
|
||||
* @x1: The new x coordinate of upper-right corner of original bounding box.
|
||||
* @y1: The new y coordinate of upper-right corner of original bounding box.
|
||||
* @x2: The new x coordinate of lower-left corner of original bounding box.
|
||||
* @y2: The new y coordinate of lower-left corner of original bounding box.
|
||||
* @x3: The new x coordinate of lower-right corner of original bounding box.
|
||||
* @y3: The new y coordinate of lower-right corner of original bounding box.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Perform a possibly non-affine transformation on the specified
|
||||
* drawable, with extra parameters.
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_perspective()
|
||||
* which uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The newly mapped drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_perspective_defaults (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
gdouble x3,
|
||||
gdouble y3,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_perspective_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_FLOAT, x0,
|
||||
GIMP_PDB_FLOAT, y0,
|
||||
GIMP_PDB_FLOAT, x1,
|
||||
GIMP_PDB_FLOAT, y1,
|
||||
GIMP_PDB_FLOAT, x2,
|
||||
GIMP_PDB_FLOAT, y2,
|
||||
GIMP_PDB_FLOAT, x3,
|
||||
GIMP_PDB_FLOAT, y3,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_rotate_simple:
|
||||
* @drawable_ID: The affected drawable.
|
||||
|
@ -351,6 +468,59 @@ gimp_drawable_transform_rotate (gint32 drawable_ID,
|
|||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_rotate_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @angle: The angle of rotation (radians).
|
||||
* @auto_center: Whether to automatically rotate around the selection center.
|
||||
* @center_x: The hor. coordinate of the center of rotation.
|
||||
* @center_y: The vert. coordinate of the center of rotation.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Rotate the specified drawable about given coordinates through the
|
||||
* specified angle.
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_rotate()
|
||||
* which uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The rotated drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_rotate_defaults (gint32 drawable_ID,
|
||||
gdouble angle,
|
||||
gboolean auto_center,
|
||||
gint center_x,
|
||||
gint center_y,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_rotate_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
GIMP_PDB_INT32, auto_center,
|
||||
GIMP_PDB_INT32, center_x,
|
||||
GIMP_PDB_INT32, center_y,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_scale:
|
||||
* @drawable_ID: The affected drawable.
|
||||
|
@ -416,6 +586,58 @@ gimp_drawable_transform_scale (gint32 drawable_ID,
|
|||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_scale_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @x0: The new x coordinate of upper-left corner of newly scaled region.
|
||||
* @y0: The new y coordinate of upper-left corner of newly scaled region.
|
||||
* @x1: The new x coordinate of lower-right corner of newly scaled region.
|
||||
* @y1: The new y coordinate of lower-right corner of newly scaled region.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Scale the specified drawable with extra parameters
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_scale() which
|
||||
* uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The scaled drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_scale_defaults (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_scale_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_FLOAT, x0,
|
||||
GIMP_PDB_FLOAT, y0,
|
||||
GIMP_PDB_FLOAT, x1,
|
||||
GIMP_PDB_FLOAT, y1,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_shear:
|
||||
* @drawable_ID: The affected drawable.
|
||||
|
@ -479,6 +701,53 @@ gimp_drawable_transform_shear (gint32 drawable_ID,
|
|||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_shear_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @shear_type: Type of shear.
|
||||
* @magnitude: The magnitude of the shear.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Shear the specified drawable about its center by the specified
|
||||
* magnitude, with extra parameters.
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_shear() which
|
||||
* uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The sheared drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_shear_defaults (gint32 drawable_ID,
|
||||
GimpOrientationType shear_type,
|
||||
gdouble magnitude,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_shear_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_INT32, shear_type,
|
||||
GIMP_PDB_FLOAT, magnitude,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_2d:
|
||||
* @drawable_ID: The affected drawable.
|
||||
|
@ -556,6 +825,67 @@ gimp_drawable_transform_2d (gint32 drawable_ID,
|
|||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_2d_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @source_x: X coordinate of the transformation center.
|
||||
* @source_y: Y coordinate of the transformation center.
|
||||
* @scale_x: Amount to scale in x direction.
|
||||
* @scale_y: Amount to scale in y direction.
|
||||
* @angle: The angle of rotation (radians).
|
||||
* @dest_x: X coordinate of where the center goes.
|
||||
* @dest_y: Y coordinate of where the center goes.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Transform the specified drawable in 2d, with extra parameters.
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_2d() which
|
||||
* uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The transformed drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_2d_defaults (gint32 drawable_ID,
|
||||
gdouble source_x,
|
||||
gdouble source_y,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle,
|
||||
gdouble dest_x,
|
||||
gdouble dest_y,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_2d_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_FLOAT, source_x,
|
||||
GIMP_PDB_FLOAT, source_y,
|
||||
GIMP_PDB_FLOAT, scale_x,
|
||||
GIMP_PDB_FLOAT, scale_y,
|
||||
GIMP_PDB_FLOAT, angle,
|
||||
GIMP_PDB_FLOAT, dest_x,
|
||||
GIMP_PDB_FLOAT, dest_y,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_matrix:
|
||||
* @drawable_ID: The affected drawable.
|
||||
|
@ -636,3 +966,70 @@ gimp_drawable_transform_matrix (gint32 drawable_ID,
|
|||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_drawable_transform_matrix_defaults:
|
||||
* @drawable_ID: The affected drawable.
|
||||
* @coeff_0_0: coefficient (0,0) of the transformation matrix.
|
||||
* @coeff_0_1: coefficient (0,1) of the transformation matrix.
|
||||
* @coeff_0_2: coefficient (0,2) of the transformation matrix.
|
||||
* @coeff_1_0: coefficient (1,0) of the transformation matrix.
|
||||
* @coeff_1_1: coefficient (1,1) of the transformation matrix.
|
||||
* @coeff_1_2: coefficient (1,2) of the transformation matrix.
|
||||
* @coeff_2_0: coefficient (2,0) of the transformation matrix.
|
||||
* @coeff_2_1: coefficient (2,1) of the transformation matrix.
|
||||
* @coeff_2_2: coefficient (2,2) of the transformation matrix.
|
||||
* @interpolation: Whether to use interpolation and supersampling.
|
||||
* @clip_result: Whether to clip results.
|
||||
*
|
||||
* Transform the specified drawable in 2d, with extra parameters.
|
||||
*
|
||||
* This procedure is a variant of gimp_drawable_transform_matrix()
|
||||
* which uses no interpolation/supersampling at all, or default values
|
||||
* (depending on the 'interpolation' parameter).
|
||||
*
|
||||
* Returns: The transformed drawable.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
*/
|
||||
gint32
|
||||
gimp_drawable_transform_matrix_defaults (gint32 drawable_ID,
|
||||
gdouble coeff_0_0,
|
||||
gdouble coeff_0_1,
|
||||
gdouble coeff_0_2,
|
||||
gdouble coeff_1_0,
|
||||
gdouble coeff_1_1,
|
||||
gdouble coeff_1_2,
|
||||
gdouble coeff_2_0,
|
||||
gdouble coeff_2_1,
|
||||
gdouble coeff_2_2,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 ret_drawable_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_drawable_transform_matrix_defaults",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_FLOAT, coeff_0_0,
|
||||
GIMP_PDB_FLOAT, coeff_0_1,
|
||||
GIMP_PDB_FLOAT, coeff_0_2,
|
||||
GIMP_PDB_FLOAT, coeff_1_0,
|
||||
GIMP_PDB_FLOAT, coeff_1_1,
|
||||
GIMP_PDB_FLOAT, coeff_1_2,
|
||||
GIMP_PDB_FLOAT, coeff_2_0,
|
||||
GIMP_PDB_FLOAT, coeff_2_1,
|
||||
GIMP_PDB_FLOAT, coeff_2_2,
|
||||
GIMP_PDB_INT32, interpolation,
|
||||
GIMP_PDB_INT32, clip_result,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
ret_drawable_ID = return_vals[1].data.d_drawable;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return ret_drawable_ID;
|
||||
}
|
||||
|
|
|
@ -29,97 +29,156 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
gint32 gimp_drawable_transform_flip_simple (gint32 drawable_ID,
|
||||
GimpOrientationType flip_type,
|
||||
gboolean auto_center,
|
||||
gdouble axis,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_flip (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_perspective (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
gdouble x3,
|
||||
gdouble y3,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_rotate_simple (gint32 drawable_ID,
|
||||
GimpRotationType rotate_type,
|
||||
gboolean auto_center,
|
||||
gint center_x,
|
||||
gint center_y,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_rotate (gint32 drawable_ID,
|
||||
gdouble angle,
|
||||
gboolean auto_center,
|
||||
gint center_x,
|
||||
gint center_y,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_scale (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_shear (gint32 drawable_ID,
|
||||
GimpOrientationType shear_type,
|
||||
gdouble magnitude,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_2d (gint32 drawable_ID,
|
||||
gdouble source_x,
|
||||
gdouble source_y,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle,
|
||||
gdouble dest_x,
|
||||
gdouble dest_y,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_matrix (gint32 drawable_ID,
|
||||
gdouble coeff_0_0,
|
||||
gdouble coeff_0_1,
|
||||
gdouble coeff_0_2,
|
||||
gdouble coeff_1_0,
|
||||
gdouble coeff_1_1,
|
||||
gdouble coeff_1_2,
|
||||
gdouble coeff_2_0,
|
||||
gdouble coeff_2_1,
|
||||
gdouble coeff_2_2,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_flip_simple (gint32 drawable_ID,
|
||||
GimpOrientationType flip_type,
|
||||
gboolean auto_center,
|
||||
gdouble axis,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_flip (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_flip_defaults (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_perspective (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
gdouble x3,
|
||||
gdouble y3,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_perspective_defaults (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gdouble x2,
|
||||
gdouble y2,
|
||||
gdouble x3,
|
||||
gdouble y3,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_rotate_simple (gint32 drawable_ID,
|
||||
GimpRotationType rotate_type,
|
||||
gboolean auto_center,
|
||||
gint center_x,
|
||||
gint center_y,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_rotate (gint32 drawable_ID,
|
||||
gdouble angle,
|
||||
gboolean auto_center,
|
||||
gint center_x,
|
||||
gint center_y,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_rotate_defaults (gint32 drawable_ID,
|
||||
gdouble angle,
|
||||
gboolean auto_center,
|
||||
gint center_x,
|
||||
gint center_y,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_scale (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_scale_defaults (gint32 drawable_ID,
|
||||
gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_shear (gint32 drawable_ID,
|
||||
GimpOrientationType shear_type,
|
||||
gdouble magnitude,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_shear_defaults (gint32 drawable_ID,
|
||||
GimpOrientationType shear_type,
|
||||
gdouble magnitude,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_2d (gint32 drawable_ID,
|
||||
gdouble source_x,
|
||||
gdouble source_y,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle,
|
||||
gdouble dest_x,
|
||||
gdouble dest_y,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_2d_defaults (gint32 drawable_ID,
|
||||
gdouble source_x,
|
||||
gdouble source_y,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
gdouble angle,
|
||||
gdouble dest_x,
|
||||
gdouble dest_y,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_matrix (gint32 drawable_ID,
|
||||
gdouble coeff_0_0,
|
||||
gdouble coeff_0_1,
|
||||
gdouble coeff_0_2,
|
||||
gdouble coeff_1_0,
|
||||
gdouble coeff_1_1,
|
||||
gdouble coeff_1_2,
|
||||
gdouble coeff_2_0,
|
||||
gdouble coeff_2_1,
|
||||
gdouble coeff_2_2,
|
||||
GimpTransformDirection transform_direction,
|
||||
GimpInterpolationType interpolation,
|
||||
gboolean supersample,
|
||||
gint recursion_level,
|
||||
gboolean clip_result);
|
||||
gint32 gimp_drawable_transform_matrix_defaults (gint32 drawable_ID,
|
||||
gdouble coeff_0_0,
|
||||
gdouble coeff_0_1,
|
||||
gdouble coeff_0_2,
|
||||
gdouble coeff_1_0,
|
||||
gdouble coeff_1_1,
|
||||
gdouble coeff_1_2,
|
||||
gdouble coeff_2_0,
|
||||
gdouble coeff_2_1,
|
||||
gdouble coeff_2_2,
|
||||
gboolean interpolation,
|
||||
gboolean clip_result);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -48,6 +48,13 @@ sub transform_options_args () {
|
|||
desc => 'Whether to clip results' }
|
||||
}
|
||||
|
||||
sub transform_options_defaults_args () {
|
||||
{ name => 'interpolation', type => 'boolean',
|
||||
desc => 'Whether to use interpolation and supersampling' },
|
||||
{ name => 'clip_result', type => 'boolean',
|
||||
desc => 'Whether to clip results' }
|
||||
}
|
||||
|
||||
sub drawable_out_arg {
|
||||
my $type = shift;
|
||||
my $arg = &drawable_arg;
|
||||
|
@ -144,8 +151,7 @@ HELP
|
|||
desc => 'horz. coord. of other end of axis' },
|
||||
{ name => 'y1', type => 'float',
|
||||
desc => 'vert. coord. of other end of axis' },
|
||||
|
||||
&transform_options_args
|
||||
&transform_options_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('flipped') );
|
||||
|
@ -185,6 +191,73 @@ CODE
|
|||
}
|
||||
|
||||
|
||||
sub drawable_transform_flip_defaults {
|
||||
$blurb = <<'BLURB';
|
||||
Flip the specified drawable around a given line.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_flip() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'x0', type => 'float',
|
||||
desc => 'horz. coord. of one end of axis' },
|
||||
{ name => 'y0', type => 'float',
|
||||
desc => 'vert. coord. of one end of axis' },
|
||||
{ name => 'x1', type => 'float',
|
||||
desc => 'horz. coord. of other end of axis' },
|
||||
{ name => 'y1', type => 'float',
|
||||
desc => 'vert. coord. of other end of axis' },
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('flipped') );
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_transform_matrix_flip_free (x, y, width, height,
|
||||
x0, y0, x1, y1,
|
||||
&matrix);
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("Flip..."), FALSE);
|
||||
|
||||
/* Transform the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_perspective {
|
||||
$blurb = <<'BLURB';
|
||||
Perform a possibly non-affine transformation on the specified drawable, with extra parameters.
|
||||
|
@ -226,7 +299,7 @@ HELP
|
|||
$pos++;
|
||||
}
|
||||
@inargs = (@inargs,
|
||||
&transform_options_args
|
||||
&transform_options_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('newly mapped') );
|
||||
|
@ -270,6 +343,85 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_perspective_defaults {
|
||||
$blurb = <<'BLURB';
|
||||
Perform a possibly non-affine transformation on the specified drawable, with extra parameters.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_perspective() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg
|
||||
);
|
||||
|
||||
my $pos = 0;
|
||||
foreach $where (qw(upper-left upper-right lower-left lower-right)) {
|
||||
foreach (qw(x y)) {
|
||||
push @inargs,
|
||||
{ name => "$_$pos", type => 'float',
|
||||
desc => "The new $_ coordinate of $where corner of original
|
||||
bounding box",
|
||||
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
|
||||
}
|
||||
$pos++;
|
||||
}
|
||||
@inargs = (@inargs,
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('newly mapped') );
|
||||
|
||||
%invoke = (
|
||||
vars => [ 'gdouble trans_info[8]' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_transform_matrix_perspective (x, y, width, height,
|
||||
trans_info[X0], trans_info[Y0],
|
||||
trans_info[X1], trans_info[Y1],
|
||||
trans_info[X2], trans_info[Y2],
|
||||
trans_info[X3], trans_info[Y3],
|
||||
&matrix);
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("Perspective..."), FALSE);
|
||||
|
||||
/* Perspective the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_rotate_simple {
|
||||
$blurb = <<'BLURB';
|
||||
Rotate the specified drawable about given coordinates through the specified angle.
|
||||
|
@ -393,6 +545,78 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_rotate_defaults {
|
||||
$blurb = <<'BLURB';
|
||||
Rotate the specified drawable about given coordinates through the specified angle.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_rotate() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'angle', type => 'float',
|
||||
desc => 'The angle of rotation (radians)' },
|
||||
{ name => 'auto_center', type => 'boolean',
|
||||
desc => 'Whether to automatically rotate around the selection center' },
|
||||
{ name => 'center_x', type => 'int32',
|
||||
desc => 'The hor. coordinate of the center of rotation' },
|
||||
{ name => 'center_y', type => 'int32',
|
||||
desc => 'The vert. coordinate of the center of rotation' },
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('rotated') );
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
if (auto_center)
|
||||
gimp_transform_matrix_rotate (x, y, width, height, angle,
|
||||
&matrix);
|
||||
else
|
||||
gimp_transform_matrix_rotate_center (center_x, center_y, angle,
|
||||
&matrix);
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("Rotating..."), FALSE);
|
||||
|
||||
/* Rotate the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_scale {
|
||||
$blurb = 'Scale the specified drawable with extra parameters';
|
||||
|
||||
|
@ -425,7 +649,7 @@ HELP
|
|||
}
|
||||
|
||||
@inargs = (@inargs,
|
||||
&transform_options_args
|
||||
&transform_options_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('scaled') );
|
||||
|
@ -471,6 +695,86 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_scale_defaults {
|
||||
$blurb = 'Scale the specified drawable with extra parameters';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_scale() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg
|
||||
);
|
||||
|
||||
my $pos = 0;
|
||||
foreach $where (qw(upper-left lower-right)) {
|
||||
foreach (qw(x y)) {
|
||||
push @inargs,
|
||||
{ name => "$_$pos", type => 'float',
|
||||
desc => "The new $_ coordinate of $where corner of newly
|
||||
scaled region",
|
||||
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
|
||||
}
|
||||
$pos++;
|
||||
}
|
||||
|
||||
@inargs = (@inargs,
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('scaled') );
|
||||
|
||||
%invoke = (
|
||||
vars => [ 'gdouble trans_info[4]' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
|
||||
trans_info[X0] < trans_info[X1] &&
|
||||
trans_info[Y0] < trans_info[X1]);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_transform_matrix_scale (x, y, width, height,
|
||||
trans_info[X0],
|
||||
trans_info[Y0],
|
||||
trans_info[X1] - trans_info[X0],
|
||||
trans_info[Y1] - trans_info[Y0],
|
||||
&matrix);
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("Scaling..."), FALSE);
|
||||
|
||||
/* Scale the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_shear {
|
||||
$blurb = <<'BLURB';
|
||||
Shear the specified drawable about its center by the specified magnitude, with extra parameters.
|
||||
|
@ -538,6 +842,70 @@ CODE
|
|||
}
|
||||
|
||||
|
||||
sub drawable_transform_shear_defaults {
|
||||
$blurb = <<'BLURB';
|
||||
Shear the specified drawable about its center by the specified magnitude, with extra parameters.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_shear() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'shear_type', type => &std_orientation_enum,
|
||||
desc => 'Type of shear: %%desc%%' },
|
||||
{ name => 'magnitude', type => 'float',
|
||||
desc => 'The magnitude of the shear' },
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('sheared') );
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_transform_matrix_shear (x, y, width, height,
|
||||
shear_type, magnitude,
|
||||
&matrix);
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("Shearing..."), FALSE);
|
||||
|
||||
/* Shear the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_2d {
|
||||
$blurb = <<'BLURB';
|
||||
Transform the specified drawable in 2d, with extra parameters.
|
||||
|
@ -617,6 +985,83 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_2d_defaults {
|
||||
$blurb = <<'BLURB';
|
||||
Transform the specified drawable in 2d, with extra parameters.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_2d() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'source_x', type => 'float',
|
||||
desc => 'X coordinate of the transformation center' },
|
||||
{ name => 'source_y', type => 'float',
|
||||
desc => 'Y coordinate of the transformation center' },
|
||||
{ name => 'scale_x', type => 'float',
|
||||
desc => 'Amount to scale in x direction' },
|
||||
{ name => 'scale_y', type => 'float',
|
||||
desc => 'Amount to scale in y direction' },
|
||||
{ name => 'angle', type => 'float',
|
||||
desc => 'The angle of rotation (radians)' },
|
||||
{ name => 'dest_x', type => 'float',
|
||||
desc => 'X coordinate of where the center goes' },
|
||||
{ name => 'dest_y', type => 'float',
|
||||
desc => 'Y coordinate of where the center goes' },
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('transformed') );
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (&matrix);
|
||||
gimp_matrix3_translate (&matrix, -source_x, -source_y);
|
||||
gimp_matrix3_scale (&matrix, scale_x, scale_y);
|
||||
gimp_matrix3_rotate (&matrix, angle);
|
||||
gimp_matrix3_translate (&matrix, dest_x, dest_y);
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("2D Transform..."), FALSE);
|
||||
|
||||
/* Transform the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_matrix {
|
||||
$blurb = <<'BLURB';
|
||||
Transform the specified drawable in 2d, with extra parameters.
|
||||
|
@ -701,17 +1146,107 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
sub drawable_transform_matrix_defaults {
|
||||
$blurb = <<'BLURB';
|
||||
Transform the specified drawable in 2d, with extra parameters.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure is a variant of gimp_drawable_transform_matrix() which
|
||||
uses no interpolation/supersampling at all, or default values
|
||||
(depending on the 'interpolation' parameter).
|
||||
HELP
|
||||
|
||||
&pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&drawable_arg,
|
||||
{ name => 'coeff_0_0', type => 'float',
|
||||
desc => 'coefficient (0,0) of the transformation matrix' },
|
||||
{ name => 'coeff_0_1', type => 'float',
|
||||
desc => 'coefficient (0,1) of the transformation matrix' },
|
||||
{ name => 'coeff_0_2', type => 'float',
|
||||
desc => 'coefficient (0,2) of the transformation matrix' },
|
||||
{ name => 'coeff_1_0', type => 'float',
|
||||
desc => 'coefficient (1,0) of the transformation matrix' },
|
||||
{ name => 'coeff_1_1', type => 'float',
|
||||
desc => 'coefficient (1,1) of the transformation matrix' },
|
||||
{ name => 'coeff_1_2', type => 'float',
|
||||
desc => 'coefficient (1,2) of the transformation matrix' },
|
||||
{ name => 'coeff_2_0', type => 'float',
|
||||
desc => 'coefficient (2,0) of the transformation matrix' },
|
||||
{ name => 'coeff_2_1', type => 'float',
|
||||
desc => 'coefficient (2,1) of the transformation matrix' },
|
||||
{ name => 'coeff_2_2', type => 'float',
|
||||
desc => 'coefficient (2,2) of the transformation matrix' },
|
||||
&transform_options_defaults_args
|
||||
);
|
||||
|
||||
@outargs = ( &drawable_out_arg('transformed') );
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gint x, y, width, height;
|
||||
|
||||
success = gimp_item_is_attached (GIMP_ITEM (drawable));
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
matrix.coeff[0][0] = coeff_0_0;
|
||||
matrix.coeff[0][1] = coeff_0_1;
|
||||
matrix.coeff[0][2] = coeff_0_2;
|
||||
matrix.coeff[1][0] = coeff_1_0;
|
||||
matrix.coeff[1][1] = coeff_1_1;
|
||||
matrix.coeff[1][2] = coeff_1_2;
|
||||
matrix.coeff[2][0] = coeff_2_0;
|
||||
matrix.coeff[2][1] = coeff_2_1;
|
||||
matrix.coeff[2][2] = coeff_2_2;
|
||||
|
||||
if (interpolation)
|
||||
interpolation_type = gimp->config->interpolation_type;
|
||||
|
||||
if (progress)
|
||||
gimp_progress_start (progress, _("2D Transform..."), FALSE);
|
||||
|
||||
/* Transform the selection */
|
||||
success = gimp_drawable_transform_affine (drawable, context,
|
||||
&matrix, GIMP_TRANSFORM_FORWARD,
|
||||
interpolation_type,
|
||||
interpolation, 3,
|
||||
clip_result, progress);
|
||||
|
||||
if (progress)
|
||||
gimp_progress_end (progress);
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@headers = qw("libgimpmath/gimpmath.h" "config/gimpcoreconfig.h"
|
||||
"core/gimp.h" "core/gimp-transform-utils.h" "core/gimpimage.h"
|
||||
"core/gimpdrawable.h" "core/gimpdrawable-transform.h"
|
||||
"core/gimpprogress.h"
|
||||
"gimp-intl.h");
|
||||
|
||||
@procs = qw(drawable_transform_flip_simple drawable_transform_flip
|
||||
@procs = qw(drawable_transform_flip_simple
|
||||
drawable_transform_flip drawable_transform_flip_defaults
|
||||
drawable_transform_perspective
|
||||
drawable_transform_rotate_simple drawable_transform_rotate
|
||||
drawable_transform_scale drawable_transform_shear
|
||||
drawable_transform_2d drawable_transform_matrix);
|
||||
drawable_transform_perspective_defaults
|
||||
drawable_transform_rotate_simple
|
||||
drawable_transform_rotate drawable_transform_rotate_defaults
|
||||
drawable_transform_scale drawable_transform_scale_defaults
|
||||
drawable_transform_shear drawable_transform_shear_defaults
|
||||
drawable_transform_2d drawable_transform_2d_defaults
|
||||
drawable_transform_matrix drawable_transform_matrix_defaults);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue