X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Surface.html-inc;h=d279f555d099072485e6a59d17b735393da4fe8b;hb=2285c1bfd97fecfa573086a9ac1755b2554008be;hp=5d6b428f957ba2359f60458ef4faeff438623412;hpb=162a0989f2a1d33d50c8950709319df21973e7b7;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Surface.html-inc b/pages/SDL-Surface.html-inc index 5d6b428..d279f55 100644 --- a/pages/SDL-Surface.html-inc +++ b/pages/SDL-Surface.html-inc @@ -3,16 +3,32 @@
SDL::Surface - Graphic surface structure. Access to SDL_Surface
.
SDL::Surface - Graphic surface structure.
+ +Core, Video, Structure
The main surface (display) is provided by SDL::Video::set_video_mode. +
The main surface (display) is provided by SDL::Video::set_video_mode. use SDL; #provides flags & constants use SDL::Video; #provides access to set_video_mode use SDL::Surface; #provides access to SDL_Surface struct internals
@@ -64,15 +85,80 @@The constructor creates a new surface with the specified parameter values.
my $surface = SDL::Surface->new_from( $old_surface, ... ); + + +-
THIS WILL SEGFAULT!!! Read: http://sdlperl.ath.cx/projects/SDLPerl/ticket/53
Allow any pixel-format *
+Use asynchronous blit if possible
+Double buffered *
+Use hardware acceleration blit
+Have an exclusive palette
+Stored in video memory
+Full screen surface *
+Have an OpenGL context *
+Support OpenGL blitting *. NOTE: This option is kept for compatibility only, and is not recommended for new code.
+Resizable surface *
+Accelerated colorkey blitting with RLE
+Use alpha blending blit
+Use colorkey blitting
+Stored in the system memory. SDL_SWSURFACE is not actually a flag (it is defined as 0). A lack of SDL_HWSURFACE implies SDL_SWSURFACE
+Use preallocated memory
+The format of the pixels stored in the surface. See SDL::PixelFormat
+my $format = $surface->format; + ++ +
my $pitch = $surface->pitch; + ++
SDL::Surface's scanline length in bytes
+ +To get the surface's clip_rect we the following
+my $clip_rect = SDL::Rect->new(0,0,0,0); + SDL::Video::get_clip_rect($surface, $clip_rect); + ++
To set the surface's clip_rect use the following
+my $clip_rect = SDL::Rect->new(2,23,23,542); + SDL::Video::set_clip_rect($surface, $clip_rect); + ++ +
Disclaimer: This can be very slow, it is suitable for creating surfaces one time and not for animations
+ +$surface->get_pixels( $offset ) + ++
Returns the current integer value at (surface->pixels)[offset]
+ +$surface->set_pixels( $offset, $value ); + ++
Sets the current integer to $value at (surface->pixels)[offset]
+ +sub putpixel + { + my($x, $y, $color) = @_; + my $lineoffset = $y * ($screen->pitch / $depth_in_bytes); + $screen->set_pixels( $lineoffset+ $x, $color); + } + ++
Note: $depth_in_bytes for 32 is 4, 16 is 2, 8 is 1;
+See also examples/sols/ch02.pl
+ +$surface->get_pixels_ptr(); + ++
Returns the C ptr to this surfaces's pixels
+ + + + + + + + +SDL, SDL::PixelFormat, SDL::Video
+