~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/drawable_transform.pdb

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# The GIMP -- an image manipulation program
 
1
# GIMP - The GNU Image Manipulation Program
2
2
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 
4
4
# This program is free software; you can redistribute it and/or modify
23
23
 
24
24
# shortcuts
25
25
 
26
 
sub pdb_misc {
27
 
    $author = $copyright = 'Jo\xc3\xa3o S. O. Bueno Calligaris';
28
 
    $date = '2004';
29
 
    $since = '2.2';
30
 
}
31
 
 
32
 
sub drawable_arg () {{
33
 
    name => 'drawable',
34
 
    type => 'drawable',
35
 
    desc => 'The affected drawable'
36
 
}}
37
 
 
38
 
sub transform_options_args () {
39
 
    { name => 'transform_direction', type => 'enum GimpTransformDirection',
40
 
      desc => 'Direction of Transformation: { %%desc%% }' },
41
 
    { name => 'interpolation', type => 'enum GimpInterpolationType',
42
 
      desc => 'Type of interpolation: { %%desc%% }' },
43
 
    { name => 'supersample', type => 'boolean',
44
 
      desc => 'Whether to perform supersample' },
45
 
    { name => 'recursion_level', type => '0 < int32',
46
 
      desc => 'Level of recursion (3 is a nice default)' },
47
 
    { name => 'clip_result', type => 'boolean',
48
 
      desc => 'Whether to clip results' }
49
 
}
50
 
 
51
 
sub transform_options_default_args () {
52
 
    { name => 'interpolate', type => 'boolean',
53
 
      desc => 'Whether to use interpolation and supersampling' },
54
 
    { name => 'clip_result', type => 'boolean',
55
 
      desc => 'Whether to clip results' }
56
 
}
57
 
 
58
 
sub drawable_out_arg {
59
 
    my $type = shift;
60
 
    my $arg = &drawable_arg;
61
 
    $arg->{desc} = "The $type drawable";
62
 
    $arg->{no_declare} = 1;
63
 
    $arg;
64
 
}
65
 
 
66
26
sub transform_invoke {
67
 
    my ($progress_text, $assemble_matrix, $variables, $check) = @_;
 
27
    my ($progress_text, $assemble_matrix, $check) = @_;
68
28
    my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));';
69
29
 
70
30
    if ($check) {
71
 
        $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) &&\n" . $check;
 
31
        $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");";
72
32
    }
73
33
 
74
34
    %invoke = (
75
 
        vars => $variables,
76
35
        code => <<"CODE"
77
36
{
78
37
  gint x, y, width, height;
112
71
}
113
72
 
114
73
sub transform_default_invoke {
115
 
    my ($progress_text, $assemble_matrix, $variables, $check) = @_;
 
74
    my ($progress_text, $assemble_matrix, $check) = @_;
116
75
    my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));';
117
76
 
118
77
    if ($check) {
119
 
        $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) &&\n" . $check;
 
78
        $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");";
120
79
    }
121
80
 
122
81
    %invoke = (
123
 
        vars => $variables,
124
82
        code => <<"CODE"
125
83
{
126
84
  gint x, y, width, height;
175
133
This procedure flips the specified drawable if no selection exists. If
176
134
a selection exists, the portion of the drawable which lies under the
177
135
selection is cut from the drawable and made into a floating selection
178
 
which is then flipped.  If auto_center is set to true, the flip is
 
136
which is then flipped.  If auto_center is set to TRUE, the flip is
179
137
around the selection's center. Otherwise, the coordinate of the axis
180
138
needs to be specified.
181
139
 
184
142
Otherwise, this will be the newly created and flipped drawable.
185
143
HELP
186
144
 
187
 
    &pdb_misc;
 
145
    &joao_pdb_misc('2004', '2.2');
188
146
 
189
147
    @inargs = (
190
 
        &drawable_arg,
191
 
        { name => 'flip_type', type => &std_orientation_enum,
192
 
          desc => 'Type of flip: %%desc%%' },
 
148
        { name => 'drawable', type => 'drawable',
 
149
          desc => 'The affected drawable' },
 
150
        { name => 'flip_type',
 
151
          type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
 
152
          desc => 'Type of flip' },
193
153
        { name => 'auto_center', type => 'boolean',
194
154
          desc => 'Whether to automatically position the axis in the selection center' },
195
155
        { name => 'axis', type => 'float',
198
158
          desc => 'Whether to clip results' }
199
159
    );
200
160
 
201
 
    @outargs = ( &drawable_out_arg('flipped') );
 
161
    @outargs = (
 
162
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
163
          desc => 'The flipped drawable' }
 
164
    );
202
165
 
203
166
    %invoke = (
204
167
        code => <<'CODE'
239
202
results parameter specifies wheter current selection will affect the transform.
240
203
HELP
241
204
 
242
 
    &pdb_misc;
 
205
    &joao_pdb_misc('2004', '2.2');
243
206
 
244
207
    @inargs = (
245
 
        &drawable_arg,
 
208
        { name => 'drawable', type => 'drawable',
 
209
          desc => 'The affected drawable' },
246
210
        { name => 'x0', type => 'float',
247
211
          desc => 'horz. coord. of one end of axis' },
248
212
        { name => 'y0', type => 'float',
251
215
          desc => 'horz. coord. of other end of axis' },
252
216
        { name => 'y1', type => 'float',
253
217
          desc => 'vert. coord. of other end of axis' },
254
 
        &transform_options_args
255
 
    );
256
 
 
257
 
    @outargs = ( &drawable_out_arg('flipped') );
258
 
 
259
 
    transform_invoke ("Flip...", <<CODE);
260
 
      gimp_transform_matrix_flip_free (x, y, width, height,
261
 
                                       x0, y0, x1, y1,
262
 
                                       &matrix);
 
218
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
219
          desc => 'Direction of transformation' },
 
220
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
221
          desc => 'Type of interpolation' },
 
