X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Surface.html-inc;h=83709ba4e325a5273cf98fe29552da9f800ad3e7;hb=f373167ec31ba16ae0770ba461f9de43f41a7ac1;hp=537155e84a6142cd8d3b927417b186950be44409;hpb=46beffd8f76fe150d946bf61c780e61de2affbdf;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Surface.html-inc b/pages/SDL-Surface.html-inc index 537155e..83709ba 100644 --- a/pages/SDL-Surface.html-inc +++ b/pages/SDL-Surface.html-inc @@ -2,20 +2,34 @@
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
@@ -59,6 +69,19 @@An SDL_Surface
defines a surfaceangular area of pixels.
The constants are exported by default. You can avoid this by doing:
+use SDL::Video (); + ++
and access them directly:
+SDL::Video::SDL_SWSURFACE; + ++
Available constants: see flags
+ +Available flags for new() are exported by SDL::Video
+Use asynchronous blit if possible
+Stored in the system memory.
+Stored in video 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
+ +my $pixel = $surface->get_pixel( $offset ) + ++
Returns the 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.
+ +$surface->set_pixels( $offset, $value ); + ++
Sets the current 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.
+ +sub putpixel + { + my($x, $y, $color) = @_; + $screen->set_pixels( $x + $y * $screen->w, $color); + } + ++
See also examples/sols/ch02.pl
+ +$surface->get_pixels_ptr(); + ++
Returns the C ptr to this surfaces's pixels
+ + + + + + + + +