18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
24
sub drawable_arg () {{
27
desc => 'The affected drawable',
30
sub drawable_out_arg {
32
my $arg = &drawable_arg;
33
$arg->{desc} = "The $type drawable";
34
$arg->{no_declare} = 1;
42
&std_pdb_deprecated ('gimp_drawable_transform_flip_simple');
21
&std_pdb_deprecated ('gimp-drawable-transform-flip-simple');
46
{ name => 'flip_type', type => &std_orientation_enum,
47
desc => 'Type of flip: %%desc%%' }
24
{ name => 'drawable', type => 'drawable',
25
desc => 'The affected drawable' },
26
{ name => 'flip_type',
27
type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
28
desc => 'Type of flip' }
50
@outargs = ( &drawable_out_arg('flipped') );
32
{ name => 'drawable', type => 'drawable', no_declare => 1,
33
desc => 'The flipped drawable' }
71
&std_pdb_deprecated ('gimp_drawable_transform_perspective_default');
55
&std_pdb_deprecated ('gimp-drawable-transform-perspective-default');
58
{ name => 'drawable', type => 'drawable',
59
desc => 'The affected drawable' },
75
60
{ name => 'interpolation', type => 'boolean',
76
desc => 'Whether to use interpolation' }
80
foreach $where (qw(upper-left upper-right lower-left lower-right)) {
83
{ name => "$_$pos", type => 'float',
84
desc => "The new $_ coordinate of $where corner of original
86
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
91
@outargs = ( &drawable_out_arg('newly mapped') );
61
desc => 'Whether to use interpolation' },
62
{ name => 'x0', type => 'float',
63
desc => 'The new x coordinate of upper-left corner of original
65
{ name => 'y0', type => 'float',
66
desc => 'The new y coordinate of upper-left corner of original
68
{ name => 'x1', type => 'float',
69
desc => 'The new x coordinate of upper-right corner of original
71
{ name => 'y1', type => 'float',
72
desc => 'The new y coordinate of upper-right corner of original
74
{ name => 'x2', type => 'float',
75
desc => 'The new x coordinate of lower-left corner of original
77
{ name => 'y2', type => 'float',
78
desc => 'The new y coordinate of lower-left corner of original
80
{ name => 'x3', type => 'float',
81
desc => 'The new x coordinate of lower-right corner of original
83
{ name => 'y3', type => 'float',
84
desc => 'The new y coordinate of lower-right corner of original
89
{ name => 'drawable', type => 'drawable', no_declare => 1,
90
desc => 'The newly mapped drawable' }
94
vars => [ 'gdouble trans_info[8]' ],
97
96
gint x, y, width, height;
113
112
/* Assemble the transformation matrix */
114
gimp_transform_matrix_perspective (x, y, width, height,
115
trans_info[X0], trans_info[Y0],
116
trans_info[X1], trans_info[Y1],
117
trans_info[X2], trans_info[Y2],
118
trans_info[X3], trans_info[Y3],
113
gimp_matrix3_identity (&matrix);
114
gimp_transform_matrix_perspective (&matrix,
121
119
if (interpolation)
122
120
interpolation_type = gimp->config->interpolation_type;
125
gimp_progress_start (progress, _("Perspective..."), FALSE);
123
gimp_progress_start (progress, _("Perspective"), FALSE);
127
125
/* Perspective the selection */
128
126
success = gimp_drawable_transform_affine (drawable, context,
143
&std_pdb_deprecated ('gimp_drawable_transform_rotate_default');
141
&std_pdb_deprecated ('gimp-drawable-transform-rotate-default');
144
{ name => 'drawable', type => 'drawable',
145
desc => 'The affected drawable' },
147
146
{ name => 'interpolation', type => 'boolean',
148
147
desc => 'Whether to use interpolation' },
149
148
{ name => 'angle', type => 'float',
150
149
desc => 'The angle of rotation (radians)' }
153
@outargs = ( &drawable_out_arg('rotated') );
153
{ name => 'drawable', type => 'drawable', no_declare => 1,
154
desc => 'The rotated drawable' }
174
176
/* Assemble the transformation matrix */
175
gimp_transform_matrix_rotate (x, y, width, height,
177
gimp_matrix3_identity (&matrix);
178
gimp_transform_matrix_rotate_rect (&matrix,
178
182
if (interpolation)
179
183
interpolation_type = gimp->config->interpolation_type;
182
gimp_progress_start (progress, _("Rotating..."), FALSE);
186
gimp_progress_start (progress, _("Rotating"), FALSE);
184
188
/* Rotate the selection */
185
189
success = gimp_drawable_transform_affine (drawable, context,
200
&std_pdb_deprecated ('gimp_drawable_transform_scale_default');
204
&std_pdb_deprecated ('gimp-drawable-transform-scale-default');
207
{ name => 'drawable', type => 'drawable',
208
desc => 'The affected drawable' },
204
209
{ name => 'interpolation', type => 'boolean',
205
desc => 'Whether to use interpolation' }
209
foreach $where (qw(upper-left lower-right)) {
212
{ name => "$_$pos", type => 'float',
213
desc => "The new $_ coordinate of $where corner of newly
215
alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
220
@outargs = ( &drawable_out_arg('scaled') );
210
desc => 'Whether to use interpolation' },
211
{ name => 'x0', type => 'float',
212
desc => 'The new x coordinate of the upper-left corner of the
214
{ name => 'y0', type => 'float',
215
desc => 'The new y coordinate of the upper-left corner of the
217
{ name => 'x1', type => 'float',
218
desc => 'The new x coordinate of the lower-right corner of the
220
{ name => 'y1', type => 'float',
221
desc => 'The new y coordinate of the lower-right corner of the
226
{ name => 'drawable', type => 'drawable', no_declare => 1,
227
desc => 'The scaled drawable' }
223
vars => [ 'gdouble trans_info[4]' ],
226
233
gint x, y, width, height;
228
235
success = (gimp_item_is_attached (GIMP_ITEM (drawable)) &&
229
trans_info[X0] < trans_info[X1] &&
230
trans_info[Y0] < trans_info[Y1]);
233
239
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
244
250
/* Assemble the transformation matrix */
245
gimp_transform_matrix_scale (x, y, width, height,
248
trans_info[X1] - trans_info[X0],
249
trans_info[Y1] - trans_info[Y0],
251
gimp_matrix3_identity (&matrix);
252
gimp_transform_matrix_scale (&matrix,
254
x0, y0, x1 - x0, y1 - y0);
252
256
if (interpolation)
253
257
interpolation_type = gimp->config->interpolation_type;
256
gimp_progress_start (progress, _("Scaling..."), FALSE);
260
gimp_progress_start (progress, _("Scaling"), FALSE);
258
262
/* Scale the selection */
259
263
success = gimp_drawable_transform_affine (drawable, context,
274
&std_pdb_deprecated ('gimp_drawable_transform_shear_default');
278
&std_pdb_deprecated ('gimp-drawable-transform-shear-default');
281
{ name => 'drawable', type => 'drawable',
282
desc => 'The affected drawable' },
278
283
{ name => 'interpolation', type => 'boolean',
279
284
desc => 'Whether to use interpolation' },
280
{ name => 'shear_type', type => &std_orientation_enum,
281
desc => 'Type of shear: %%desc%%' },
285
{ name => 'shear_type',
286
type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
287
desc => 'Type of shear' },
282
288
{ name => 'magnitude', type => 'float',
283
289
desc => 'The magnitude of the shear' }
286
@outargs = ( &drawable_out_arg('sheared') );
293
{ name => 'drawable', type => 'drawable', no_declare => 1,
294
desc => 'The sheared drawable' }
307
316
/* Assemble the transformation matrix */
308
gimp_transform_matrix_shear (x, y, width, height,
309
shear_type, magnitude,
317
gimp_matrix3_identity (&matrix);
318
gimp_transform_matrix_shear (&matrix,
320
shear_type, magnitude);
312
322
if (interpolation)
313
323
interpolation_type = gimp->config->interpolation_type;
316
gimp_progress_start (progress, _("Shearing..."), FALSE);
326
gimp_progress_start (progress, _("Shearing"), FALSE);
318
328
/* Shear the selection */
319
329
success = gimp_drawable_transform_affine (drawable, context,
333
343
sub transform_2d {
334
&std_pdb_deprecated ('gimp_drawable_transform_2d_default');
344
&std_pdb_deprecated ('gimp-drawable-transform-2d-default');
347
{ name => 'drawable', type => 'drawable',
348
desc => 'The affected drawable' },
338
349
{ name => 'interpolation', type => 'boolean',
339
350
desc => 'Whether to use interpolation' },
340
351
{ name => 'source_x', type => 'float',
379
393
interpolation_type = gimp->config->interpolation_type;
382
gimp_progress_start (progress, _("2D Transform..."), FALSE);
396
gimp_progress_start (progress, _("2D Transform"), FALSE);
384
398
/* Transform the selection */
385
399
success = gimp_drawable_transform_affine (drawable, context,