222
        { name => 'supersample', type => 'boolean',
 
223
          desc => 'Whether to perform supersample' },
 
224
        { name => 'recursion_level', type => '1 <= int32',
 
225
          desc => 'Level of recursion (3 is a nice default)' },
 
226
        { name => 'clip_result', type => 'boolean',
 
227
          desc => 'Whether to clip results' }
 
228
    );
 
229
 
 
230
    @outargs = (
 
231
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
232
          desc => 'The flipped drawable' }
 
233
    );
 
234
 
 
235
    transform_invoke ("Flipping", <<CODE);
 
236
      gimp_matrix3_identity (&matrix);
 
237
      gimp_transform_matrix_flip_free (&matrix,
 
238
                                       x0, y0, x1, y1);
263
239
CODE
264
240
}
265
241
 
275
251
(depending on the 'interpolate' parameter).
276
252
HELP
277
253
 
278
 
    &pdb_misc;
 
254
    &joao_pdb_misc('2004', '2.2');
279
255
 
280
256
    @inargs = (
281
 
        &drawable_arg,
 
257
        { name => 'drawable', type => 'drawable',
 
258
          desc => 'The affected drawable' },
282
259
        { name => 'x0', type => 'float',
283
260
          desc => 'horz. coord. of one end of axis' },
284
261
        { name => 'y0', type => 'float',
287
264
          desc => 'horz. coord. of other end of axis' },
288
265
        { name => 'y1', type => 'float',
289
266
          desc => 'vert. coord. of other end of axis' },
290
 
        &transform_options_default_args
291
 
    );
292
 
 
293
 
    @outargs = ( &drawable_out_arg('flipped') );
294
 
 
295
 
    transform_default_invoke ("Flip...", <<CODE);
296
 
      gimp_transform_matrix_flip_free (x, y, width, height,
297
 
                                       x0, y0, x1, y1,
298
 
                                       &matrix);
 
267
        { name => 'interpolate', type => 'boolean',
 
268
          desc => 'Whether to use interpolation and supersampling' },
 
269
        { name => 'clip_result', type => 'boolean',
 
270
          desc => 'Whether to clip results' }
 
271
    );
 
272
 
 
273
    @outargs = (
 
274
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
275
          desc => 'The flipped drawable' }
 
276
    );
 
277
 
 
278
    transform_default_invoke ("Flipping", <<CODE);
 
279
      gimp_matrix3_identity (&matrix);
 
280
      gimp_transform_matrix_flip_free (&matrix,
 
281
                                       x0, y0, x1, y1);
299
282
CODE
300
283
}
301
284
 
323
306
a perspective transform.
324
307
HELP
325
308
 
326
 
    &pdb_misc;
 
309
    &joao_pdb_misc('2004', '2.2');
327
310
 
328
311
    @inargs = (
329
 
        &drawable_arg
330
 
    );
331
 
 
332
 
    my $pos = 0;
