Lots of fixes for SV hacking in get video driver for SDL::Video
[sdlgit/SDL_perl.git] / test / testgraphictool.pl
CommitLineData
8fde61e3 1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5
6use SDL;
7use SDL::Surface;
8use SDL::App;
9use SDL::Tool::Graphic;
10
11my $app = new SDL::App(-title => "Graphic Tool Test",
12 -width => 640,
13 -height => 480,
14 -depth => 16,
15 -fullscreen => 0);
16my $app_rect = new SDL::Rect( -x=>0,
17 -y=>0,
18 -width=>$app->width,
19 -height=>$app->height);
20
21my $sprite = new SDL::Surface(-name => "data/logo.png");
22$sprite->display_format();
23
24#Test Zoom
25my $graphicTool = new SDL::Tool::Graphic();
26$graphicTool->zoom($sprite, .5, .5, 1);
27
28my $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();
34sleep 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();
47sleep 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();
57sleep 4;
58
59
60