X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Surface.html-inc;h=83709ba4e325a5273cf98fe29552da9f800ad3e7;hb=411e0b6a19b323b88847fbffe2323afe98e9f8dc;hp=c8a6c49c31b61c2db5066ea0df27f9b0c473a2a0;hpb=55bbf7a209993f4172fd7e6555dda0947b844089;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Surface.html-inc b/pages/SDL-Surface.html-inc index c8a6c49..83709ba 100644 --- a/pages/SDL-Surface.html-inc +++ b/pages/SDL-Surface.html-inc @@ -6,6 +6,7 @@
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
Allow any pixel-format *
-Use asynchronous blit if possible
Double buffered *
-Use hardware acceleration blit
-Have an exclusive palette
+Stored in the system memory.
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
-Disclaimer: This can be very slow, it is suitable for creating surfaces one time and not for animations
$surface->get_pixels( $offset ) +get_pixel
++my $pixel = $surface->get_pixel( $offset )-Returns the current integer value at (surface->pixels)[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.
set_pixels
@@ -229,20 +193,19 @@$surface->set_pixels( $offset, $value );-Sets the current integer to $value at (surface->pixels)[offset]
+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) = @_; - my $lineoffset = $y * ($screen->pitch / $depth_in_bytes); - $screen->set_pixels( $lineoffset+ $x, $color); - } +sub putpixel + { + my($x, $y, $color) = @_; + $screen->set_pixels( $x + $y * $screen->w, $color); + }-Note: $depth_in_bytes for 32 is 4, 16 is 2, 8 is 1;
See also examples/sols/ch02.pl