<!-- INDEX START -->
<h3 id="TOP">Index</h3>
-<ul><li><a href="#NAME">NAME</a>
-<ul><li><a href="#CATEGORY">CATEGORY</a></li>
-</ul>
-</li>
+<ul><li><a href="#NAME">NAME</a></li>
+<li><a href="#CATEGORY">CATEGORY</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
+<li><a href="#CONSTANTS">CONSTANTS</a></li>
<li><a href="#METHODS">METHODS</a>
-<ul><li><a href="#new_flags_width_height_depth_Rmask_G">new ( flags, width, height, depth, Rmask, Gmask, Bmask, Amask )</a></li>
-<li><a href="#new_from_surface_width_height_depth_">new_from ( surface, width, height, depth, Rmask, Gmask, Bmask, Amask )</a>
-<ul><li><a href="#Construtor_Parameters">Construtor Parameters</a></li>
-</ul>
-</li>
+<ul><li><a href="#new">new</a></li>
+<li><a href="#new_from">new_from</a></li>
<li><a href="#w">w</a></li>
<li><a href="#h">h</a></li>
+<li><a href="#format">format</a></li>
+<li><a href="#pitch">pitch</a></li>
+</ul>
+</li>
+<li><a href="#Direct_Write_to_Surface_Pixel">Direct Write to Surface Pixel</a>
+<ul><li><a href="#get_pixel">get_pixel</a></li>
+<li><a href="#set_pixels">set_pixels</a></li>
+<li><a href="#get_pixels_ptr">get_pixels_ptr</a></li>
</ul>
</li>
-<li><a href="#SEE_ALSO">SEE ALSO</a>
+<li><a href="#SEE_ALSO">SEE ALSO</a></li>
+<li><a href="#AUTHORS">AUTHORS</a>
</li>
</ul><hr />
<!-- INDEX END -->
<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="NAME_CONTENT">
-<p>SDL::Surface - Graphic surface structure. Access to <code>SDL_Surface</code>.</p>
+<p>SDL::Surface - Graphic surface structure</p>
</div>
-<h2 id="CATEGORY">CATEGORY</h2>
+<h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="CATEGORY_CONTENT">
<p>Core, Video, Structure</p>
-
-
-
-
</div>
<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SYNOPSIS_CONTENT">
-<p>The main surface (display) is provided by <a href="/SDL-Video::set_video_mode.html">SDL::Video::set_video_mode</a>.
- use SDL; #provides flags & constants
- use SDL::Video; #provides access to set_video_mode
- use SDL::Surface; #provides access to SDL_Surface struct internals</p>
-<pre> SDL::init(SDL_INIT_VIDEO);
- my $display = SDL::Video::set_video_mode();
+<pre> use SDL;
+ use SDL::Video;
+ use SDL::Surface;
-</pre>
-<p>All surfaces constructed from now on are attached to the $display. There are two constructors available to do this.</p>
-<pre> my $surface = SDL::Surface->new ( ... );
- my $surface2 = SDL::Surface->new_from ( 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);
</pre>
<p>An <code>SDL_Surface</code> defines a surfaceangular area of pixels.</p>
</div>
+<h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="CONSTANTS_CONTENT">
+<p>The constants for SDL::Surface belong to SDL::Video, under the export tag of <code>':surface'</code>.</p>
+<dl>
+ <dt>SDL_ASYNCBLIT</dt>
+ <dd>
+ <p>Use asynchronous blit if possible</p>
+ </dd>
+ <dt>SDL_SWSURFACE</dt>
+ <dd>
+ <p>Store in system memory</p>
+ </dd>
+ <dt>SDL_HWSURFACE</dt>
+ <dd>
+ <p>Store in video memory</p>
+ </dd>
+</dl>
+
+</div>
<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="METHODS_CONTENT">
</div>
-<h2 id="new_flags_width_height_depth_Rmask_G">new ( flags, width, height, depth, Rmask, Gmask, Bmask, Amask )</h2>
-<div id="new_flags_width_height_depth_Rmask_G-2">
-<p>The constructor creates a new surface with the specified parameter values.</p>
-<pre> my $surface = SDL::Surface->new( ... );
+<h2 id="new">new</h2>
+<div id="new_CONTENT">
+<pre> my $surface = SDL::Surface->new(
+ $flags, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask
+ );
</pre>
+<p>The constructor creates a new surface with the specified parameter values.</p>
+<p>The four mask values are the bits that the channel will ignore.
+For example, an Rmask of <code>0xFF</code> will ignore that channel completely, making everything on the surface more green/blue.</p>
</div>
-<h2 id="new_from_surface_width_height_depth_">new_from ( surface, width, height, depth, Rmask, Gmask, Bmask, Amask )</h2>
-<div id="new_from_surface_width_height_depth_-2">
-<p>The constructor creates a new surface with the specified parameter values. </p>
-<pre> my $surface = SDL::Surface->new_from( $old_surface, ... );
-
+<h2 id="new_from">new_from</h2>
+<div id="new_from_CONTENT">
+<pre> my $surface = SDL::Surface->new_from(
+ $surface, $width, $height, $depth, $Rmask, $Gmask, $Bmask, $Amask
+ );
+</pre>
+<p>The constructor creates a new surface with the specified parameter values.
+The flags are taken from the specified <code>$surface</code>.</p>
+</div>
+<h2 id="w">w</h2>
+<div id="w_CONTENT">
+<pre> my $w = $surface->w;
</pre>
+<p>Returns the width of the surface.
+SDL::Surface width is defined at construction so this is read-only.</p>
</div>
-<h3 id="Construtor_Parameters">Construtor Parameters</h3>
-<div id="Construtor_Parameters_CONTENT">
+<h2 id="h">h</h2>
+<div id="h_CONTENT">
+<pre> my $h = $surface->h;
+
+</pre>
+<p>Returns the height of the surface.
+SDL::Surface height is defined at construction so this is read-only.</p>
+</div>
+<h2 id="format">format</h2>
+<div id="format_CONTENT">
+<pre> my $format = $surface->format;
+</pre>
+<p>The format of the pixels stored in the surface.
+See <a href="SDL-PixelFormat.html">SDL::PixelFormat</a></p>
+</div>
+<h2 id="pitch">pitch</h2>
+<div id="pitch_CONTENT">
+<pre> my $pitch = $surface->pitch;
+</pre>
+<p>The scanline length in bytes.</p>
+</div>
+<h1 id="Direct_Write_to_Surface_Pixel">Direct Write to Surface Pixel</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="Direct_Write_to_Surface_Pixel_CONTEN">
+<p><strong>Disclaimer:</strong> The following methods can be very slow, making them suitable for creating surfaces, but not for animations</p>
+</div>
+<h2 id="get_pixel">get_pixel</h2>
+<div id="get_pixel_CONTENT">
+<pre> my $pixel = $surface->get_pixel( $offset )
+</pre>
+<p>Returns the pixel value for the given <code>$offset</code>.
+The pixel value depends on current pixel format.</p>
+<p><strong>Note:</strong> For surfaces with a palette (1 byte per pixel) the palette index is returned instead of color values.</p>
</div>
-<h2 id="w">w</h2>
-<div id="w_CONTENT">
-<p>SDL::Surface width are defined at construction. Thus the following is read only. </p>
-<pre> my $w = $surface->w;
+<h2 id="set_pixels">set_pixels</h2>
+<div id="set_pixels_CONTENT">
+<pre> $surface->set_pixels( $offset, $value );
+
+</pre>
+<p>Sets the pixel <code>$value</code> to the given <code>$offset</code>.
+The pixel value must fit the pixel format of the surface.</p>
+<p><strong>Note</strong>: For surfaces with a palette (1 byte per pixel) the palette index must be passed instead of color values.</p>
+<p>Example:</p>
+<pre> sub putpixel {
+ my ($x, $y, $color) = @_;
+ $display->set_pixels( $x + $y * $display->w, $color);
+ }
</pre>
+<p>See also <cite>examples/pixel_operations/sols/ch02.pl</cite>!</p>
</div>
-<h2 id="h">h</h2>
-<div id="h_CONTENT">
-<p>SDL::Surface height are defined at construction. Thus the following is read only. </p>
-<pre> my $h = $surface->h;
+<h2 id="get_pixels_ptr">get_pixels_ptr</h2>
+<div id="get_pixels_ptr_CONTENT">
+<pre> my $ptr = $surface->get_pixels_ptr;
</pre>
+<p>Returns a reference to the surface's pixels.</p>
</div>
<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SEE_ALSO_CONTENT">
-<p><a href="/SDL.html">SDL</a>, <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a>, <a href="/SDL-Video.html">SDL::Video</a> </p>
+<p><a href="SDL.html">SDL</a>, <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>, <a href="SDL-Video.html">SDL::Video</a>, <a href="SDL-Rect.html">SDL::Rect</a></p>
+
+</div>
+<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHORS_CONTENT">
+<p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
</div>
</div>
\ No newline at end of file