Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sdl::surface(3pm) [debian man page]

pods::SDL::Surface(3pm) 				User Contributed Perl Documentation				   pods::SDL::Surface(3pm)

NAME
SDL::Surface - Graphic surface structure CATEGORY
Core, Video, Structure SYNOPSIS
use SDL; use SDL::Video; use SDL::Surface; # Create the main surface (display) SDL::init(SDL_INIT_VIDEO); my $display = SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE); # Create other surfaces attached to the $display. my $surface = SDL::Surface->new(SDL_ASYNCBLIT | SDL_HWSURFACE, 640, 480, 16, 0, 0, 0, 0); my $surface2 = SDL::Surface->new_from($surface, 100, 100, 8, 0, 0, 0, 0); DESCRIPTION
An "SDL_Surface" defines a surfaceangular area of pixels. CONSTANTS
The constants for SDL::Surface belong to SDL::Video, under the export tag of ':surface'. SDL_ASYNCBLIT Use asynchronous blit if possible SDL_SWSURFACE Store in system memory SDL_HWSURFACE Store in video memory METHODS
new my $surface = SDL::Surface->new( $flags, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask ); The constructor creates a new surface with the specified parameter values. The four mask values are the bits that the channel will ignore. For example, an Rmask of 0xFF will ignore that channel completely, making everything on the surface more green/blue. new_from my $surface = SDL::Surface->new_from( $surface, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask ); The constructor creates a new surface with the specified parameter values. The flags are taken from the specified $surface. w my $w = $surface->w; Returns the width of the surface. SDL::Surface width is defined at construction so this is read-only. h my $h = $surface->h; Returns the height of the surface. SDL::Surface height is defined at construction so this is read-only. format my $format = $surface->format; The format of the pixels stored in the surface. See SDL::PixelFormat pitch my $pitch = $surface->pitch; The scanline length in bytes. Direct Write to Surface Pixel Disclaimer: The following methods can be very slow, making them suitable for creating surfaces, but not for animations get_pixel my $pixel = $surface->get_pixel( $offset ) Returns the numeric pixel value for the given $offset. The pixel value depends on current pixel format. Note: For surfaces with a palette (1 byte per pixel) the palette index is returned instead of color values. set_pixels $surface->set_pixels( $offset, $value ); Sets the pixel $value to the given $offset. The pixel value must fit the pixel format of the surface. Note: For surfaces with a palette (1 byte per pixel) the palette index must be passed instead of color values. Example: sub putpixel { my ($x, $y, $color) = @_; $display->set_pixels( $x + $y * $display->w, $color); } See also examples/pixel_operations/sols/ch02.pl! get_pixels_ptr my $ptr = $surface->get_pixels_ptr; Returns a reference to the surface's pixels. SEE ALSO
SDL, SDL::PixelFormat, SDL::Video, SDL::Rect AUTHORS
See "AUTHORS" in SDL. perl v5.14.2 2012-05-28 pods::SDL::Surface(3pm)

Check Out this Related Man Page

pods::SDL::GFX::Rotozoom(3pm)				User Contributed Perl Documentation			     pods::SDL::GFX::Rotozoom(3pm)

NAME
SDL::GFX::Rotozoom - rotation and zooming functions for surfaces CATEGORY
GFX CONSTANTS
The constants are exported by default. You can avoid this by doing: use SDL::GFX::Rotozoom (); and access them directly: SDL::GFX::Rotozoom::SMOOTHING_OFF; or by choosing the export tags below: Export tag: ':smoothing' SMOOTHING_OFF SMOOTHING_ON METHODS
surface my $new_surface = SDL::GFX::Rotozoom::surface( $surface, $angle, $zoom, $smooth ); With "SDL::GFX::Rotozoom::surface" you have the opportunity to rotate and zoom a given surface. The surface will be rotated counter clockwise (in degrees). Pass "SMOOTHING_ON" or "SMOOTHING_OFF" in order to turn it on or off. Note: The new surface (with $"zoom == 1") will usually be bigger than the source $surface. Note: Note: new surface should be less than 16384 in width and height. Example: use SDL; use SDL::Video; use SDL::Rect; use SDL::Surface; use SDL::GFX::Rotozoom; my $screen_width = 640; my $screen_height = 480; SDL::init(SDL_INIT_VIDEO); my $screen = SDL::Video::set_video_mode(800, 600, 32, SDL_SWSURFACE); my $picture = SDL::Video::load_BMP('test.bmp'); my $rotated = SDL::GFX::Rotozoom::surface( $picture, 45, 0.8, SMOOTHING_ON ); SDL::Video::blit_surface( $rotated, SDL::Rect->new(0, 0, $rotated->w, $rotated->h), $screen, SDL::Rect->new(0, 0, 0, 0) ); SDL::Video::update_rect( $screen, 0, 0, 0, 0 ); sleep(2); surface_xy my $new_surface = SDL::GFX::Rotozoom::surface_xy( $surface, $angle, $zoom_x, $zoom_y, $smooth ); Same as SDL::GFX::Rotozoom::surface but you can specify the zoomlevel for x and y separately. surface_size my ($new_width, $new_height) = @{ SDL::GFX::Rotozoom::surface_size( $width, $height, $angle, $zoom ) }; "surface_size" will give you the width and height of an rotating/zoom operation for the given $width and $height. Helpful for knowing the surface size before actually do the rotating/zoom operation. surface_size_xy my ($new_width, $new_height) = @{ SDL::GFX::Rotozoom::surface_size_xy( $width, $height, $angle, $zoom_x, $zoom_y ) }; Same as SDL::GFX::Rotozoom::surface_size but you can specify the zoomlevel for x and y separately. zoom_surface my $new_surface = SDL::GFX::Rotozoom::zoom_surface( $surface, $zoom_x, $zoom_y, $smooth ); Same as SDL::GFX::Rotozoom::surface_xy except you can zoom only. zoom_surface_size my ($new_width, $new_height) = SDL::GFX::Rotozoom::zoom_surface_size( $width, $height, $zoom_x, $zoom_y ); Same as SDL::GFX::Rotozoom::surface_size_xy except you can specify zoom only. shrink_surface my $new_surface = SDL::GFX::Rotozoom::shrink_surface( $surface, $factor_x, $factor_y ); Specialized function for shrinking a surface. rotate_surface_90_degrees my $new_surface = SDL::GFX::Rotozoom::rotate_surface_90_degrees( $surface, $num_clockwise_turns ); Rotating a surface $num_clockwise_turns-times. AUTHORS
See "AUTHORS" in SDL. perl v5.14.2 2012-05-28 pods::SDL::GFX::Rotozoom(3pm)
Man Page