333
 
    foreach $where (qw(upper-left upper-right lower-left lower-right)) {
334
 
        foreach (qw(x y)) {
335
 
            push @inargs,
336
 
                 { name => "$_$pos", type => 'float',
337
 
                   desc => "The new $_ coordinate of $where corner of original
338
 
                            bounding box",
339
 
                   alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
340
 
        }
341
 
        $pos++;
342
 
    }
343
 
    @inargs = (@inargs,
344
 
        &transform_options_args
345
 
    );
346
 
 
347
 
    @outargs = ( &drawable_out_arg('newly mapped') );
348
 
 
349
 
    transform_invoke ("Perspective...", <<CODE, [ 'gdouble trans_info[8]' ]);
350
 
      gimp_transform_matrix_perspective (x, y, width, height,
351
 
                                         trans_info[X0], trans_info[Y0],
352
 
                                         trans_info[X1], trans_info[Y1],
353
 
                                         trans_info[X2], trans_info[Y2],
354
 
                                         trans_info[X3], trans_info[Y3],
355
 
                                         &matrix);
 
312
        { name => 'drawable', type => 'drawable',
 
313
          desc => 'The affected drawable' },
 
314
        { name => 'x0', type => 'float',
 
315
          desc => 'The new x coordinate of upper-left corner of original
 
316
                   bounding box' },
 
317
        { name => 'y0', type => 'float',
 
318
          desc => 'The new y coordinate of upper-left corner of original
 
319
                   bounding box' },
 
320
        { name => 'x1', type => 'float',
 
321
          desc => 'The new x coordinate of upper-right corner of original
 
322
                   bounding box' },
 
323
        { name => 'y1', type => 'float',
 
324
          desc => 'The new y coordinate of upper-right corner of original
 
325
                   bounding box' },
 
326
        { name => 'x2', type => 'float',
 
327
          desc => 'The new x coordinate of lower-left corner of original
 
328
                   bounding box' },
 
329
        { name => 'y2', type => 'float',
 
330
          desc => 'The new y coordinate of lower-left corner of original
 
331
                   bounding box' },
 
332
        { name => 'x3', type => 'float',
 
333
          desc => 'The new x coordinate of lower-right corner of original
 
334
                   bounding box' },
 
335
        { name => 'y3', type => 'float',
 
336
          desc => 'The new y coordinate of lower-right corner of original
 
337
                   bounding box' },
 
338
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
339
          desc => 'Direction of transformation' },
 
340
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
341
          desc => 'Type of interpolation' },
 
342
        { name => 'supersample', type => 'boolean',
 
343
          desc => 'Whether to perform supersample' },
 
344
        { name => 'recursion_level', type => '1 <= int32',
 
345
          desc => 'Level of recursion (3 is a nice default)' },
 
346
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
347
          desc => 'How to clip results' }
 
348
    );
 
349
 
 
350
    @outargs = (
 
351
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
352
          desc => 'The newly mapped drawable' }
 
353
    );
 
354
 
 
355
    transform_invoke ("Perspective", <<CODE);
 
356
      gimp_matrix3_identity (&matrix);
 
357
      gimp_transform_matrix_perspective (&matrix,
 
358
                                         x, y, width, height,
 
359
                                         x0, y0, x1, y1,
 
360
                                         x2, y2, x3, y3);
356
361
CODE
357
362
}
358
363
 
368
373
(depending on the 'interpolate' parameter).
369
374
HELP
370
375
 
371
 
    &pdb_misc;
 
376
    &joao_pdb_misc('2004', '2.2');
372
377
 
373
378
    @inargs = (
374
 
        &drawable_arg
375
 
    );
376
 
 
377
 
    my $pos = 0;
378
 
    foreach $where (qw(upper-left upper-right lower-left lower-right)) {
379
 
        foreach (qw(x y)) {
380
 
            push @inargs,
381
 
                 { name => "$_$pos", type => 'float',
382
 
                   desc => "The new $_ coordinate of $where corner of original
383
 
                            bounding box",
384
 
                   alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
385
 
        }
386
 
        $pos++;
387
 
    }
388
 
    @inargs = (@inargs,
389
 
        &transform_options_default_args
390
 
    );
391
 
 
392
 
    @outargs = ( &drawable_out_arg('newly mapped') );
393
 
 
394
 
    transform_default_invoke ("Perspective...", <<CODE, [ 'gdouble trans_info[8]' ]);
395
 
      gimp_transform_matrix_perspective (x, y, width, height,
396
 
                                         trans_info[X0], trans_info[Y0],
397
 
                                         trans_info[X1], trans_info[Y1],
398
 
                                         trans_info[X2], trans_info[Y2],
399
 
                                         trans_info[X3], trans_info[Y3],
400
 
                                         &matrix);
 
379
        { name => 'drawable', type => 'drawable',
 
380
          desc => 'The affected drawable' },
 
381
        { name => 'x0', type => 'float',
 
382
          desc => 'The new x coordinate of upper-left corner of original
 
383
                   bounding box' },
 
384
        { name => 'y0', type => 'float',
 
385
          desc => 'The new y coordinate of upper-left corner of original
 
386
                   bounding box' },
 
387
        { name => 'x1', type => 'float',
 
388
          desc => 'The new x coordinate of upper-right corner of original
 
389
                   bounding box' },
 
390
        { name => 'y1', type => 'float',
 
391
          desc => 'The new y coordinate of upper-right corner of original
 
392
                   bounding box' },
 
393
        { name => 'x2', type => 'float',
 
394
          desc => 'The new x coordinate of lower-left corner of original
 
395
                   bounding box' },
 
396
        { name => 'y2', type => 'float',
 
397
          desc => 'The new y coordinate of lower-left corner of original
 
398
                   bounding box' },
 
399
        { name => 'x3', type => 'float',
 
400
          desc => 'The new x coordinate of lower-right corner of original
 
401
                   bounding box' },
 
402
        { name => 'y3', type => 'float',
 
403
          desc => 'The new y coordinate of lower-right corner of original
 
404
                   bounding box' },
 
405
        { name => 'interpolate', type => 'boolean',
 
406
          desc => 'Whether to use interpolation and supersampling' },
 
407
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
408
          desc => 'How to clip results' }
 
409
    );
 
410
 
 
411
    @outargs = (
 
412
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
413
          desc => 'The newly mapped drawable' }
 
414
    );
 
415
 
 
416
    transform_default_invoke ("Perspective", <<CODE);
 
417
      gimp_matrix3_identity (&matrix);
 
418
      gimp_transform_matrix_perspective (&matrix,
 
419
                                         x, y, width, height,
 
420
                                         x0, y0, x1, y1,
 
421
                                         x2, y2, x3, y3);
401
422
CODE
402
423
}
403
424
 
417
438
this will be the newly created and rotated drawable.
418
439
HELP
419
440
 
420
 
    &pdb_misc;
 
441
    &joao_pdb_misc('2004', '2.2');
421
442
 
422
443
    @inargs = (
423
 
        &drawable_arg,
 
444
        { name => 'drawable', type => 'drawable',
 
445
          desc => 'The affected drawable' },
424
446
        { name => 'rotate_type', type => 'enum GimpRotationType',
425
 
          desc => 'Type of rotation: %%desc%%' },
 
447
          desc => 'Type of rotation' },
426
448
        { name => 'auto_center', type => 'boolean',
427
449
          desc => 'Whether to automatically rotate around the selection center' },
428
450
        { name => 'center_x', type => 'int32',
433
455
          desc => 'Whether to clip results' }
434
456
    );
435
457
 
436
 
    @outargs = ( &drawable_out_arg('rotated') );
 
458
    @outargs = (
 
459
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
460
          desc => 'The rotated drawable' }
 
461
    );
437
462
 
438
463
    %invoke = (
439
464
        code => <<'CODE'
457
482
 
458
483
sub drawable_transform_rotate {
459
484
    $blurb = <<'BLURB';
460
 
Rotate the specified drawable about given coordinates through the specified angle.
 
485
Rotate the specified drawable about given coordinates through the
 
486
specified angle.
461
487
BLURB
462
488
 
463
489
    $help = <<'HELP';
470
496
this will be the newly created and rotated drawable.
471
497
HELP
472
498
 
473
 
    &pdb_misc;
 
499
    &joao_pdb_misc('2004', '2.2');
474
500
 
475
501
    @inargs = (
476
 
        &drawable_arg,
 
502
        { name => 'drawable', type => 'drawable',
 
503
          desc => 'The affected drawable' },
477
504
        { name => 'angle', type => 'float',
478
505
          desc => 'The angle of rotation (radians)' },
479
506
        { name => 'auto_center', type => 'boolean',
482
509
          desc => 'The hor. coordinate of the center of rotation' },
483
510
        { name => 'center_y', type => 'int32',
484
511
          desc => 'The vert. coordinate of the center of rotation' },
485
 
        &transform_options_args
486
 
    );
487
 
 
488
 
    @outargs = ( &drawable_out_arg('rotated') );
489
 
 
490
 
    transform_invoke ("Rotating...", <<CODE);
 
512
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
513
          desc => 'Direction of transformation' },
 
514
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
515
          desc => 'Type of interpolation' },
 
516
        { name => 'supersample', type => 'boolean',
 
517
          desc => 'Whether to perform supersample' },
 
518
        { name => 'recursion_level', type => '1 <= int32',
 
519
          desc => 'Level of recursion (3 is a nice default)' },
 
520
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
521
          desc => 'How to clip results' }
 
522
    );
 
523
 
 
524
    @outargs = (
 
525
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
526
          desc => 'The rotated drawable' }
 
527
    );
 
528
 
 
529
    transform_invoke ("Rotating", <<CODE);
 
530
      gimp_matrix3_identity (&matrix);
491
531
      if (auto_center)
492
 
        gimp_transform_matrix_rotate (x, y, width, height, angle,
493
 
                                      &matrix);
 
532
        gimp_transform_matrix_rotate_rect (&matrix,
 
533
                                           x, y, width, height, angle);
494
534
      else
495
 
        gimp_transform_matrix_rotate_center (center_x, center_y, angle,
496
 
                                             &matrix);
 
535
        gimp_transform_matrix_rotate_center (&matrix,
 
536
                                             center_x, center_y, angle);
497
537
CODE
498
538
}
499
539
 
509
549
(depending on the 'interpolate' parameter).
510
550
HELP
511
551
 
512
 
    &pdb_misc;
 
552
    &joao_pdb_misc('2004', '2.2');
513
553
 
514
554
    @inargs = (
515
 
        &drawable_arg,
 
555
        { name => 'drawable', type => 'drawable',
 
556
          desc => 'The affected drawable' },
516
557
        { name => 'angle', type => 'float',
517
558
          desc => 'The angle of rotation (radians)' },
518
559
        { name => 'auto_center', type => 'boolean',
521
562
          desc => 'The hor. coordinate of the center of rotation' },
522
563
        { name => 'center_y', type => 'int32',
523
564
          desc => 'The vert. coordinate of the center of rotation' },
524
 
        &transform_options_default_args
525
 
    );
526
 
 
527
 
    @outargs = ( &drawable_out_arg('rotated') );
528
 
 
529
 
    transform_default_invoke ("Rotating...", <<CODE);
 
565
        { name => 'interpolate', type => 'boolean',
 
566
          desc => 'Whether to use interpolation and supersampling' },
 
567
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
568
          desc => 'How to clip results' }
 
569
    );
 
