2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
|
2001-11-20 02:54:13 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-11-20 02:54:13 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-11-20 02:54:13 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-11-20 02:54:13 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl. */
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2012-05-03 09:36:22 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
|
2004-05-07 07:26:45 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2001-11-20 02:54:13 +08:00
|
|
|
#include "pdb-types.h"
|
|
|
|
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
2003-09-16 01:41:18 +08:00
|
|
|
#include "core/gimp-transform-utils.h"
|
2002-02-12 10:31:45 +08:00
|
|
|
#include "core/gimp.h"
|
2011-03-26 05:35:46 +08:00
|
|
|
#include "core/gimpchannel.h"
|
2001-11-20 02:54:13 +08:00
|
|
|
#include "core/gimpdrawable-transform.h"
|
|
|
|
#include "core/gimpdrawable.h"
|
2004-01-26 23:34:47 +08:00
|
|
|
#include "core/gimpimage.h"
|
2008-02-08 01:08:54 +08:00
|
|
|
#include "core/gimpparamspecs.h"
|
2004-08-31 22:17:33 +08:00
|
|
|
#include "core/gimpprogress.h"
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2008-02-08 01:08:54 +08:00
|
|
|
#include "gimppdb.h"
|
|
|
|
#include "gimppdb-utils.h"
|
|
|
|
#include "gimpprocedure.h"
|
2008-04-04 19:15:55 +08:00
|
|
|
#include "internal-procs.h"
|
2006-11-01 03:02:56 +08:00
|
|
|
|
2008-02-08 01:08:54 +08:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static GimpValueArray *
|
2012-05-29 01:55:28 +08:00
|
|
|
flip_invoker (GimpProcedure *procedure,
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
GError **error)
|
2001-11-20 02:54:13 +08:00
|
|
|
{
|
|
|
|
gboolean success = TRUE;
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
gint32 flip_type;
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
|
|
|
|
flip_type = g_value_get_enum (gimp_value_array_index (args, 1));
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
2012-11-09 03:46:18 +08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
|
|
|
GIMP_PDB_ITEM_CONTENT, error);
|
2004-03-27 00:38:44 +08:00
|
|
|
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
if (success &&
|
2010-09-08 03:28:00 +08:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
{
|
2010-09-08 05:43:18 +08:00
|
|
|
gdouble axis;
|
|
|
|
|
|
|
|
gimp_transform_get_flip_axis (x, y, width, height,
|
|
|
|
flip_type, TRUE, &axis);
|
|
|
|
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
|
|
|
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
|
2010-09-16 06:36:03 +08:00
|
|
|
{
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_drawable_transform_flip (drawable, context,
|
|
|
|
flip_type, axis, FALSE))
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_item_flip (GIMP_ITEM (drawable), context,
|
|
|
|
flip_type, axis, FALSE);
|
2010-09-16 06:36:03 +08:00
|
|
|
}
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
}
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
|
|
|
error ? *error : NULL);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2006-03-28 05:09:32 +08:00
|
|
|
return return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static GimpValueArray *
|
2012-05-29 01:55:28 +08:00
|
|
|
perspective_invoker (GimpProcedure *procedure,
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
GError **error)
|
2001-11-20 02:54:13 +08:00
|
|
|
{
|
|
|
|
gboolean success = TRUE;
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
gboolean interpolation;
|
2006-03-15 20:49:25 +08:00
|
|
|
gdouble x0;
|
|
|
|
gdouble y0;
|
|
|
|
gdouble x1;
|
|
|
|
gdouble y1;
|
|
|
|
gdouble x2;
|
|
|
|
gdouble y2;
|
|
|
|
gdouble x3;
|
|
|
|
gdouble y3;
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
|
|
|
|
interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
|
|
|
|
x0 = g_value_get_double (gimp_value_array_index (args, 2));
|
|
|
|
y0 = g_value_get_double (gimp_value_array_index (args, 3));
|
|
|
|
x1 = g_value_get_double (gimp_value_array_index (args, 4));
|
|
|
|
y1 = g_value_get_double (gimp_value_array_index (args, 5));
|
|
|
|
x2 = g_value_get_double (gimp_value_array_index (args, 6));
|
|
|
|
y2 = g_value_get_double (gimp_value_array_index (args, 7));
|
|
|
|
x3 = g_value_get_double (gimp_value_array_index (args, 8));
|
|
|
|
y3 = g_value_get_double (gimp_value_array_index (args, 9));
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
2012-11-09 03:46:18 +08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
|
|
|
GIMP_PDB_ITEM_CONTENT, error);
|
2004-03-27 00:38:44 +08:00
|
|
|
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
if (success &&
|
2010-09-08 03:28:00 +08:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-03-27 00:49:18 +08:00
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 19:11:06 +08:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
2008-11-03 07:03:29 +08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 19:11:06 +08:00
|
|
|
|
|
|
|
x += off_x;
|
|
|
|
y += off_y;
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-22 03:10:11 +08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
gimp_transform_matrix_perspective (&matrix,
|
|
|
|
x, y, width, height,
|
2006-05-23 19:11:06 +08:00
|
|
|
x0, y0, x1, y1,
|
|
|
|
x2, y2, x3, y3);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
if (progress)
|
2005-10-01 01:50:50 +08:00
|
|
|
gimp_progress_start (progress, _("Perspective"), FALSE);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
|
|
|
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
|
|
|
|
{
|
|
|
|
if (! gimp_drawable_transform_affine (drawable, context,
|
|
|
|
&matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation_type, 3,
|
|
|
|
FALSE, progress))
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-09-16 06:36:03 +08:00
|
|
|
{
|
2011-03-26 05:35:46 +08:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation, 3,
|
|
|
|
FALSE, progress);
|
2010-09-16 06:36:03 +08:00
|
|
|
}
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2004-03-27 00:49:18 +08:00
|
|
|
}
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
|
|
|
error ? *error : NULL);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2006-03-28 05:09:32 +08:00
|
|
|
return return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static GimpValueArray *
|
2012-05-29 01:55:28 +08:00
|
|
|
rotate_invoker (GimpProcedure *procedure,
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
GError **error)
|
2001-11-20 02:54:13 +08:00
|
|
|
{
|
|
|
|
gboolean success = TRUE;
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
gboolean interpolation;
|
|
|
|
gdouble angle;
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
|
|
|
|
interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
|
|
|
|
angle = g_value_get_double (gimp_value_array_index (args, 2));
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
2012-11-09 03:46:18 +08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
|
|
|
GIMP_PDB_ITEM_CONTENT, error);
|
2004-03-27 00:38:44 +08:00
|
|
|
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
if (success &&
|
2010-09-08 03:28:00 +08:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-03-27 00:49:18 +08:00
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 19:11:06 +08:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
2008-11-03 07:03:29 +08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 19:11:06 +08:00
|
|
|
|
|
|
|
x += off_x;
|
|
|
|
y += off_y;
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-22 03:10:11 +08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
gimp_transform_matrix_rotate_rect (&matrix,
|
2006-05-23 19:11:06 +08:00
|
|
|
x, y, width, height,
|
|
|
|
angle);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
if (progress)
|
2005-10-01 01:50:50 +08:00
|
|
|
gimp_progress_start (progress, _("Rotating"), FALSE);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
|
|
|
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
|
|
|
|
{
|
|
|
|
if (! gimp_drawable_transform_affine (drawable, context,
|
|
|
|
&matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation_type, 3,
|
|
|
|
FALSE, progress))
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-09-16 06:36:03 +08:00
|
|
|
{
|
2011-03-26 05:35:46 +08:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation, 3,
|
|
|
|
FALSE, progress);
|
2010-09-16 06:36:03 +08:00
|
|
|
}
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2004-03-27 00:49:18 +08:00
|
|
|
}
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
|
|
|
error ? *error : NULL);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2006-03-28 05:09:32 +08:00
|
|
|
return return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static GimpValueArray *
|
2012-05-29 01:55:28 +08:00
|
|
|
scale_invoker (GimpProcedure *procedure,
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
GError **error)
|
2001-11-20 02:54:13 +08:00
|
|
|
{
|
|
|
|
gboolean success = TRUE;
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
gboolean interpolation;
|
2006-03-15 20:49:25 +08:00
|
|
|
gdouble x0;
|
|
|
|
gdouble y0;
|
|
|
|
gdouble x1;
|
|
|
|
gdouble y1;
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
|
|
|
|
interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
|
|
|
|
x0 = g_value_get_double (gimp_value_array_index (args, 2));
|
|
|
|
y0 = g_value_get_double (gimp_value_array_index (args, 3));
|
|
|
|
x1 = g_value_get_double (gimp_value_array_index (args, 4));
|
|
|
|
y1 = g_value_get_double (gimp_value_array_index (args, 5));
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
2012-11-09 03:46:18 +08:00
|
|
|
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
|
|
|
GIMP_PDB_ITEM_CONTENT, error) &&
|
2006-03-15 20:49:25 +08:00
|
|
|
x0 < x1 && y0 < y1);
|
2004-03-27 00:38:44 +08:00
|
|
|
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
if (success &&
|
2010-09-08 03:28:00 +08:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-03-27 00:49:18 +08:00
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 19:11:06 +08:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
2008-11-03 07:03:29 +08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 19:11:06 +08:00
|
|
|
|
|
|
|
x += off_x;
|
|
|
|
y += off_y;
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-22 03:10:11 +08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
gimp_transform_matrix_scale (&matrix,
|
|
|
|
x, y, width, height,
|
2006-05-23 19:11:06 +08:00
|
|
|
x0, y0, x1 - x0, y1 - y0);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
if (progress)
|
2005-10-01 01:50:50 +08:00
|
|
|
gimp_progress_start (progress, _("Scaling"), FALSE);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
|
|
|
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
|
2010-09-16 06:36:03 +08:00
|
|
|
{
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_drawable_transform_affine (drawable, context,
|
|
|
|
&matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation_type, 3,
|
|
|
|
FALSE, progress))
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation, 3,
|
|
|
|
FALSE, progress);
|
2010-09-16 06:36:03 +08:00
|
|
|
}
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2004-03-27 00:49:18 +08:00
|
|
|
}
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
|
|
|
error ? *error : NULL);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2006-03-28 05:09:32 +08:00
|
|
|
return return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static GimpValueArray *
|
2012-05-29 01:55:28 +08:00
|
|
|
shear_invoker (GimpProcedure *procedure,
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
GError **error)
|
2001-11-20 02:54:13 +08:00
|
|
|
{
|
|
|
|
gboolean success = TRUE;
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
gboolean interpolation;
|
|
|
|
gint32 shear_type;
|
|
|
|
gdouble magnitude;
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
|
|
|
|
interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
|
|
|
|
shear_type = g_value_get_enum (gimp_value_array_index (args, 2));
|
|
|
|
magnitude = g_value_get_double (gimp_value_array_index (args, 3));
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
2012-11-09 03:46:18 +08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
|
|
|
GIMP_PDB_ITEM_CONTENT, error);
|
2004-03-27 00:38:44 +08:00
|
|
|
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
if (success &&
|
2010-09-08 03:28:00 +08:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-03-27 00:49:18 +08:00
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 19:11:06 +08:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
2008-11-03 07:03:29 +08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 19:11:06 +08:00
|
|
|
|
|
|
|
x += off_x;
|
|
|
|
y += off_y;
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-22 03:10:11 +08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
gimp_transform_matrix_shear (&matrix,
|
|
|
|
x, y, width, height,
|
|
|
|
shear_type, magnitude);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
if (progress)
|
2005-10-01 01:50:50 +08:00
|
|
|
gimp_progress_start (progress, _("Shearing"), FALSE);
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
|
|
|
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
|
|
|
|
{
|
|
|
|
if (! gimp_drawable_transform_affine (drawable, context,
|
|
|
|
&matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation_type, 3,
|
|
|
|
FALSE, progress))
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-09-16 06:36:03 +08:00
|
|
|
{
|
2011-03-26 05:35:46 +08:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation, 3,
|
|
|
|
FALSE, progress);
|
2010-09-16 06:36:03 +08:00
|
|
|
}
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
2004-03-27 00:49:18 +08:00
|
|
|
}
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
|
|
|
error ? *error : NULL);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2006-03-28 05:09:32 +08:00
|
|
|
return return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
static GimpValueArray *
|
2012-05-29 01:55:28 +08:00
|
|
|
transform_2d_invoker (GimpProcedure *procedure,
|
2012-05-04 06:50:23 +08:00
|
|
|
Gimp *gimp,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpProgress *progress,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
GError **error)
|
2001-11-20 02:54:13 +08:00
|
|
|
{
|
|
|
|
gboolean success = TRUE;
|
2012-05-04 06:50:23 +08:00
|
|
|
GimpValueArray *return_vals;
|
2001-11-20 02:54:13 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
gboolean interpolation;
|
|
|
|
gdouble source_x;
|
|
|
|
gdouble source_y;
|
|
|
|
gdouble scale_x;
|
|
|
|
gdouble scale_y;
|
|
|
|
gdouble angle;
|
|
|
|
gdouble dest_x;
|
|
|
|
gdouble dest_y;
|
|
|
|
|
2012-05-04 06:50:23 +08:00
|
|
|
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
|
|
|
|
interpolation = g_value_get_boolean (gimp_value_array_index (args, 1));
|
|
|
|
source_x = g_value_get_double (gimp_value_array_index (args, 2));
|
|
|
|
source_y = g_value_get_double (gimp_value_array_index (args, 3));
|
|
|
|
scale_x = g_value_get_double (gimp_value_array_index (args, 4));
|
|
|
|
scale_y = g_value_get_double (gimp_value_array_index (args, 5));
|
|
|
|
angle = g_value_get_double (gimp_value_array_index (args, 6));
|
|
|
|
dest_x = g_value_get_double (gimp_value_array_index (args, 7));
|
|
|
|
dest_y = g_value_get_double (gimp_value_array_index (args, 8));
|
2001-11-20 02:54:13 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2 bounding boxes
2004-10-27 Michael Natterer <mitch@gimp.org>
* app/core/gimp-transform-utils.[ch]. switch from x1,y1,x2,y2
bounding boxes to x,y,width,height ones. Added
gimp_transform_matrix_flip_free(). Renamed some parameters to be
consistent with others. Some internal cleanup.
* app/tools/gimpperspectivetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: changed accordingly.
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/transform_tools.pdb: guard all transform
wrappers with if(gimp_drawable_mask_intersect(...)), also the
ones which don't need the returned bounding box.
* tools/pdbgen/pdb/drawable_transform.pdb: renamed some parameters
and added gimp_drawable_transform_matrix() which takes the 9
coefficients of a 3x3 matrix for ultimate flexibility ;)
* app/pdb/drawable_transform_cmds.c
* app/pdb/internal_procs.c
* app/pdb/transform_tools_cmds.c
* libgimp/gimpdrawabletransform_pdb.[ch]: regenerated.
2004-10-28 01:56:02 +08:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
2012-11-09 03:46:18 +08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
|
|
|
GIMP_PDB_ITEM_CONTENT, error);
|
2004-03-27 00:38:44 +08:00
|
|
|
|
2006-04-05 05:11:45 +08:00
|
|
|
if (success &&
|
2010-09-08 03:28:00 +08:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2006-04-05 05:11:45 +08:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2011-03-26 05:35:46 +08:00
|
|
|
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
|
|
|
|
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
|
|
|
|
{
|
|
|
|
if (! gimp_drawable_transform_affine (drawable, context,
|
|
|
|
&matrix, GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation_type, 3,
|
|
|
|
FALSE, progress))
|
|
|
|
{
|
|
|
|
success = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-09-16 06:36:03 +08:00
|
|
|
{
|
2011-03-26 05:35:46 +08:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
|
|
|
interpolation, 3,
|
|
|
|
FALSE, progress);
|
2010-09-16 06:36:03 +08:00
|
|
|
}
|
2006-04-05 05:11:45 +08:00
|
|
|
|
|
|
|
if (progress)
|
|
|
|
gimp_progress_end (progress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-16 21:57:57 +08:00
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
|
|
|
error ? *error : NULL);
|
2006-04-05 05:11:45 +08:00
|
|
|
|
|
|
|
if (success)
|
2012-05-04 06:50:23 +08:00
|
|
|
gimp_value_set_drawable (gimp_value_array_index (return_vals, 1), drawable);
|
2006-04-05 05:11:45 +08:00
|
|
|
|
|
|
|
return return_vals;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-04-26 17:13:47 +08:00
|
|
|
register_transform_tools_procs (GimpPDB *pdb)
|
2006-04-05 05:11:45 +08:00
|
|
|
{
|
|
|
|
GimpProcedure *procedure;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* gimp-flip
|
|
|
|
*/
|
2006-04-06 18:01:30 +08:00
|
|
|
procedure = gimp_procedure_new (flip_invoker);
|
2008-04-04 18:58:56 +08:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
|
|
|
"gimp-flip");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_set_static_strings (procedure,
|
|
|
|
"gimp-flip",
|
2011-03-26 05:03:14 +08:00
|
|
|
"Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
|
|
|
|
"Deprecated: Use 'gimp-item-transform-flip-simple' instead.",
|
2006-04-05 05:11:45 +08:00
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
2011-03-26 05:03:14 +08:00
|
|
|
"gimp-item-transform-flip-simple");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The affected drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_enum ("flip-type",
|
|
|
|
"flip type",
|
2006-05-19 01:25:15 +08:00
|
|
|
"Type of flip",
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_TYPE_ORIENTATION_TYPE,
|
|
|
|
GIMP_ORIENTATION_HORIZONTAL,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[1]),
|
|
|
|
GIMP_ORIENTATION_UNKNOWN);
|
|
|
|
gimp_procedure_add_return_value (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The flipped drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
2006-04-26 17:13:47 +08:00
|
|
|
gimp_pdb_register_procedure (pdb, procedure);
|
2006-04-07 16:16:26 +08:00
|
|
|
g_object_unref (procedure);
|
2006-04-05 05:11:45 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* gimp-perspective
|
|
|
|
*/
|
2006-04-06 18:01:30 +08:00
|
|
|
procedure = gimp_procedure_new (perspective_invoker);
|
2008-04-04 18:58:56 +08:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
|
|
|
"gimp-perspective");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_set_static_strings (procedure,
|
|
|
|
"gimp-perspective",
|
2011-03-26 05:03:14 +08:00
|
|
|
"Deprecated: Use 'gimp-item-transform-perspective' instead.",
|
|
|
|
"Deprecated: Use 'gimp-item-transform-perspective' instead.",
|
2006-04-05 05:11:45 +08:00
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
2011-03-26 05:03:14 +08:00
|
|
|
"gimp-item-transform-perspective");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The affected drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_boolean ("interpolation",
|
|
|
|
"interpolation",
|
|
|
|
"Whether to use interpolation",
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("x0",
|
|
|
|
"x0",
|
|
|
|
"The new x coordinate of upper-left corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("y0",
|
|
|
|
"y0",
|
|
|
|
"The new y coordinate of upper-left corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("x1",
|
|
|
|
"x1",
|
|
|
|
"The new x coordinate of upper-right corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("y1",
|
|
|
|
"y1",
|
|
|
|
"The new y coordinate of upper-right corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("x2",
|
|
|
|
"x2",
|
|
|
|
"The new x coordinate of lower-left corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("y2",
|
|
|
|
"y2",
|
|
|
|
"The new y coordinate of lower-left corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("x3",
|
|
|
|
"x3",
|
|
|
|
"The new x coordinate of lower-right corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("y3",
|
|
|
|
"y3",
|
|
|
|
"The new y coordinate of lower-right corner of original bounding box",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_return_value (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The newly mapped drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
2006-04-26 17:13:47 +08:00
|
|
|
gimp_pdb_register_procedure (pdb, procedure);
|
2006-04-07 16:16:26 +08:00
|
|
|
g_object_unref (procedure);
|
2006-04-05 05:11:45 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* gimp-rotate
|
|
|
|
*/
|
2006-04-06 18:01:30 +08:00
|
|
|
procedure = gimp_procedure_new (rotate_invoker);
|
2008-04-04 18:58:56 +08:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
|
|
|
"gimp-rotate");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_set_static_strings (procedure,
|
|
|
|
"gimp-rotate",
|
2011-03-26 05:03:14 +08:00
|
|
|
"Deprecated: Use 'gimp-item-transform-rotate' instead.",
|
|
|
|
"Deprecated: Use 'gimp-item-transform-rotate' instead.",
|
2006-04-05 05:11:45 +08:00
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
2011-03-26 05:03:14 +08:00
|
|
|
"gimp-item-transform-rotate");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The affected drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_boolean ("interpolation",
|
|
|
|
"interpolation",
|
|
|
|
"Whether to use interpolation",
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("angle",
|
|
|
|
"angle",
|
|
|
|
"The angle of rotation (radians)",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_return_value (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The rotated drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
2006-04-26 17:13:47 +08:00
|
|
|
gimp_pdb_register_procedure (pdb, procedure);
|
2006-04-07 16:16:26 +08:00
|
|
|
g_object_unref (procedure);
|
2004-03-27 00:49:18 +08:00
|
|
|
|
2006-04-05 05:11:45 +08:00
|
|
|
/*
|
|
|
|
* gimp-scale
|
|
|
|
*/
|
2006-04-06 18:01:30 +08:00
|
|
|
procedure = gimp_procedure_new (scale_invoker);
|
2008-04-04 18:58:56 +08:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
|
|
|
"gimp-scale");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_set_static_strings (procedure,
|
|
|
|
"gimp-scale",
|
2011-03-26 05:03:14 +08:00
|
|
|
"Deprecated: Use 'gimp-item-transform-scale' instead.",
|
|
|
|
"Deprecated: Use 'gimp-item-transform-scale' instead.",
|
2006-04-05 05:11:45 +08:00
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
2011-03-26 05:03:14 +08:00
|
|
|
"gimp-item-transform-scale");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The affected drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_boolean ("interpolation",
|
|
|
|
"interpolation",
|
|
|
|
"Whether to use interpolation",
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("x0",
|
|
|
|
"x0",
|
|
|
|
"The new x coordinate of the upper-left corner of the scaled region",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("y0",
|
|
|
|
"y0",
|
|
|
|
"The new y coordinate of the upper-left corner of the scaled region",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("x1",
|
|
|
|
"x1",
|
|
|
|
"The new x coordinate of the lower-right corner of the scaled region",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("y1",
|
|
|
|
"y1",
|
|
|
|
"The new y coordinate of the lower-right corner of the scaled region",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_return_value (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The scaled drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
2006-04-26 17:13:47 +08:00
|
|
|
gimp_pdb_register_procedure (pdb, procedure);
|
2006-04-07 16:16:26 +08:00
|
|
|
g_object_unref (procedure);
|
2004-08-31 22:17:33 +08:00
|
|
|
|
2006-04-05 05:11:45 +08:00
|
|
|
/*
|
|
|
|
* gimp-shear
|
|
|
|
*/
|
2006-04-06 18:01:30 +08:00
|
|
|
procedure = gimp_procedure_new (shear_invoker);
|
2008-04-04 18:58:56 +08:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
|
|
|
"gimp-shear");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_set_static_strings (procedure,
|
|
|
|
"gimp-shear",
|
2011-03-26 05:03:14 +08:00
|
|
|
"Deprecated: Use 'gimp-item-transform-shear' instead.",
|
|
|
|
"Deprecated: Use 'gimp-item-transform-shear' instead.",
|
2006-04-05 05:11:45 +08:00
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
2011-03-26 05:03:14 +08:00
|
|
|
"gimp-item-transform-shear");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The affected drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_boolean ("interpolation",
|
|
|
|
"interpolation",
|
|
|
|
"Whether to use interpolation",
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_enum ("shear-type",
|
|
|
|
"shear type",
|
2006-05-19 01:25:15 +08:00
|
|
|
"Type of shear",
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_TYPE_ORIENTATION_TYPE,
|
|
|
|
GIMP_ORIENTATION_HORIZONTAL,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
|
|
|
|
GIMP_ORIENTATION_UNKNOWN);
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("magnitude",
|
|
|
|
"magnitude",
|
|
|
|
"The magnitude of the shear",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_return_value (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The sheared drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
2006-04-26 17:13:47 +08:00
|
|
|
gimp_pdb_register_procedure (pdb, procedure);
|
2006-04-07 16:16:26 +08:00
|
|
|
g_object_unref (procedure);
|
2001-11-20 02:54:13 +08:00
|
|
|
|
2006-04-05 05:11:45 +08:00
|
|
|
/*
|
|
|
|
* gimp-transform-2d
|
|
|
|
*/
|
2006-04-06 18:01:30 +08:00
|
|
|
procedure = gimp_procedure_new (transform_2d_invoker);
|
2008-04-04 18:58:56 +08:00
|
|
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
|
|
|
"gimp-transform-2d");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_set_static_strings (procedure,
|
|
|
|
"gimp-transform-2d",
|
2011-03-26 05:03:14 +08:00
|
|
|
"Deprecated: Use 'gimp-item-transform-2d' instead.",
|
|
|
|
"Deprecated: Use 'gimp-item-transform-2d' instead.",
|
2006-04-05 05:11:45 +08:00
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
2011-03-26 05:03:14 +08:00
|
|
|
"gimp-item-transform-2d");
|
2006-04-05 05:11:45 +08:00
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The affected drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_boolean ("interpolation",
|
|
|
|
"interpolation",
|
|
|
|
"Whether to use interpolation",
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("source-x",
|
|
|
|
"source x",
|
|
|
|
"X coordinate of the transformation center",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("source-y",
|
|
|
|
"source y",
|
|
|
|
"Y coordinate of the transformation center",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("scale-x",
|
|
|
|
"scale x",
|
|
|
|
"Amount to scale in x direction",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("scale-y",
|
|
|
|
"scale y",
|
|
|
|
"Amount to scale in y direction",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("angle",
|
|
|
|
"angle",
|
|
|
|
"The angle of rotation (radians)",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("dest-x",
|
|
|
|
"dest x",
|
|
|
|
"X coordinate of where the centre goes",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_argument (procedure,
|
|
|
|
g_param_spec_double ("dest-y",
|
|
|
|
"dest y",
|
|
|
|
"Y coordinate of where the centre goes",
|
|
|
|
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
|
|
GIMP_PARAM_READWRITE));
|
|
|
|
gimp_procedure_add_return_value (procedure,
|
|
|
|
gimp_param_spec_drawable_id ("drawable",
|
|
|
|
"drawable",
|
|
|
|
"The transformed drawable",
|
2006-05-07 02:57:51 +08:00
|
|
|
pdb->gimp, FALSE,
|
2006-04-05 05:11:45 +08:00
|
|
|
GIMP_PARAM_READWRITE));
|
2006-04-26 17:13:47 +08:00
|
|
|
gimp_pdb_register_procedure (pdb, procedure);
|
2006-04-07 16:16:26 +08:00
|
|
|
g_object_unref (procedure);
|
2001-11-20 02:54:13 +08:00
|
|
|
}
|