<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>
<li><a href="#Direct_Write_to_Surface_Pixel">Direct Write to Surface Pixel</a>
-<ul><li><a href="#get_pixels">get_pixels</a></li>
+<ul><li><a href="#get_pixel">get_pixel</a></li>
<li><a href="#set_pixels">set_pixels</a>
<ul><li><a href="#Usage">Usage</a></li>
</ul>
<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 are exported by default. You can avoid this by doing:</p>
+<pre> use SDL::Video ();
+
+</pre>
+<p>and access them directly:</p>
+<pre> SDL::Video::SDL_SWSURFACE;
+
+</pre>
+<p>Available constants: see <a href="#flags">flags</a></p>
+
+</div>
<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="METHODS_CONTENT">
</div>
<h4 id="flags">flags</h4>
<div id="flags_CONTENT">
+<p>Available flags for new() are exported by SDL::Video</p>
<dl>
- <dt>SDL_ANYFORMAT</dt>
- <dd>
- <p>Allow any pixel-format *</p>
- </dd>
<dt>SDL_ASYNCBLIT</dt>
<dd>
<p>Use asynchronous blit if possible</p>
</dd>
- <dt>SDL_DOUBLEBUF</dt>
- <dd>
- <p>Double buffered *</p>
- </dd>
- <dt>SDL_HWACCEL</dt>
- <dd>
- <p>Use hardware acceleration blit</p>
- </dd>
- <dt>SDL_HWPALETTE</dt>
+ <dt>SDL_SWSURFACE</dt>
<dd>
- <p>Have an exclusive palette</p>
+ <p>Stored in the system memory.</p>
</dd>
<dt>SDL_HWSURFACE</dt>
<dd>
<p>Stored in video memory</p>
</dd>
- <dt>SDL_FULLSCREEN</dt>
- <dd>
- <p>Full screen surface *</p>
- </dd>
- <dt>SDL_OPENGL</dt>
- <dd>
- <p>Have an OpenGL context *</p>
- </dd>
- <dt>SDL_OPENGLBLIT</dt>
- <dd>
- <p>Support OpenGL blitting *. NOTE: This option is kept for compatibility only, and is not recommended for new code.</p>
- </dd>
- <dt>SDL_RESIZABLE</dt>
- <dd>
- <p>Resizable surface *</p>
- </dd>
- <dt>SDL_RLEACCEL</dt>
- <dd>
- <p>Accelerated colorkey blitting with RLE</p>
- </dd>
- <dt>SDL_SRCALPHA</dt>
- <dd>
- <p>Use alpha blending blit</p>
- </dd>
- <dt>SDL_SRCCOLORKEY</dt>
- <dd>
- <p>Use colorkey blitting</p>
- </dd>
- <dt>SDL_SWSURFACE</dt>
- <dd>
- <p>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</p>
- </dd>
- <dt>SDL_PREALLOC</dt>
- <dd>
- <p>Use preallocated memory</p>
- </dd>
</dl>
-
-
-
-
</div>
<h2 id="w">w</h2>
<div id="w_CONTENT">
</div>
<h2 id="format">format</h2>
<div id="format_CONTENT">
-<p>The format of the pixels stored in the surface. See <a href="SDL-PixelFormat">SDL::PixelFormat</a></p>
+<p>The format of the pixels stored in the surface. See <a href="SDL-PixelFormat.html">SDL::PixelFormat</a></p>
<pre> my $format = $surface->format;
</pre>
<p>Disclaimer: This can be very slow, it is suitable for creating surfaces one time and not for animations</p>
</div>
-<h2 id="get_pixels">get_pixels</h2>
-<div id="get_pixels_CONTENT">
-<pre> $surface->get_pixels( $offset )
+<h2 id="get_pixel">get_pixel</h2>
+<div id="get_pixel_CONTENT">
+<pre> my $pixel = $surface->get_pixel( $offset )
</pre>
-<p>Returns the current integer value at (surface->pixels)[offset] </p>
+<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="set_pixels">set_pixels</h2>
<pre> $surface->set_pixels( $offset, $value );
</pre>
-<p>Sets the current integer to $value at (surface->pixels)[offset]</p>
+<p>Sets the current 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>
</div>
<h3 id="Usage">Usage</h3>
<div id="Usage_CONTENT">
-<pre> sub putpixel
- {
- my($x, $y, $color) = @_;
- my $lineoffset = $y * ($screen->pitch / $depth_in_bytes);
- $screen->set_pixels( $lineoffset+ $x, $color);
- }
+<pre> sub putpixel
+ {
+ my($x, $y, $color) = @_;
+ $screen->set_pixels( $x + $y * $screen->w, $color);
+ }
</pre>
-<p>Note: $depth_in_bytes for 32 is 4, 16 is 2, 8 is 1;</p>
<p>See also examples/sols/ch02.pl</p>
</div>
</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">SDL</a>, <a href="SDL-PixelFormat">SDL::PixelFormat</a>, <a href="SDL-Video">SDL::Video</a>, <a href="SDL-Rect">SDL::Rect</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>
</div>
\ No newline at end of file