570
 
 
571
    @outargs = (
 
572
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
573
          desc => 'The rotated drawable' }
 
574
    );
 
575
 
 
576
    transform_default_invoke ("Rotating", <<CODE);
 
577
      gimp_matrix3_identity (&matrix);
530
578
      if (auto_center)
531
 
        gimp_transform_matrix_rotate (x, y, width, height, angle,
532
 
                                      &matrix);
 
579
        gimp_transform_matrix_rotate_rect (&matrix,
 
580
                                           x, y, width, height, angle);
533
581
      else
534
 
        gimp_transform_matrix_rotate_center (center_x, center_y, angle,
535
 
                                             &matrix);
 
582
        gimp_transform_matrix_rotate_center (&matrix,
 
583
                                             center_x, center_y, angle);
536
584
CODE
537
585
}
538
586
 
550
598
this will be the newly created and scaled drawable.
551
599
HELP
552
600
 
553
 
    &pdb_misc;
 
601
    &joao_pdb_misc('2004', '2.2');
554
602
 
555
603
    @inargs = (
556
 
        &drawable_arg
557
 
    );
558
 
 
559
 
    my $pos = 0;
560
 
    foreach $where (qw(upper-left lower-right)) {
561
 
        foreach (qw(x y)) {
562
 
            push @inargs,
563
 
                 { name => "$_$pos", type => 'float',
564
 
                   desc => "The new $_ coordinate of $where corner of newly
565
 
                            scaled region",
566
 
                   alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
567
 
        }
568
 
        $pos++;
569
 
    }
570
 
 
571
 
    @inargs = (@inargs,
572
 
        &transform_options_args
573
 
    );
574
 
 
575
 
    @outargs = ( &drawable_out_arg('scaled') );
576
 
 
577
 
    transform_invoke ("Scaling...", <<CODE, [ 'gdouble trans_info[4]' ], <<CODE2);
578
 
      gimp_transform_matrix_scale (x, y, width, height,
579
 
                                   trans_info[X0],
580
 
                                   trans_info[Y0],
581
 
                                   trans_info[X1] - trans_info[X0],
582
 
                                   trans_info[Y1] - trans_info[Y0],
583
 
                                   &matrix);
 
604
        { name => 'drawable', type => 'drawable',
 
605
          desc => 'The affected drawable' },
 
606
        { name => 'x0', type => 'float',
 
607
          desc => 'The new x coordinate of the upper-left corner of the
 
608
                    scaled region' },
 
609
        { name => 'y0', type => 'float',
 
610
          desc => 'The new y coordinate of the upper-left corner of the
 
611
                    scaled region' },
 
612
        { name => 'x1', type => 'float',
 
613
          desc => 'The new x coordinate of the lower-right corner of the
 
614
                    scaled region' },
 
615
        { name => 'y1', type => 'float',
 
616
          desc => 'The new y coordinate of the lower-right corner of the
 
617
                    scaled region' },
 
618
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
619
          desc => 'Direction of transformation' },
 
620
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
621
          desc => 'Type of interpolation' },
 
622
        { name => 'supersample', type => 'boolean',
 
623
          desc => 'Whether to perform supersample' },
 
624
        { name => 'recursion_level', type => '1 <= int32',
 
625
          desc => 'Level of recursion (3 is a nice default)' },
 
626
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
627
          desc => 'How to clip results' }
 
628
    );
 
629
 
 
630
    @outargs = (
 
631
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
632
          desc => 'The scaled drawable' }
 
633
    );
 
