2006-12-09 13:33:38 -08:00
|
|
|
# GIMP - The GNU Image Manipulation Program
|
1998-10-23 22:21:56 -07:00
|
|
|
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
|
|
2009-01-17 14:28:01 -08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
1998-10-23 22:21:56 -07:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1998-10-23 22:21:56 -07: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
|
2018-07-11 14:47:19 -07:00
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1998-10-23 22:21:56 -07:00
|
|
|
|
|
|
|
|
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
|
|
|
|
|
1999-03-10 10:56:56 -08:00
|
|
|
sub flip {
|
2011-03-25 14:03:14 -07:00
|
|
|
&std_pdb_deprecated ('gimp-item-transform-flip-simple');
|
1999-03-10 10:56:56 -08:00
|
|
|
|
|
|
|
|
@inargs = (
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'drawable', type => 'drawable',
|
|
|
|
|
desc => 'The affected drawable' },
|
2006-03-23 13:17:16 -08:00
|
|
|
{ name => 'flip_type',
|
|
|
|
|
type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
|
2006-05-18 10:25:15 -07:00
|
|
|
desc => 'Type of flip' }
|
1999-03-10 10:56:56 -08:00
|
|
|
);
|
|
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
@outargs = (
|
|
|
|
|
{ name => 'drawable', type => 'drawable', no_declare => 1,
|
|
|
|
|
desc => 'The flipped drawable' }
|
|
|
|
|
);
|
1999-03-10 10:56:56 -08:00
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
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-27 10:56:02 -07:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
2012-11-08 11:46:18 -08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
2012-11-09 02:17:25 -08:00
|
|
|
GIMP_PDB_ITEM_CONTENT |
|
|
|
|
|
GIMP_PDB_ITEM_POSITION, error);
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
if (success &&
|
2010-09-07 12:28:00 -07: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-27 10:56:02 -07:00
|
|
|
{
|
2010-09-07 14:43:18 -07:00
|
|
|
gdouble axis;
|
|
|
|
|
|
|
|
|
|
gimp_transform_get_flip_axis (x, y, width, height,
|
|
|
|
|
flip_type, TRUE, &axis);
|
|
|
|
|
|
2011-03-25 14:35:46 -07: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-15 15:36:03 -07:00
|
|
|
{
|
2011-03-25 14:35:46 -07: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-15 15:36:03 -07: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-27 10:56:02 -07:00
|
|
|
}
|
1999-03-17 15:08:08 -08:00
|
|
|
}
|
1999-07-19 15:42:49 -07:00
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
1999-03-17 15:08:08 -08:00
|
|
|
sub perspective {
|
2011-03-25 14:03:14 -07:00
|
|
|
&std_pdb_deprecated ('gimp-item-transform-perspective');
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
@inargs = (
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'drawable', type => 'drawable',
|
|
|
|
|
desc => 'The affected drawable' },
|
1999-03-17 15:08:08 -08:00
|
|
|
{ name => 'interpolation', type => 'boolean',
|
2006-03-22 09:19:14 -08:00
|
|
|
desc => 'Whether to use interpolation' },
|
|
|
|
|
{ name => 'x0', type => 'float',
|
|
|
|
|
desc => 'The new x coordinate of upper-left corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'y0', type => 'float',
|
|
|
|
|
desc => 'The new y coordinate of upper-left corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'x1', type => 'float',
|
|
|
|
|
desc => 'The new x coordinate of upper-right corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'y1', type => 'float',
|
|
|
|
|
desc => 'The new y coordinate of upper-right corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'x2', type => 'float',
|
|
|
|
|
desc => 'The new x coordinate of lower-left corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'y2', type => 'float',
|
|
|
|
|
desc => 'The new y coordinate of lower-left corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'x3', type => 'float',
|
|
|
|
|
desc => 'The new x coordinate of lower-right corner of original
|
|
|
|
|
bounding box' },
|
|
|
|
|
{ name => 'y3', type => 'float',
|
|
|
|
|
desc => 'The new y coordinate of lower-right corner of original
|
|
|
|
|
bounding box' }
|
1999-03-17 15:08:08 -08:00
|
|
|
);
|
|
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
@outargs = (
|
|
|
|
|
{ name => 'drawable', type => 'drawable', no_declare => 1,
|
|
|
|
|
desc => 'The newly mapped drawable' }
|
|
|
|
|
);
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
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-27 10:56:02 -07:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
2012-11-08 11:46:18 -08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
2012-11-09 02:17:25 -08:00
|
|
|
GIMP_PDB_ITEM_CONTENT |
|
|
|
|
|
GIMP_PDB_ITEM_POSITION, error);
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
if (success &&
|
2010-09-07 12:28:00 -07:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 04:11:06 -07:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
|
2008-11-02 15:03:29 -08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-21 11:10:11 -08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
|
gimp_transform_matrix_perspective (&matrix,
|
|
|
|
|
x, y, width, height,
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
|
|
if (progress)
|
2014-07-12 14:45:20 -07:00
|
|
|
gimp_progress_start (progress, FALSE, _("Perspective"));
|
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-27 10:56:02 -07:00
|
|
|
|
2011-03-25 14:35:46 -07: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,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation_type,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress))
|
|
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-09-15 15:36:03 -07:00
|
|
|
{
|
2011-03-25 14:35:46 -07:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress);
|
2010-09-15 15:36:03 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
|
gimp_progress_end (progress);
|
2004-01-26 07:34:47 -08:00
|
|
|
}
|
1999-03-17 15:08:08 -08:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-20 10:09:01 -07:00
|
|
|
sub rotate {
|
2011-03-25 14:03:14 -07:00
|
|
|
&std_pdb_deprecated ('gimp-item-transform-rotate');
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
@inargs = (
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'drawable', type => 'drawable',
|
|
|
|
|
desc => 'The affected drawable' },
|
1999-03-17 15:08:08 -08:00
|
|
|
{ name => 'interpolation', type => 'boolean',
|
1999-03-20 18:14:08 -08:00
|
|
|
desc => 'Whether to use interpolation' },
|
1999-03-17 15:08:08 -08:00
|
|
|
{ name => 'angle', type => 'float',
|
|
|
|
|
desc => 'The angle of rotation (radians)' }
|
|
|
|
|
);
|
|
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
@outargs = (
|
|
|
|
|
{ name => 'drawable', type => 'drawable', no_declare => 1,
|
|
|
|
|
desc => 'The rotated drawable' }
|
|
|
|
|
);
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
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-27 10:56:02 -07:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
2012-11-08 11:46:18 -08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
2012-11-09 02:17:25 -08:00
|
|
|
GIMP_PDB_ITEM_CONTENT |
|
|
|
|
|
GIMP_PDB_ITEM_POSITION, error);
|
1999-03-17 15:08:08 -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-27 10:56:02 -07:00
|
|
|
if (success &&
|
2010-09-07 12:28:00 -07:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 04:11:06 -07:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
|
2008-11-02 15:03:29 -08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-21 11:10:11 -08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
|
gimp_transform_matrix_rotate_rect (&matrix,
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
|
|
if (progress)
|
2014-07-12 14:45:20 -07:00
|
|
|
gimp_progress_start (progress, FALSE, _("Rotating"));
|
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-27 10:56:02 -07:00
|
|
|
|
2011-03-25 14:35:46 -07: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,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation_type,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress))
|
|
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-09-15 15:36:03 -07:00
|
|
|
{
|
2011-03-25 14:35:46 -07:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress);
|
2010-09-15 15:36:03 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
|
gimp_progress_end (progress);
|
2004-01-26 07:34:47 -08:00
|
|
|
}
|
1999-03-17 15:08:08 -08:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub scale {
|
2011-03-25 14:03:14 -07:00
|
|
|
&std_pdb_deprecated ('gimp-item-transform-scale');
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
@inargs = (
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'drawable', type => 'drawable',
|
|
|
|
|
desc => 'The affected drawable' },
|
1999-03-17 15:08:08 -08:00
|
|
|
{ name => 'interpolation', type => 'boolean',
|
2006-03-14 13:35:50 -08:00
|
|
|
desc => 'Whether to use interpolation' },
|
|
|
|
|
{ name => 'x0', type => 'float',
|
|
|
|
|
desc => 'The new x coordinate of the upper-left corner of the
|
2006-03-15 04:49:25 -08:00
|
|
|
scaled region' },
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'y0', type => 'float',
|
|
|
|
|
desc => 'The new y coordinate of the upper-left corner of the
|
2006-03-15 04:49:25 -08:00
|
|
|
scaled region' },
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'x1', type => 'float',
|
|
|
|
|
desc => 'The new x coordinate of the lower-right corner of the
|
2006-03-15 04:49:25 -08:00
|
|
|
scaled region' },
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'y1', type => 'float',
|
|
|
|
|
desc => 'The new y coordinate of the lower-right corner of the
|
2006-03-15 04:49:25 -08:00
|
|
|
scaled region' }
|
1999-03-17 15:08:08 -08:00
|
|
|
);
|
|
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
@outargs = (
|
|
|
|
|
{ name => 'drawable', type => 'drawable', no_declare => 1,
|
|
|
|
|
desc => 'The scaled drawable' }
|
|
|
|
|
);
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
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-27 10:56:02 -07:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
2012-11-08 11:46:18 -08:00
|
|
|
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
2012-11-09 02:17:25 -08:00
|
|
|
GIMP_PDB_ITEM_CONTENT |
|
|
|
|
|
GIMP_PDB_ITEM_POSITION, error) &&
|
2006-03-15 04:49:25 -08:00
|
|
|
x0 < x1 && y0 < y1);
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
if (success &&
|
2010-09-07 12:28:00 -07:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
1999-03-17 15:08:08 -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-27 10:56:02 -07:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 04:11:06 -07:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
|
2008-11-02 15:03:29 -08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-21 11:10:11 -08:00
|
|
|
gimp_matrix3_identity (&matrix);
|
|
|
|
|
gimp_transform_matrix_scale (&matrix,
|
|
|
|
|
x, y, width, height,
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
|
|
if (progress)
|
2014-07-12 14:45:20 -07:00
|
|
|
gimp_progress_start (progress, FALSE, _("Scaling"));
|
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-27 10:56:02 -07:00
|
|
|
|
2011-03-25 14:35:46 -07: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-15 15:36:03 -07:00
|
|
|
{
|
2011-03-25 14:35:46 -07:00
|
|
|
if (! gimp_drawable_transform_affine (drawable, context,
|
|
|
|
|
&matrix,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation_type,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress))
|
|
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress);
|
2010-09-15 15:36:03 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
|
gimp_progress_end (progress);
|
1999-03-17 15:08:08 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub shear {
|
2011-03-25 14:03:14 -07:00
|
|
|
&std_pdb_deprecated ('gimp-item-transform-shear');
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
@inargs = (
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'drawable', type => 'drawable',
|
|
|
|
|
desc => 'The affected drawable' },
|
1999-03-17 15:08:08 -08:00
|
|
|
{ name => 'interpolation', type => 'boolean',
|
1999-03-20 18:14:08 -08:00
|
|
|
desc => 'Whether to use interpolation' },
|
2006-03-23 13:17:16 -08:00
|
|
|
{ name => 'shear_type',
|
|
|
|
|
type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
|
2006-05-18 10:25:15 -07:00
|
|
|
desc => 'Type of shear' },
|
1999-03-17 15:08:08 -08:00
|
|
|
{ name => 'magnitude', type => 'float',
|
|
|
|
|
desc => 'The magnitude of the shear' }
|
|
|
|
|
);
|
|
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
@outargs = (
|
|
|
|
|
{ name => 'drawable', type => 'drawable', no_declare => 1,
|
|
|
|
|
desc => 'The sheared drawable' }
|
|
|
|
|
);
|
1999-03-17 15:08:08 -08:00
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
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-27 10:56:02 -07:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
2012-11-08 11:46:18 -08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
2012-11-09 02:17:25 -08:00
|
|
|
GIMP_PDB_ITEM_CONTENT |
|
|
|
|
|
GIMP_PDB_ITEM_POSITION, error);
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
if (success &&
|
2010-09-07 12:28:00 -07:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
GimpMatrix3 matrix;
|
|
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2006-05-23 04:11:06 -07:00
|
|
|
gint off_x, off_y;
|
|
|
|
|
|
2008-11-02 15:03:29 -08:00
|
|
|
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
2006-05-23 04:11:06 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
/* Assemble the transformation matrix */
|
2005-03-21 11: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (interpolation)
|
|
|
|
|
interpolation_type = gimp->config->interpolation_type;
|
|
|
|
|
|
|
|
|
|
if (progress)
|
2014-07-12 14:45:20 -07:00
|
|
|
gimp_progress_start (progress, FALSE, _("Shearing"));
|
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-27 10:56:02 -07:00
|
|
|
|
2011-03-25 14:35:46 -07: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,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation_type,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress))
|
|
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-09-15 15:36:03 -07:00
|
|
|
{
|
2011-03-25 14:35:46 -07:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress);
|
2010-09-15 15:36:03 -07: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-27 10:56:02 -07:00
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
|
gimp_progress_end (progress);
|
2004-01-26 07:34:47 -08:00
|
|
|
}
|
1999-03-17 15:08:08 -08:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-24 08:22:57 -07:00
|
|
|
sub transform_2d {
|
2011-03-25 14:03:14 -07:00
|
|
|
&std_pdb_deprecated ('gimp-item-transform-2d');
|
2000-04-24 08:22:57 -07:00
|
|
|
|
|
|
|
|
@inargs = (
|
2006-03-14 13:35:50 -08:00
|
|
|
{ name => 'drawable', type => 'drawable',
|
|
|
|
|
desc => 'The affected drawable' },
|
2000-04-24 08:22:57 -07:00
|
|
|
{ name => 'interpolation', type => 'boolean',
|
|
|
|
|
desc => 'Whether to use interpolation' },
|
|
|
|
|
{ name => 'source_x', type => 'float',
|
|
|
|
|
desc => 'X coordinate of the transformation center' },
|
|
|
|
|
{ name => 'source_y', type => 'float',
|
|
|
|
|
desc => 'Y coordinate of the transformation center' },
|
|
|
|
|
{ name => 'scale_x', type => 'float',
|
|
|
|
|
desc => 'Amount to scale in x direction' },
|
|
|
|
|
{ name => 'scale_y', type => 'float',
|
|
|
|
|
desc => 'Amount to scale in y direction' },
|
|
|
|
|
{ name => 'angle', type => 'float',
|
|
|
|
|
desc => 'The angle of rotation (radians)' },
|
|
|
|
|
{ name => 'dest_x', type => 'float',
|
|
|
|
|
desc => 'X coordinate of where the centre goes' },
|
|
|
|
|
{ name => 'dest_y', type => 'float',
|
|
|
|
|
desc => 'Y coordinate of where the centre goes' }
|
|
|
|
|
);
|
|
|
|
|
|
2006-03-14 13:35:50 -08:00
|
|
|
@outargs = (
|
|
|
|
|
{ name => 'drawable', type => 'drawable', no_declare => 1,
|
|
|
|
|
desc => 'The transformed drawable' }
|
|
|
|
|
);
|
2000-04-24 08:22:57 -07:00
|
|
|
|
|
|
|
|
%invoke = (
|
|
|
|
|
code => <<'CODE'
|
|
|
|
|
{
|
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-27 10:56:02 -07:00
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
2012-11-08 11:46:18 -08:00
|
|
|
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
2012-11-09 02:17:25 -08:00
|
|
|
GIMP_PDB_ITEM_CONTENT |
|
|
|
|
|
GIMP_PDB_ITEM_POSITION, error);
|
2004-01-26 07:34:47 -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-27 10:56:02 -07:00
|
|
|
if (success &&
|
2010-09-07 12:28:00 -07:00
|
|
|
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
2004-01-26 07:34:47 -08:00
|
|
|
{
|
|
|
|
|
GimpMatrix3 matrix;
|
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-27 10:56:02 -07:00
|
|
|
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
2004-01-26 07:34:47 -08:00
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
|
2004-08-31 07:17:33 -07:00
|
|
|
if (progress)
|
2014-07-12 14:45:20 -07:00
|
|
|
gimp_progress_start (progress, FALSE, _("2D Transform"));
|
2004-08-31 07:17:33 -07:00
|
|
|
|
2011-03-25 14:35:46 -07: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,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation_type,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress))
|
|
|
|
|
{
|
|
|
|
|
success = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2010-09-15 15:36:03 -07:00
|
|
|
{
|
2011-03-25 14:35:46 -07:00
|
|
|
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
|
|
|
|
|
GIMP_TRANSFORM_FORWARD,
|
2013-05-30 16:15:32 -07:00
|
|
|
interpolation,
|
2011-03-25 14:35:46 -07:00
|
|
|
FALSE, progress);
|
2010-09-15 15:36:03 -07:00
|
|
|
}
|
2004-08-31 07:17:33 -07:00
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
|
gimp_progress_end (progress);
|
2004-01-26 07:34:47 -08:00
|
|
|
}
|
2000-04-24 08:22:57 -07:00
|
|
|
}
|
|
|
|
|
CODE
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-23 13:17:16 -08:00
|
|
|
|
2008-02-04 09:12:25 -08:00
|
|
|
@headers = qw("libgimpmath/gimpmath.h"
|
|
|
|
|
"config/gimpcoreconfig.h"
|
|
|
|
|
"core/gimp.h"
|
2011-03-25 14:35:46 -07:00
|
|
|
"core/gimpchannel.h"
|
2008-02-04 09:12:25 -08:00
|
|
|
"core/gimp-transform-utils.h"
|
|
|
|
|
"core/gimpimage.h"
|
|
|
|
|
"core/gimpdrawable.h"
|
|
|
|
|
"core/gimpdrawable-transform.h"
|
2004-08-31 07:17:33 -07:00
|
|
|
"core/gimpprogress.h"
|
2008-02-04 09:12:25 -08:00
|
|
|
"gimppdb-utils.h"
|
2004-08-31 07:17:33 -07:00
|
|
|
"gimp-intl.h");
|
1999-04-30 14:11:27 -07:00
|
|
|
|
2008-02-07 09:08:54 -08:00
|
|
|
@procs = qw(flip
|
|
|
|
|
perspective
|
|
|
|
|
rotate
|
|
|
|
|
scale
|
|
|
|
|
shear
|
|
|
|
|
transform_2d);
|
2001-10-22 05:13:44 -07:00
|
|
|
|
2000-06-01 05:20:13 -07:00
|
|
|
%exports = (app => [@procs], lib => [@procs]);
|
1999-03-17 15:08:08 -08:00
|
|
|
|
2002-12-03 15:00:42 -08:00
|
|
|
$desc = 'Transform Tool procedures';
|
2010-07-07 02:43:10 -07:00
|
|
|
$doc_title = 'gimptransformtools';
|
|
|
|
|
$doc_short_desc = 'Access to toolbox transform tools.';
|
|
|
|
|
$doc_long_desc = 'Functions giving access to toolbox transform tools.';
|
1999-03-17 15:08:08 -08:00
|
|
|
|
1999-03-19 15:04:16 -08:00
|
|
|
1;
|