1SDL::GFX::Rotozoom(3) User Contributed Perl DocumentationSDL::GFX::Rotozoom(3)
2
3
4

NAME

6       SDL::GFX::Rotozoom - rotation and zooming functions for surfaces
7

CATEGORY

9       GFX
10

CONSTANTS

12       The constants are exported by default. You can avoid this by doing:
13
14        use SDL::GFX::Rotozoom ();
15
16       and access them directly:
17
18        SDL::GFX::Rotozoom::SMOOTHING_OFF;
19
20       or by choosing the export tags below:
21
22       Export tag: ':smoothing'
23
24        SMOOTHING_OFF
25        SMOOTHING_ON
26

METHODS

28   surface
29        my $new_surface = SDL::GFX::Rotozoom::surface( $surface, $angle, $zoom, $smooth );
30
31       With "SDL::GFX::Rotozoom::surface" you have the opportunity to rotate
32       and zoom a given surface.  The surface will be rotated counter
33       clockwise (in degrees).  Pass "SMOOTHING_ON" or "SMOOTHING_OFF" in
34       order to turn it on or off.
35
36       Note: The new surface (with $"zoom == 1") will usually be bigger than
37       the source $surface.
38
39       Note: Note: new surface should be less than 16384 in width and height.
40
41       Example:
42
43        use SDL;
44        use SDL::Video;
45        use SDL::Rect;
46        use SDL::Surface;
47        use SDL::GFX::Rotozoom;
48
49        my $screen_width  = 640;
50        my $screen_height = 480;
51
52        SDL::init(SDL_INIT_VIDEO);
53
54        my $screen  = SDL::Video::set_video_mode(800, 600, 32, SDL_SWSURFACE);
55        my $picture = SDL::Video::load_BMP('test.bmp');
56
57        my $rotated = SDL::GFX::Rotozoom::surface( $picture, 45, 0.8, SMOOTHING_ON );
58
59        SDL::Video::blit_surface( $rotated, SDL::Rect->new(0, 0, $rotated->w, $rotated->h),
60                                  $screen,  SDL::Rect->new(0, 0, 0, 0) );
61
62        SDL::Video::update_rect( $screen, 0, 0, 0, 0 );
63
64        sleep(2);
65
66   surface_xy
67        my $new_surface = SDL::GFX::Rotozoom::surface_xy( $surface, $angle, $zoom_x, $zoom_y, $smooth );
68
69       Same as SDL::GFX::Rotozoom::surface but you can specify the zoomlevel
70       for x and y separately.
71
72   surface_size
73        my ($new_width, $new_height) = @{ SDL::GFX::Rotozoom::surface_size( $width, $height, $angle, $zoom ) };
74
75       "surface_size" will give you the width and height of an rotating/zoom
76       operation for the given $width and $height.  Helpful for knowing the
77       surface size before actually do the rotating/zoom operation.
78
79   surface_size_xy
80        my ($new_width, $new_height) = @{ SDL::GFX::Rotozoom::surface_size_xy( $width, $height, $angle, $zoom_x, $zoom_y ) };
81
82       Same as SDL::GFX::Rotozoom::surface_size but you can specify the
83       zoomlevel for x and y separately.
84
85   zoom_surface
86        my $new_surface = SDL::GFX::Rotozoom::zoom_surface( $surface, $zoom_x, $zoom_y, $smooth );
87
88       Same as SDL::GFX::Rotozoom::surface_xy except you can zoom only.
89
90   zoom_surface_size
91        my ($new_width, $new_height) = SDL::GFX::Rotozoom::zoom_surface_size( $width, $height, $zoom_x, $zoom_y );
92
93       Same as SDL::GFX::Rotozoom::surface_size_xy except you can specify zoom
94       only.
95
96   shrink_surface
97        my $new_surface = SDL::GFX::Rotozoom::shrink_surface( $surface, $factor_x, $factor_y );
98
99       Specialized function for shrinking a surface.
100
101   rotate_surface_90_degrees
102        my $new_surface = SDL::GFX::Rotozoom::rotate_surface_90_degrees( $surface, $num_clockwise_turns );
103
104       Rotating a surface $num_clockwise_turns-times.
105

AUTHORS

107       See "AUTHORS" in SDL.
108
109
110
111perl v5.32.1                      2021-01-27             SDL::GFX::Rotozoom(3)
Impressum