634
 
 
635
    transform_invoke ("Scaling", <<CODE, 'x0 < x1 && y0 < y1');
 
636
      gimp_matrix3_identity (&matrix);
 
637
      gimp_transform_matrix_scale (&matrix,
 
638
                                   x, y, width, height,
 
639
                                   x0, y0, x1 - x0, y1 - y0);
584
640
CODE
585
 
             trans_info[X0] < trans_info[X1] &&
586
 
             trans_info[Y0] < trans_info[Y1]);
587
 
CODE2
588
641
}
589
642
 
590
643
 
597
650
(depending on the 'interpolate' parameter).
598
651
HELP
599
652
 
600
 
    &pdb_misc;
 
653
    &joao_pdb_misc('2004', '2.2');
601
654
 
602
655
    @inargs = (
603
 
        &drawable_arg
604
 
    );
605
 
 
606
 
    my $pos = 0;
607
 
    foreach $where (qw(upper-left lower-right)) {
608
 
        foreach (qw(x y)) {
609
 
            push @inargs,
610
 
                 { name => "$_$pos", type => 'float',
611
 
                   desc => "The new $_ coordinate of $where corner of newly
612
 
                            scaled region",
613
 
                   alias => "trans_info[\U$_\E$pos]", no_declare => 1 }
614
 
        }
615
 
        $pos++;
616
 
    }
