moved all SDL::Video constants
[sdlgit/SDL-Site.git] / pages / SDL-Surface.html-inc
index 537155e..f8bb751 100644 (file)
@@ -2,20 +2,34 @@
 <!-- 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><a href="#Construtor_Parameters">Construtor Parameters</a>
+<ul><li><a href="#flags">flags</a></li>
+</ul>
+</li>
 </ul>
 </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>
+<li><a href="#clip_rect">clip_rect</a></li>
+</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>
+<li><a href="#set_pixels">set_pixels</a>
+<ul><li><a href="#Usage">Usage</a></li>
+</ul>
+</li>
+<li><a href="#get_pixels_ptr">get_pixels_ptr</a></li>
 </ul>
 </li>
 <li><a href="#SEE_ALSO">SEE ALSO</a>
 
 <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>.
+<p>The main surface (display) is provided by <a href="/SDL-Video.html#set_video_mode">SDL::Video::set_video_mode</a>.
   use SDL; #provides flags &amp; constants
   use SDL::Video; #provides access to set_video_mode
   use SDL::Surface; #provides access to SDL_Surface struct internals</p>
 <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 not exported by default. You can export them into your namespace by doing:</p>
+<pre> use SDL::Video ':flags';
+
+</pre>
+<p>or</p>
+<pre> use SDL::Video ':all';
+
+</pre>
+<p>or 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">
 
 <h3 id="Construtor_Parameters">Construtor Parameters</h3>
 <div id="Construtor_Parameters_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_ASYNCBLIT</dt>
+       <dd>
+               <p>Use asynchronous blit if possible</p>
+       </dd>
+       <dt>SDL_SWSURFACE</dt>
+       <dd>
+               <p>Stored in the system memory.</p>
+       </dd>
+       <dt>SDL_HWSURFACE</dt>
+       <dd>
+               <p>Stored in video memory</p>
+       </dd>
+</dl>
 
 </div>
 <h2 id="w">w</h2>
 </pre>
 
 </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.html">SDL::PixelFormat</a></p>
+<pre> my $format = $surface-&gt;format;
+
+</pre>
+
+</div>
+<h2 id="pitch">pitch</h2>
+<div id="pitch_CONTENT">
+<pre> my $pitch = $surface-&gt;pitch;
+
+</pre>
+<p>SDL::Surface's scanline length in bytes</p>
+
+</div>
+<h2 id="clip_rect">clip_rect</h2>
+<div id="clip_rect_CONTENT">
+<p>To get the surface's clip_rect we the following</p>
+<pre> my $clip_rect = SDL::Rect-&gt;new(0,0,0,0);
+ SDL::Video::get_clip_rect($surface, $clip_rect);
+
+</pre>
+<p>To set the surface's clip_rect use the following</p>
+<pre> my $clip_rect = SDL::Rect-&gt;new(2,23,23,542);
+ SDL::Video::set_clip_rect($surface, $clip_rect);
+
+</pre>
+
+</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>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-&gt;get_pixels( $offset )  
+
+</pre>
+<p>Returns the current integer value at (surface-&gt;pixels)[offset] </p>
+
+</div>
+<h2 id="set_pixels">set_pixels</h2>
+<div id="set_pixels_CONTENT">
+<pre> $surface-&gt;set_pixels( $offset, $value );
+
+</pre>
+<p>Sets the current integer to $value at (surface-&gt;pixels)[offset]</p>
+
+</div>
+<h3 id="Usage">Usage</h3>
+<div id="Usage_CONTENT">
+<pre>  sub putpixel
+  {
+       my($x, $y, $color) = @_;
+       my $lineoffset = $y * ($screen-&gt;pitch / $depth_in_bytes); 
+       $screen-&gt;set_pixels( $lineoffset+ $x, $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>
+<h2 id="get_pixels_ptr">get_pixels_ptr</h2>
+<div id="get_pixels_ptr_CONTENT">
+<pre> $surface-&gt;get_pixels_ptr();
+
+</pre>
+<p>Returns the C ptr to this surfaces'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="http://search.cpan.org/perldoc?SDL">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>
 </div>
\ No newline at end of file