Commit | Line | Data |
8fde61e3 |
1 | #!/usr/bin/env perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use SDL; |
7 | use SDL::Surface; |
8 | use SDL::App; |
9 | use SDL::Tool::Graphic; |
10 | |
11 | my $app = new SDL::App(-title => "Graphic Tool Test", |
12 | -width => 640, |
13 | -height => 480, |
14 | -depth => 16, |
15 | -fullscreen => 0); |
16 | my $app_rect = new SDL::Rect( -x=>0, |
17 | -y=>0, |
18 | -width=>$app->width, |
19 | -height=>$app->height); |
20 | |
21 | my $sprite = new SDL::Surface(-name => "data/logo.png"); |
22 | $sprite->display_format(); |
23 | |
24 | #Test Zoom |
25 | my $graphicTool = new SDL::Tool::Graphic(); |
26 | $graphicTool->zoom($sprite, .5, .5, 1); |
27 | |
28 | my $sprite_rect = new SDL::Rect( -x=>0, |
29 | -y=>0, |
30 | -width=>$sprite->width, |
31 | -height=>$sprite->height); |
32 | $sprite->blit($sprite_rect, $app, $sprite_rect); |
33 | $app->flip(); |
34 | sleep 4; |
35 | $app->fill($app_rect, $SDL::Color::black); |
36 | |
37 | |
38 | #Test Rotate |
39 | $graphicTool->rotoZoom($sprite, 90, 1, 1); |
40 | |
41 | $sprite_rect = new SDL::Rect( -x=>0, |
42 | -y=>0, |
43 | -width=>$sprite->width, |
44 | -height=>$sprite->height); |
45 | $sprite->blit($sprite_rect, $app, $sprite_rect); |
46 | $app->flip(); |
47 | sleep 4; |
48 | |
49 | +print "GrayScaling\n"; |
50 | +$app->fill($app_rect, $SDL::Color::black); |
51 | |
52 | #Test GrayScale |
53 | $graphicTool->grayScale($sprite); |
54 | |
55 | $sprite->blit($sprite_rect, $app, $sprite_rect); |
56 | $app->flip(); |
57 | sleep 4; |
58 | |
59 | |
60 | |