617
 
 
618
 
    @inargs = (@inargs,
619
 
        &transform_options_default_args
620
 
    );
621
 
 
622
 
    @outargs = ( &drawable_out_arg('scaled') );
623
 
 
624
 
    transform_default_invoke ("Scaling...", <<CODE, [ 'gdouble trans_info[4]' ], <<CODE2);
625
 
      gimp_transform_matrix_scale (x, y, width, height,
626
 
                                   trans_info[X0],
627
 
                                   trans_info[Y0],
628
 
                                   trans_info[X1] - trans_info[X0],
629
 
                                   trans_info[Y1] - trans_info[Y0],
630
 
                                   &matrix);
 
656
        { name => 'drawable', type => 'drawable',
 
657
          desc => 'The affected drawable' },
 
658
        { name => 'x0', type => 'float',
 
659
          desc => 'The new x coordinate of the upper-left corner of the
 
660
                    scaled region' },
 
661
        { name => 'y0', type => 'float',
 
662
          desc => 'The new y coordinate of the upper-left corner of the
 
663
                    scaled region' },
 
664
        { name => 'x1', type => 'float',
 
665
          desc => 'The new x coordinate of the lower-right corner of the
 
666
                    scaled region' },
 
667
        { name => 'y1', type => 'float',
 
668
          desc => 'The new y coordinate of the lower-right corner of the
 
669
                    scaled region' },
 
670
        { name => 'interpolate', type => 'boolean',
 
671
          desc => 'Whether to use interpolation and supersampling' },
 
672
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
673
          desc => 'How to clip results' }
 
674
     );
 
675
 
 
676
    @outargs = (
 
677
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
678
          desc => 'The scaled drawable' }
 
679
    );
 
680
 
 
681
    transform_default_invoke ("Scaling", <<CODE, 'x0 < x1 && y0 < y1');
 
682
      gimp_matrix3_identity (&matrix);
 
683
      gimp_transform_matrix_scale (&matrix,
 
684
                                   x, y, width, height,
 
685
                                   x0, y0, x1 - x0, y1 - y0);
631
686
CODE
632
 
             trans_info[X0] < trans_info[X1] &&
633
 
             trans_info[Y0] < trans_info[Y1]);
634
 
CODE2
635
687
}
636
688
 
637
689
 
653
705
indicates the extent (in pixels) to shear by.
654
706
HELP
655
707
 
656
 
    &pdb_misc;
 
708
    &joao_pdb_misc('2004', '2.2');
657
709
 
658
710
    @inargs = (
659
 
        &drawable_arg,
660
 
        { name => 'shear_type', type => &std_orientation_enum,
661
 
          desc => 'Type of shear: %%desc%%' },
 
711
        { name => 'drawable', type => 'drawable',
 
712
          desc => 'The affected drawable' },
 
713
        { name => 'shear_type',
 
714
          type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
 
715
          desc => 'Type of shear' },
662
716
        { name => 'magnitude', type => 'float',
663
717
          desc => 'The magnitude of the shear' },
664
 
        &transform_options_args
665
 
    );
666
 
 
667
 
    @outargs = ( &drawable_out_arg('sheared') );
668
 
 
669
 
    transform_invoke ("Shearing...", <<CODE);
670
 
      gimp_transform_matrix_shear (x, y, width, height,
671
 
                                   shear_type, magnitude,
672
 
                                   &matrix);
 
718
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
719
          desc => 'Direction of transformation' },
 
720
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
721
          desc => 'Type of interpolation' },
 
722
        { name => 'supersample', type => 'boolean',
 
723
          desc => 'Whether to perform supersample' },
 
