From 2e21005a38503b2cdafc7ac735c58e8d2fb08ad5 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 19 Nov 2001 18:54:13 +0000 Subject: [PATCH] oops, forgot this dorectory... --- app/pdb/Makefile.am | 1 + app/pdb/internal_procs.c | 4 + app/pdb/tools_cmds.c | 842 --------------------------------- app/pdb/transform_tools_cmds.c | 723 ++++++++++++++++++++++++++++ 4 files changed, 728 insertions(+), 842 deletions(-) create mode 100644 app/pdb/transform_tools_cmds.c diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am index d743e0975a..8b8f640bdb 100644 --- a/app/pdb/Makefile.am +++ b/app/pdb/Makefile.am @@ -39,6 +39,7 @@ libapppdb_a_SOURCES = @STRIP_BEGIN@ \ selection_tools_cmds.c \ text_tool_cmds.c \ tools_cmds.c \ + transform_tools_cmds.c \ undo_cmds.c \ unit_cmds.c \ @STRIP_END@ diff --git a/app/pdb/internal_procs.c b/app/pdb/internal_procs.c index e68f786aff..b5ba171517 100644 --- a/app/pdb/internal_procs.c +++ b/app/pdb/internal_procs.c @@ -60,6 +60,7 @@ void register_selection_procs (Gimp *gimp); void register_selection_tools_procs (Gimp *gimp); void register_text_tool_procs (Gimp *gimp); void register_tools_procs (Gimp *gimp); +void register_transform_tools_procs (Gimp *gimp); void register_undo_procs (Gimp *gimp); void register_unit_procs (Gimp *gimp); @@ -162,6 +163,9 @@ internal_procs_init (Gimp *gimp, (* status_callback) (NULL, _("Tool procedures"), 0.885); register_tools_procs (gimp); + (* status_callback) (NULL, _("Tool procedures"), 0.939); + register_transform_tools_procs (gimp); + (* status_callback) (NULL, _("Undo"), 0.958); register_undo_procs (gimp); diff --git a/app/pdb/tools_cmds.c b/app/pdb/tools_cmds.c index cb077bab70..c32ae40a31 100644 --- a/app/pdb/tools_cmds.c +++ b/app/pdb/tools_cmds.c @@ -43,16 +43,9 @@ #include "tools/gimpconvolvetool.h" #include "tools/gimpdodgeburntool.h" #include "tools/gimperasertool.h" -#include "tools/gimpfliptool.h" #include "tools/gimppaintbrushtool.h" #include "tools/gimppenciltool.h" -#include "tools/gimpperspectivetool.h" -#include "tools/gimprotatetool.h" -#include "tools/gimpscaletool.h" -#include "tools/gimpsheartool.h" #include "tools/gimpsmudgetool.h" -#include "tools/gimptransformtool.h" -#include "undo.h" #include "libgimpcolor/gimpcolor.h" #include "libgimpmath/gimpmath.h" @@ -70,17 +63,11 @@ static ProcRecord dodgeburn_proc; static ProcRecord dodgeburn_default_proc; static ProcRecord eraser_proc; static ProcRecord eraser_default_proc; -static ProcRecord flip_proc; static ProcRecord paintbrush_proc; static ProcRecord paintbrush_default_proc; static ProcRecord pencil_proc; -static ProcRecord perspective_proc; -static ProcRecord rotate_proc; -static ProcRecord scale_proc; -static ProcRecord shear_proc; static ProcRecord smudge_proc; static ProcRecord smudge_default_proc; -static ProcRecord transform_2d_proc; void register_tools_procs (Gimp *gimp) @@ -98,17 +85,11 @@ register_tools_procs (Gimp *gimp) procedural_db_register (gimp, &dodgeburn_default_proc); procedural_db_register (gimp, &eraser_proc); procedural_db_register (gimp, &eraser_default_proc); - procedural_db_register (gimp, &flip_proc); procedural_db_register (gimp, &paintbrush_proc); procedural_db_register (gimp, &paintbrush_default_proc); procedural_db_register (gimp, &pencil_proc); - procedural_db_register (gimp, &perspective_proc); - procedural_db_register (gimp, &rotate_proc); - procedural_db_register (gimp, &scale_proc); - procedural_db_register (gimp, &shear_proc); procedural_db_register (gimp, &smudge_proc); procedural_db_register (gimp, &smudge_default_proc); - procedural_db_register (gimp, &transform_2d_proc); } static Argument * @@ -1278,111 +1259,6 @@ static ProcRecord eraser_default_proc = { { eraser_default_invoker } } }; -static Argument * -flip_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - gint32 flip_type; - GimpImage *gimage; - TileManager *float_tiles, *new_tiles; - gboolean new_layer; - - drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); - if (drawable == NULL) - success = FALSE; - - flip_type = args[1].value.pdb_int; - if (flip_type < HORIZONTAL || flip_type > VERTICAL) - success = FALSE; - - if (success) - { - gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable)); - - /* Start a transform undo group */ - undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); - - /* Cut/Copy from the specified drawable */ - float_tiles = gimp_transform_tool_cut (gimage, drawable, &new_layer); - - flip_type = flip_type == HORIZONTAL ? ORIENTATION_HORIZONTAL : - flip_type == VERTICAL ? ORIENTATION_VERTICAL : - ORIENTATION_UNKNOWN; - - /* flip the buffer */ - switch (flip_type) - { - case ORIENTATION_HORIZONTAL: - case ORIENTATION_VERTICAL: - new_tiles = flip_tool_flip (gimage, drawable, float_tiles, -1, flip_type); - break; - default: - new_tiles = NULL; - break; - } - - /* free the cut/copied buffer */ - tile_manager_destroy (float_tiles); - - if (new_tiles) - success = gimp_transform_tool_paste (gimage, drawable, new_tiles, new_layer); - else - success = FALSE; - - /* push the undo group end */ - undo_push_group_end (gimage); - } - - return_args = procedural_db_return_args (&flip_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); - - return return_args; -} - -static ProcArg flip_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The affected drawable" - }, - { - GIMP_PDB_INT32, - "flip_type", - "Type of flip: HORIZONTAL (0) or VERTICAL (1)" - } -}; - -static ProcArg flip_outargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The flipped drawable" - } -}; - -static ProcRecord flip_proc = -{ - "gimp_flip", - "Flip the specified drawable about its center either vertically or horizontally.", - "This tool flips the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then flipd by the specified amount. The return value is the ID of the flipped drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and flipped drawable. The flip type parameter indicates whether the flip will be applied horizontally or vertically.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 2, - flip_inargs, - 1, - flip_outargs, - { { flip_invoker } } -}; - static Argument * paintbrush_invoker (Gimp *gimp, Argument *args) @@ -1600,569 +1476,6 @@ static ProcRecord pencil_proc = { { pencil_invoker } } }; -static Argument * -perspective_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - gboolean interpolation; - GimpImage *gimage; - TileManager *float_tiles, *new_tiles; - gboolean new_layer; - gint offset_x, offset_y; - gdouble cx, cy; - gdouble scalex, scaley; - gdouble trans_info[8]; - GimpMatrix3 m, matrix; - - drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); - if (drawable == NULL) - success = FALSE; - - interpolation = args[1].value.pdb_int ? TRUE : FALSE; - - trans_info[X0] = args[2].value.pdb_float; - - trans_info[Y0] = args[3].value.pdb_float; - - trans_info[X1] = args[4].value.pdb_float; - - trans_info[Y1] = args[5].value.pdb_float; - - trans_info[X2] = args[6].value.pdb_float; - - trans_info[Y2] = args[7].value.pdb_float; - - trans_info[X3] = args[8].value.pdb_float; - - trans_info[Y3] = args[9].value.pdb_float; - - if (success) - { - gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable)); - - /* Start a transform undo group */ - undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); - - /* Cut/Copy from the specified drawable */ - float_tiles = gimp_transform_tool_cut (gimage, drawable, &new_layer); - - /* Determine the perspective transform that maps from - * the unit cube to the trans_info coordinates - */ - gimp_perspective_tool_find_transform (trans_info, m); - - tile_manager_get_offsets (float_tiles, &offset_x, &offset_y); - cx = (gdouble) offset_x; - cy = (gdouble) offset_y; - scalex = 1.0; - scaley = 1.0; - if (tile_manager_width (float_tiles)) - scalex = 1.0 / tile_manager_width (float_tiles); - if (tile_manager_height (float_tiles)) - scaley = 1.0 / tile_manager_height (float_tiles); - - /* Assemble the transformation matrix */ - gimp_matrix3_identity (matrix); - gimp_matrix3_translate (matrix, -cx, -cy); - gimp_matrix3_scale (matrix, scalex, scaley); - gimp_matrix3_mult (m, matrix); - - /* Perspective the buffer */ - new_tiles = gimp_perspective_tool_perspective (gimage, drawable, NULL, - float_tiles, interpolation, - matrix); - - /* Free the cut/copied buffer */ - tile_manager_destroy (float_tiles); - - if (new_tiles) - success = gimp_transform_tool_paste (gimage, drawable, new_tiles, new_layer); - else - success = FALSE; - - /* push the undo group end */ - undo_push_group_end (gimage); - } - - return_args = procedural_db_return_args (&perspective_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); - - return return_args; -} - -static ProcArg perspective_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The affected drawable" - }, - { - GIMP_PDB_INT32, - "interpolation", - "Whether to use interpolation" - }, - { - GIMP_PDB_FLOAT, - "x0", - "The new x coordinate of upper-left corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "y0", - "The new y coordinate of upper-left corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "x1", - "The new x coordinate of upper-right corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "y1", - "The new y coordinate of upper-right corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "x2", - "The new x coordinate of lower-left corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "y2", - "The new y coordinate of lower-left corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "x3", - "The new x coordinate of lower-right corner of original bounding box" - }, - { - GIMP_PDB_FLOAT, - "y3", - "The new y coordinate of lower-right corner of original bounding box" - } -}; - -static ProcArg perspective_outargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The newly mapped drawable" - } -}; - -static ProcRecord perspective_proc = -{ - "gimp_perspective", - "Perform a possibly non-affine transformation on the specified drawable.", - "This tool performs a possibly non-affine transformation on the specified drawable by allowing the corners of the original bounding box to be arbitrarily remapped to any values. The specified drawable is remapped if no selection exists. However, if a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then remapped as specified. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting remapped drawable. The return value is the ID of the remapped drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and remapped drawable. The 4 coordinates specify the new locations of each corner of the original bounding box. By specifying these values, any affine transformation (rotation, scaling, translation) can be affected. Additionally," - "these values can be specified such that the resulting transformed drawable will appear to have been projected via a perspective transform.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 10, - perspective_inargs, - 1, - perspective_outargs, - { { perspective_invoker } } -}; - -static Argument * -rotate_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - gboolean interpolation; - gdouble angle; - GimpImage *gimage; - TileManager *float_tiles, *new_tiles; - gboolean new_layer; - gint offset_x, offset_y; - gdouble cx, cy; - GimpMatrix3 matrix; - - drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); - if (drawable == NULL) - success = FALSE; - - interpolation = args[1].value.pdb_int ? TRUE : FALSE; - - angle = args[2].value.pdb_float; - - if (success) - { - gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable)); - - /* Start a transform undo group */ - undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); - - /* Cut/Copy from the specified drawable */ - float_tiles = gimp_transform_tool_cut (gimage, drawable, &new_layer); - - tile_manager_get_offsets (float_tiles, &offset_x, &offset_y); - cx = offset_x + tile_manager_width (float_tiles) / 2.0; - cy = offset_y + tile_manager_height (float_tiles) / 2.0; - - /* Assemble the transformation matrix */ - gimp_matrix3_identity (matrix); - gimp_matrix3_translate (matrix, -cx, -cy); - gimp_matrix3_rotate (matrix, angle); - gimp_matrix3_translate (matrix, +cx, +cy); - - /* Rotate the buffer */ - new_tiles = gimp_rotate_tool_rotate (gimage, drawable, NULL, angle, - float_tiles, interpolation, matrix); - - /* Free the cut/copied buffer */ - tile_manager_destroy (float_tiles); - - if (new_tiles) - success = gimp_transform_tool_paste (gimage, drawable, new_tiles, new_layer); - else - success = FALSE; - - /* Push the undo group end */ - undo_push_group_end (gimage); - } - - return_args = procedural_db_return_args (&rotate_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); - - return return_args; -} - -static ProcArg rotate_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The affected drawable" - }, - { - GIMP_PDB_INT32, - "interpolation", - "Whether to use interpolation" - }, - { - GIMP_PDB_FLOAT, - "angle", - "The angle of rotation (radians)" - } -}; - -static ProcArg rotate_outargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The rotated drawable" - } -}; - -static ProcRecord rotate_proc = -{ - "gimp_rotate", - "Rotate the specified drawable about its center through the specified angle.", - "This tool rotates the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then rotated by the specified amount. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting rotated drawable. The return value is the ID of the rotated drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and rotated drawable.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 3, - rotate_inargs, - 1, - rotate_outargs, - { { rotate_invoker } } -}; - -static Argument * -scale_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - gboolean interpolation; - GimpImage *gimage; - TileManager *float_tiles, *new_tiles; - gboolean new_layer; - gint offset_x, offset_y; - gdouble scalex, scaley; - gdouble trans_info[4]; - GimpMatrix3 matrix; - - drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); - if (drawable == NULL) - success = FALSE; - - interpolation = args[1].value.pdb_int ? TRUE : FALSE; - - trans_info[X0] = args[2].value.pdb_float; - - trans_info[Y0] = args[3].value.pdb_float; - - trans_info[X1] = args[4].value.pdb_float; - - trans_info[Y1] = args[5].value.pdb_float; - - if (success) - { - if (trans_info[X0] < trans_info[X1] && - trans_info[Y0] < trans_info[X1]) - { - gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable)); - - /* Start a transform undo group */ - undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); - - /* Cut/Copy from the specified drawable */ - float_tiles = gimp_transform_tool_cut (gimage, drawable, &new_layer); - - scalex = scaley = 1.0; - if (tile_manager_width (float_tiles)) - scalex = (trans_info[X1] - trans_info[X0]) / - (gdouble) tile_manager_width (float_tiles); - if (tile_manager_height (float_tiles)) - scaley = (trans_info[Y1] - trans_info[Y0]) / - (gdouble) tile_manager_height (float_tiles); - - tile_manager_get_offsets (float_tiles, &offset_x, &offset_y); - - /* Assemble the transformation matrix */ - gimp_matrix3_identity (matrix); - gimp_matrix3_translate (matrix, offset_x, offset_y); - gimp_matrix3_scale (matrix, scalex, scaley); - gimp_matrix3_translate (matrix, trans_info[X0], trans_info[Y0]); - - /* Scale the buffer */ - new_tiles = gimp_scale_tool_scale (gimage, drawable, NULL, trans_info, - float_tiles, interpolation, matrix); - - /* Free the cut/copied buffer */ - tile_manager_destroy (float_tiles); - - if (new_tiles) - success = gimp_transform_tool_paste (gimage, drawable, new_tiles, new_layer); - else - success = FALSE; - - /* push the undo group end */ - undo_push_group_end (gimage); - } - else - success = FALSE; - } - - return_args = procedural_db_return_args (&scale_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); - - return return_args; -} - -static ProcArg scale_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The affected drawable" - }, - { - GIMP_PDB_INT32, - "interpolation", - "Whether to use interpolation" - }, - { - GIMP_PDB_FLOAT, - "x0", - "The new x coordinate of upper-left corner of newly scaled region" - }, - { - GIMP_PDB_FLOAT, - "y0", - "The new y coordinate of upper-left corner of newly scaled region" - }, - { - GIMP_PDB_FLOAT, - "x1", - "The new x coordinate of lower-right corner of newly scaled region" - }, - { - GIMP_PDB_FLOAT, - "y1", - "The new y coordinate of lower-right corner of newly scaled region" - } -}; - -static ProcArg scale_outargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The scaled drawable" - } -}; - -static ProcRecord scale_proc = -{ - "gimp_scale", - "Scale the specified drawable.", - "This tool scales the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then scaled by the specified amount. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting scaled drawable. The return value is the ID of the scaled drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and scaled drawable.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 6, - scale_inargs, - 1, - scale_outargs, - { { scale_invoker } } -}; - -static Argument * -shear_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - gboolean interpolation; - gint32 shear_type; - gdouble magnitude; - GimpImage *gimage; - TileManager *float_tiles, *new_tiles; - gboolean new_layer; - gdouble cx, cy; - gint offset_x, offset_y; - GimpMatrix3 matrix; - - drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); - if (drawable == NULL) - success = FALSE; - - interpolation = args[1].value.pdb_int ? TRUE : FALSE; - - shear_type = args[2].value.pdb_int; - if (shear_type < HORIZONTAL || shear_type > VERTICAL) - success = FALSE; - - magnitude = args[3].value.pdb_float; - - if (success) - { - gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable)); - - /* Start a transform undo group */ - undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); - - /* Cut/Copy from the specified drawable */ - float_tiles = gimp_transform_tool_cut (gimage, drawable, &new_layer); - - tile_manager_get_offsets (float_tiles, &offset_x, &offset_y); - - cx = offset_x + tile_manager_width (float_tiles) / 2.0; - cy = offset_y + tile_manager_height (float_tiles) / 2.0; - - gimp_matrix3_identity (matrix); - gimp_matrix3_translate (matrix, -cx, -cy); - /* Shear matrix */ - shear_type = shear_type == HORIZONTAL ? ORIENTATION_HORIZONTAL : - shear_type == VERTICAL ? ORIENTATION_VERTICAL : - ORIENTATION_UNKNOWN; - - if (shear_type == ORIENTATION_HORIZONTAL) - gimp_matrix3_xshear (matrix, magnitude / tile_manager_height (float_tiles)); - else if (shear_type == ORIENTATION_VERTICAL) - gimp_matrix3_yshear (matrix, magnitude / tile_manager_width (float_tiles)); - - gimp_matrix3_translate (matrix, +cx, +cy); - - /* Shear the buffer */ - new_tiles = gimp_shear_tool_shear (gimage, drawable, NULL, float_tiles, - interpolation, matrix); - - /* Free the cut/copied buffer */ - tile_manager_destroy (float_tiles); - - if (new_tiles) - success = gimp_transform_tool_paste (gimage, drawable, new_tiles, new_layer); - else - success = FALSE; - - /* Push the undo group end */ - undo_push_group_end (gimage); - } - - return_args = procedural_db_return_args (&shear_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); - - return return_args; -} - -static ProcArg shear_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The affected drawable" - }, - { - GIMP_PDB_INT32, - "interpolation", - "Whether to use interpolation" - }, - { - GIMP_PDB_INT32, - "shear_type", - "Type of shear: HORIZONTAL (0) or VERTICAL (1)" - }, - { - GIMP_PDB_FLOAT, - "magnitude", - "The magnitude of the shear" - } -}; - -static ProcArg shear_outargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The sheared drawable" - } -}; - -static ProcRecord shear_proc = -{ - "gimp_shear", - "Shear the specified drawable about its center by the specified magnitude.", - "This tool shears the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then sheard by the specified amount. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting sheared drawable. The return value is the ID of the sheard drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and sheard drawable. The shear type parameter indicates whether the shear will be applied horizontally or vertically. The magnitude can be either positive or negative and indicates the extent (in pixels) to shear by.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 4, - shear_inargs, - 1, - shear_outargs, - { { shear_invoker } } -}; - static Argument * smudge_invoker (Gimp *gimp, Argument *args) @@ -2296,158 +1609,3 @@ static ProcRecord smudge_default_proc = NULL, { { smudge_default_invoker } } }; - -static Argument * -transform_2d_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - gboolean interpolation; - gdouble source_x; - gdouble source_y; - gdouble scale_x; - gdouble scale_y; - gdouble angle; - gdouble dest_x; - gdouble dest_y; - GimpImage *gimage; - TileManager *float_tiles, *new_tiles; - gboolean new_layer; - GimpMatrix3 matrix; - - drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); - if (drawable == NULL) - success = FALSE; - - interpolation = args[1].value.pdb_int ? TRUE : FALSE; - - source_x = args[2].value.pdb_float; - - source_y = args[3].value.pdb_float; - - scale_x = args[4].value.pdb_float; - - scale_y = args[5].value.pdb_float; - - angle = args[6].value.pdb_float; - - dest_x = args[7].value.pdb_float; - - dest_y = args[8].value.pdb_float; - - if (success) - { - gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable)); - - /* Start a transform undo group */ - undo_push_group_start (gimage, TRANSFORM_CORE_UNDO); - - /* Cut/Copy from the specified drawable */ - float_tiles = gimp_transform_tool_cut (gimage, drawable, &new_layer); - - /* 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); - - /* Transform the buffer */ - new_tiles = gimp_transform_tool_do (gimage, drawable, float_tiles, - interpolation, matrix, NULL, NULL); - - /* Free the cut/copied buffer */ - tile_manager_destroy (float_tiles); - - if (new_tiles) - success = gimp_transform_tool_paste (gimage, drawable, new_tiles, new_layer); - else - success = FALSE; - - /* Push the undo group end */ - undo_push_group_end (gimage); - } - - return_args = procedural_db_return_args (&transform_2d_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); - - return return_args; -} - -static ProcArg transform_2d_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The affected drawable" - }, - { - GIMP_PDB_INT32, - "interpolation", - "Whether to use interpolation" - }, - { - GIMP_PDB_FLOAT, - "source_x", - "X coordinate of the transformation center" - }, - { - GIMP_PDB_FLOAT, - "source_y", - "Y coordinate of the transformation center" - }, - { - GIMP_PDB_FLOAT, - "scale_x", - "Amount to scale in x direction" - }, - { - GIMP_PDB_FLOAT, - "scale_y", - "Amount to scale in y direction" - }, - { - GIMP_PDB_FLOAT, - "angle", - "The angle of rotation (radians)" - }, - { - GIMP_PDB_FLOAT, - "dest_x", - "X coordinate of where the centre goes" - }, - { - GIMP_PDB_FLOAT, - "dest_y", - "Y coordinate of where the centre goes" - } -}; - -static ProcArg transform_2d_outargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The transformed drawable" - } -}; - -static ProcRecord transform_2d_proc = -{ - "gimp_transform_2d", - "Transform the specified drawable in 2d.", - "This tool transforms the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then transformed. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting drawable. The transformation is done by scaling the image by the x and y scale factors about the point (source_x, source_y), then rotating around the same point, then translating that point to the new position (dest_x, dest_y). The return value is the ID of the rotated drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and transformed drawable.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 9, - transform_2d_inargs, - 1, - transform_2d_outargs, - { { transform_2d_invoker } } -}; diff --git a/app/pdb/transform_tools_cmds.c b/app/pdb/transform_tools_cmds.c new file mode 100644 index 0000000000..b98317989a --- /dev/null +++ b/app/pdb/transform_tools_cmds.c @@ -0,0 +1,723 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* NOTE: This file is autogenerated by pdbgen.pl. */ + +#include "config.h" + + +#include + +#include "libgimpbase/gimpbasetypes.h" + +#include "pdb-types.h" +#include "procedural_db.h" + +#include "core/core-types.h" +#include "core/gimpdrawable-transform-utils.h" +#include "core/gimpdrawable-transform.h" +#include "core/gimpdrawable.h" + +#include "libgimpmath/gimpmath.h" + +static ProcRecord flip_proc; +static ProcRecord perspective_proc; +static ProcRecord rotate_proc; +static ProcRecord scale_proc; +static ProcRecord shear_proc; +static ProcRecord transform_2d_proc; + +void +register_transform_tools_procs (Gimp *gimp) +{ + procedural_db_register (gimp, &flip_proc); + procedural_db_register (gimp, &perspective_proc); + procedural_db_register (gimp, &rotate_proc); + procedural_db_register (gimp, &scale_proc); + procedural_db_register (gimp, &shear_proc); + procedural_db_register (gimp, &transform_2d_proc); +} + +static Argument * +flip_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + gint32 flip_type; + + drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); + if (drawable == NULL) + success = FALSE; + + flip_type = args[1].value.pdb_int; + if (flip_type < HORIZONTAL || flip_type > VERTICAL) + success = FALSE; + + if (success) + { + flip_type = flip_type == HORIZONTAL ? ORIENTATION_HORIZONTAL : + flip_type == VERTICAL ? ORIENTATION_VERTICAL : + ORIENTATION_UNKNOWN; + + success = gimp_drawable_transform_flip (drawable, flip_type); + } + + return_args = procedural_db_return_args (&flip_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); + + return return_args; +} + +static ProcArg flip_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The affected drawable" + }, + { + GIMP_PDB_INT32, + "flip_type", + "Type of flip: HORIZONTAL (0) or VERTICAL (1)" + } +}; + +static ProcArg flip_outargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The flipped drawable" + } +}; + +static ProcRecord flip_proc = +{ + "gimp_flip", + "Flip the specified drawable about its center either vertically or horizontally.", + "This tool flips the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then flipd by the specified amount. The return value is the ID of the flipped drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and flipped drawable. The flip type parameter indicates whether the flip will be applied horizontally or vertically.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 2, + flip_inargs, + 1, + flip_outargs, + { { flip_invoker } } +}; + +static Argument * +perspective_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + gboolean interpolation; + gint x1, y1, x2, y2; + gdouble trans_info[8]; + GimpMatrix3 matrix; + + drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); + if (drawable == NULL) + success = FALSE; + + interpolation = args[1].value.pdb_int ? TRUE : FALSE; + + trans_info[X0] = args[2].value.pdb_float; + + trans_info[Y0] = args[3].value.pdb_float; + + trans_info[X1] = args[4].value.pdb_float; + + trans_info[Y1] = args[5].value.pdb_float; + + trans_info[X2] = args[6].value.pdb_float; + + trans_info[Y2] = args[7].value.pdb_float; + + trans_info[X3] = args[8].value.pdb_float; + + trans_info[Y3] = args[9].value.pdb_float; + + if (success) + { + gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + + /* Assemble the transformation matrix */ + gimp_drawable_transform_matrix_perspective (x1, y1, x2, y2, + 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); + + /* Perspective the selection */ + success = gimp_drawable_transform_affine (drawable, + interpolation, + FALSE, + matrix, + GIMP_TRANSFORM_FORWARD); + } + + return_args = procedural_db_return_args (&perspective_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); + + return return_args; +} + +static ProcArg perspective_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The affected drawable" + }, + { + GIMP_PDB_INT32, + "interpolation", + "Whether to use interpolation" + }, + { + GIMP_PDB_FLOAT, + "x0", + "The new x coordinate of upper-left corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "y0", + "The new y coordinate of upper-left corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "x1", + "The new x coordinate of upper-right corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "y1", + "The new y coordinate of upper-right corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "x2", + "The new x coordinate of lower-left corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "y2", + "The new y coordinate of lower-left corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "x3", + "The new x coordinate of lower-right corner of original bounding box" + }, + { + GIMP_PDB_FLOAT, + "y3", + "The new y coordinate of lower-right corner of original bounding box" + } +}; + +static ProcArg perspective_outargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The newly mapped drawable" + } +}; + +static ProcRecord perspective_proc = +{ + "gimp_perspective", + "Perform a possibly non-affine transformation on the specified drawable.", + "This tool performs a possibly non-affine transformation on the specified drawable by allowing the corners of the original bounding box to be arbitrarily remapped to any values. The specified drawable is remapped if no selection exists. However, if a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then remapped as specified. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting remapped drawable. The return value is the ID of the remapped drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and remapped drawable. The 4 coordinates specify the new locations of each corner of the original bounding box. By specifying these values, any affine transformation (rotation, scaling, translation) can be affected. Additionally," + "these values can be specified such that the resulting transformed drawable will appear to have been projected via a perspective transform.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 10, + perspective_inargs, + 1, + perspective_outargs, + { { perspective_invoker } } +}; + +static Argument * +rotate_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + gboolean interpolation; + gdouble angle; + gint x1, y1, x2, y2; + GimpMatrix3 matrix; + + drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); + if (drawable == NULL) + success = FALSE; + + interpolation = args[1].value.pdb_int ? TRUE : FALSE; + + angle = args[2].value.pdb_float; + + if (success) + { + gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + + /* Assemble the transformation matrix */ + gimp_drawable_transform_matrix_rotate (x1, y1, x2, y2, + angle, + matrix); + + /* Rotate the selection */ + success = gimp_drawable_transform_affine (drawable, + interpolation, + FALSE, + matrix, + GIMP_TRANSFORM_FORWARD); + } + + return_args = procedural_db_return_args (&rotate_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); + + return return_args; +} + +static ProcArg rotate_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The affected drawable" + }, + { + GIMP_PDB_INT32, + "interpolation", + "Whether to use interpolation" + }, + { + GIMP_PDB_FLOAT, + "angle", + "The angle of rotation (radians)" + } +}; + +static ProcArg rotate_outargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The rotated drawable" + } +}; + +static ProcRecord rotate_proc = +{ + "gimp_rotate", + "Rotate the specified drawable about its center through the specified angle.", + "This tool rotates the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then rotated by the specified amount. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting rotated drawable. The return value is the ID of the rotated drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and rotated drawable.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 3, + rotate_inargs, + 1, + rotate_outargs, + { { rotate_invoker } } +}; + +static Argument * +scale_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + gboolean interpolation; + gint x1, y1, x2, y2; + gdouble trans_info[4]; + GimpMatrix3 matrix; + + drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); + if (drawable == NULL) + success = FALSE; + + interpolation = args[1].value.pdb_int ? TRUE : FALSE; + + trans_info[X0] = args[2].value.pdb_float; + + trans_info[Y0] = args[3].value.pdb_float; + + trans_info[X1] = args[4].value.pdb_float; + + trans_info[Y1] = args[5].value.pdb_float; + + if (success) + { + if (trans_info[X0] < trans_info[X1] && + trans_info[Y0] < trans_info[X1]) + { + gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + + /* Assemble the transformation matrix */ + gimp_drawable_transform_matrix_scale (x1, y1, x2, y2, + trans_info[X0], + trans_info[Y0], + trans_info[X1], + trans_info[Y1], + matrix); + + /* Scale the selection */ + success = gimp_drawable_transform_affine (drawable, + interpolation, + FALSE, + matrix, + GIMP_TRANSFORM_FORWARD); + } + else + { + success = FALSE; + } + } + + return_args = procedural_db_return_args (&scale_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); + + return return_args; +} + +static ProcArg scale_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The affected drawable" + }, + { + GIMP_PDB_INT32, + "interpolation", + "Whether to use interpolation" + }, + { + GIMP_PDB_FLOAT, + "x0", + "The new x coordinate of upper-left corner of newly scaled region" + }, + { + GIMP_PDB_FLOAT, + "y0", + "The new y coordinate of upper-left corner of newly scaled region" + }, + { + GIMP_PDB_FLOAT, + "x1", + "The new x coordinate of lower-right corner of newly scaled region" + }, + { + GIMP_PDB_FLOAT, + "y1", + "The new y coordinate of lower-right corner of newly scaled region" + } +}; + +static ProcArg scale_outargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The scaled drawable" + } +}; + +static ProcRecord scale_proc = +{ + "gimp_scale", + "Scale the specified drawable.", + "This tool scales the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then scaled by the specified amount. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting scaled drawable. The return value is the ID of the scaled drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and scaled drawable.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 6, + scale_inargs, + 1, + scale_outargs, + { { scale_invoker } } +}; + +static Argument * +shear_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + gboolean interpolation; + gint32 shear_type; + gdouble magnitude; + gint x1, y1, x2, y2; + GimpMatrix3 matrix; + + drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); + if (drawable == NULL) + success = FALSE; + + interpolation = args[1].value.pdb_int ? TRUE : FALSE; + + shear_type = args[2].value.pdb_int; + if (shear_type < HORIZONTAL || shear_type > VERTICAL) + success = FALSE; + + magnitude = args[3].value.pdb_float; + + if (success) + { + gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); + + shear_type = shear_type == HORIZONTAL ? ORIENTATION_HORIZONTAL : + shear_type == VERTICAL ? ORIENTATION_VERTICAL : + ORIENTATION_UNKNOWN; + + /* Assemble the transformation matrix */ + gimp_drawable_transform_matrix_shear (x1, y1, x2, y2, + shear_type, + magnitude, + matrix); + + /* Shear the selection */ + success = gimp_drawable_transform_affine (drawable, + interpolation, + FALSE, + matrix, + GIMP_TRANSFORM_FORWARD); + } + + return_args = procedural_db_return_args (&shear_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); + + return return_args; +} + +static ProcArg shear_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The affected drawable" + }, + { + GIMP_PDB_INT32, + "interpolation", + "Whether to use interpolation" + }, + { + GIMP_PDB_INT32, + "shear_type", + "Type of shear: HORIZONTAL (0) or VERTICAL (1)" + }, + { + GIMP_PDB_FLOAT, + "magnitude", + "The magnitude of the shear" + } +}; + +static ProcArg shear_outargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The sheared drawable" + } +}; + +static ProcRecord shear_proc = +{ + "gimp_shear", + "Shear the specified drawable about its center by the specified magnitude.", + "This tool shears the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then sheard by the specified amount. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting sheared drawable. The return value is the ID of the sheard drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and sheard drawable. The shear type parameter indicates whether the shear will be applied horizontally or vertically. The magnitude can be either positive or negative and indicates the extent (in pixels) to shear by.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 4, + shear_inargs, + 1, + shear_outargs, + { { shear_invoker } } +}; + +static Argument * +transform_2d_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + gboolean interpolation; + gdouble source_x; + gdouble source_y; + gdouble scale_x; + gdouble scale_y; + gdouble angle; + gdouble dest_x; + gdouble dest_y; + GimpMatrix3 matrix; + + drawable = gimp_drawable_get_by_ID (gimp, args[0].value.pdb_int); + if (drawable == NULL) + success = FALSE; + + interpolation = args[1].value.pdb_int ? TRUE : FALSE; + + source_x = args[2].value.pdb_float; + + source_y = args[3].value.pdb_float; + + scale_x = args[4].value.pdb_float; + + scale_y = args[5].value.pdb_float; + + angle = args[6].value.pdb_float; + + dest_x = args[7].value.pdb_float; + + dest_y = args[8].value.pdb_float; + + if (success) + { + /* 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); + + /* Transform the selection */ + success = gimp_drawable_transform_affine (drawable, + interpolation, + FALSE, + matrix, + GIMP_TRANSFORM_FORWARD); + } + + return_args = procedural_db_return_args (&transform_2d_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_get_ID (GIMP_DRAWABLE (drawable)); + + return return_args; +} + +static ProcArg transform_2d_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The affected drawable" + }, + { + GIMP_PDB_INT32, + "interpolation", + "Whether to use interpolation" + }, + { + GIMP_PDB_FLOAT, + "source_x", + "X coordinate of the transformation center" + }, + { + GIMP_PDB_FLOAT, + "source_y", + "Y coordinate of the transformation center" + }, + { + GIMP_PDB_FLOAT, + "scale_x", + "Amount to scale in x direction" + }, + { + GIMP_PDB_FLOAT, + "scale_y", + "Amount to scale in y direction" + }, + { + GIMP_PDB_FLOAT, + "angle", + "The angle of rotation (radians)" + }, + { + GIMP_PDB_FLOAT, + "dest_x", + "X coordinate of where the centre goes" + }, + { + GIMP_PDB_FLOAT, + "dest_y", + "Y coordinate of where the centre goes" + } +}; + +static ProcArg transform_2d_outargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The transformed drawable" + } +}; + +static ProcRecord transform_2d_proc = +{ + "gimp_transform_2d", + "Transform the specified drawable in 2d.", + "This tool transforms the specified drawable if no selection exists. If a selection exists, the portion of the drawable which lies under the selection is cut from the drawable and made into a floating selection which is then transformed. The interpolation parameter can be set to TRUE to indicate that either linear or cubic interpolation should be used to smooth the resulting drawable. The transformation is done by scaling the image by the x and y scale factors about the point (source_x, source_y), then rotating around the same point, then translating that point to the new position (dest_x, dest_y). The return value is the ID of the rotated drawable. If there was no selection, this will be equal to the drawable ID supplied as input. Otherwise, this will be the newly created and transformed drawable.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 9, + transform_2d_inargs, + 1, + transform_2d_outargs, + { { transform_2d_invoker } } +};