PageRenderTime 26ms CodeModel.GetById 15ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/t_backcompat/testgraphictool.pl

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