724
        { name => 'recursion_level', type => '1 <= int32',
 
725
          desc => 'Level of recursion (3 is a nice default)' },
 
726
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
727
          desc => 'How to clip results' }
 
728
    );
 
729
 
 
730
    @outargs = (
 
731
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
732
          desc => 'The sheared drawable' }
 
733
    );
 
734
 
 
735
    transform_invoke ("Shearing", <<CODE);
 
736
      gimp_matrix3_identity (&matrix);
 
737
      gimp_transform_matrix_shear (&matrix,
 
738
                                   x, y, width, height,
 
739
                                   shear_type, magnitude);
673
740
CODE
674
741
}
675
742
 
685
752
(depending on the 'interpolate' parameter).
686
753
HELP
687
754
 
688
 
    &pdb_misc;
 
755
    &joao_pdb_misc('2004', '2.2');
689
756
 
690
757
    @inargs = (
691
 
        &drawable_arg,
692
 
        { name => 'shear_type', type => &std_orientation_enum,
693
 
          desc => 'Type of shear: %%desc%%' },
 
758
        { name => 'drawable', type => 'drawable',
 
759
          desc => 'The affected drawable' },
 
760
        { name => 'shear_type',
 
761
          type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
 
762
          desc => 'Type of shear' },
694
763
        { name => 'magnitude', type => 'float',
695
764
          desc => 'The magnitude of the shear' },
696
 
        &transform_options_default_args
697
 
    );
698
 
 
699
 
    @outargs = ( &drawable_out_arg('sheared') );
700
 
 
701
 
    transform_default_invoke ("Shearing...", <<CODE);
702
 
      gimp_transform_matrix_shear (x, y, width, height,
703
 
                                   shear_type, magnitude,
704
 
                                   &matrix);
 
765
        { name => 'interpolate', type => 'boolean',
 
766
          desc => 'Whether to use interpolation and supersampling' },
 
767
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
768
          desc => 'How to clip results' }
 
769
    );
 
770
 
 
771
    @outargs = (
 
772
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
773
          desc => 'The sheared drawable' }
 
774
    );
 
775
 
 
776
    transform_default_invoke ("Shearing", <<CODE);
 
777
      gimp_matrix3_identity (&matrix);
 
778
      gimp_transform_matrix_shear (&matrix,
 
779
                                   x, y, width, height,
 
780
                                   shear_type, magnitude);
705
781
CODE
706
782
}
707
783
 
725
801
drawable.
726
802
HELP
727
803
 
728
 
    &pdb_misc;
 
804
    &joao_pdb_misc('2004', '2.2');
729
805
 
730
806
    @inargs = (
731
 
        &drawable_arg,
 
807
        { name => 'drawable', type => 'drawable',
 
808
          desc => 'The affected drawable' },
732
809
        { name => 'source_x', type => 'float',
733
810
          desc => 'X coordinate of the transformation center' },
734
811
        { name => 'source_y', type => 'float',
743
820
          desc => 'X coordinate of where the center goes' },
744
821
        { name => 'dest_y', type => 'float',
745
822
          desc => 'Y coordinate of where the center goes' },
746
 
        &transform_options_args
747
 
    );
748
 
 
749
 
    @outargs = ( &drawable_out_arg('transformed') );
750
 
 
751
 
    transform_invoke ("2D Transform...", <<CODE);
 
823
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
824
          desc => 'Direction of transformation' },
 
825
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
826
          desc => 'Type of interpolation' },
 
827
        { name => 'supersample', type => 'boolean',
 
828
          desc => 'Whether to perform supersample' },
 
829
        { name => 'recursion_level', type => '1 <= int32',
 
830
          desc => 'Level of recursion (3 is a nice default)' },
 
831
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
832
          desc => 'How to clip results' }
 
833
    );
 
834
 
 
835
    @outargs = (
 
836
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
837
          desc => 'The transformed drawable' }
 
838
    );
 
839
 
 
840
    transform_invoke ("2D Transform", <<CODE);
752
841
      gimp_matrix3_identity  (&matrix);
753
842
      gimp_matrix3_translate (&matrix, -source_x, -source_y);
754
843
      gimp_matrix3_scale     (&matrix, scale_x, scale_y);
769
858
(depending on the 'interpolate' parameter).
770
859
HELP
771
860
 
772
 
    &pdb_misc;
 
861
    &joao_pdb_misc('2004', '2.2');
773
862
 
774
863
    @inargs = (
775
 
        &drawable_arg,
 
864
        { name => 'drawable', type => 'drawable',
 
865
          desc => 'The affected drawable' },
776
866
        { name => 'source_x', type => 'float',
777
867
          desc => 'X coordinate of the transformation center' },
778
868
        { name => 'source_y', type => 'float',
787
877
          desc => 'X coordinate of where the center goes' },
788
878
        { name => 'dest_y', type => 'float',
789
879
          desc => 'Y coordinate of where the center goes' },
790
 
        &transform_options_default_args
791
 
    );
792
 
 
793
 
    @outargs = ( &drawable_out_arg('transformed') );
794
 
 
795
 
    transform_default_invoke ("2D Transform...", <<CODE);
 
880
        { name => 'interpolate', type => 'boolean',
 
881
          desc => 'Whether to use interpolation and supersampling' },
 
882
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
883
          desc => 'How to clip results' }
 
884
    );
 
885
 
 
886
    @outargs = (
 
887
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
888
          desc => 'The transformed drawable' }
 
889
    );
 
890
 
 
891
    transform_default_invoke ("2D Transforming", <<CODE);
796
892
      gimp_matrix3_identity  (&matrix);
797
893
      gimp_matrix3_translate (&matrix, -source_x, -source_y);
798
894
      gimp_matrix3_scale     (&matrix, scale_x, scale_y);
818
914
this will be the newly created and transformed drawable.
819
915
HELP
820
916
 
821
 
    &pdb_misc;
 
917
    &joao_pdb_misc('2004', '2.2');
822
918
 
823
919
    @inargs = (
824
 
        &drawable_arg,
 
920
        { name => 'drawable', type => 'drawable',
 
921
          desc => 'The affected drawable' },
825
922
        { name => 'coeff_0_0', type => 'float',
826
923
          desc => 'coefficient (0,0) of the transformation matrix' },
827
924
        { name => 'coeff_0_1', type => 'float',
840
937
          desc => 'coefficient (2,1) of the transformation matrix' },
841
938
        { name => 'coeff_2_2', type => 'float',
842
939
          desc => 'coefficient (2,2) of the transformation matrix' },
843
 
        &transform_options_args
844
 
    );
845
 
 
846
 
    @outargs = ( &drawable_out_arg('transformed') );
847
 
 
848
 
    transform_invoke ("2D Transform...", <<CODE);
 
940
        { name => 'transform_direction', type => 'enum GimpTransformDirection',
 
941
          desc => 'Direction of transformation' },
 
942
        { name => 'interpolation', type => 'enum GimpInterpolationType',
 
943
          desc => 'Type of interpolation' },
 
944
        { name => 'supersample', type => 'boolean',
 
945
          desc => 'Whether to perform supersample' },
 
946
        { name => 'recursion_level', type => '1 <= int32',
 
947
          desc => 'Level of recursion (3 is a nice default)' },
 
948
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
949
          desc => 'How to clip results' }
 
950
    );
 
951
 
 
952
    @outargs = (
 
953
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
954
          desc => 'The transformed drawable' }
 
955
    );
 
956
 
 
957
    transform_invoke ("2D Transforming", <<CODE);
849
958
      matrix.coeff[0][0] = coeff_0_0;
850
959
      matrix.coeff[0][1] = coeff_0_1;
851
960
      matrix.coeff[0][2] = coeff_0_2;
870
979
(depending on the 'interpolate' parameter).
871
980
HELP
872
981
 
873
 
    &pdb_misc;
 
982
    &joao_pdb_misc('2004', '2.2');
874
983
 
875
984
    @inargs = (
876
 
        &drawable_arg,
 
985
        { name => 'drawable', type => 'drawable',
 
986
          desc => 'The affected drawable' },
877
987
        { name => 'coeff_0_0', type => 'float',
878
988
          desc => 'coefficient (0,0) of the transformation matrix' },
879
989
        { name => 'coeff_0_1', type => 'float',
892
1002
          desc => 'coefficient (2,1) of the transformation matrix' },
893
1003
        { name => 'coeff_2_2', type => 'float',
894
1004
          desc => 'coefficient (2,2) of the transformation matrix' },
895
 
        &transform_options_default_args
896
 
    );
897
 
 
898
 
    @outargs = ( &drawable_out_arg('transformed') );
899
 
 
900
 
    transform_default_invoke ("2D Transform...", <<CODE);
 
1005
        { name => 'interpolate', type => 'boolean',
 
1006
          desc => 'Whether to use interpolation and supersampling' },
 
1007
        { name => 'clip_result', type => 'enum GimpTransformResize',
 
1008
          desc => 'How to clip results' }
 
1009
    );
 
1010
 
 
1011
    @outargs = (
 
1012
        { name => 'drawable', type => 'drawable', no_declare => 1,
 
1013
          desc => 'The transformed drawable' }
 
1014
    );
 
1015
 
 
1016
    transform_default_invoke ("2D Transforming", <<CODE);
901
1017
      matrix.coeff[0][0] = coeff_0_0;
902
1018
      matrix.coeff[0][1] = coeff_0_1;
903
1019
      matrix.coeff[0][2] = coeff_0_2;