updated docs
[sdlgit/SDL-Site.git] / pages / SDLx-Surface.html-inc
index 873310b..7dea9f4 100644 (file)
 </ul>
 </li>
 <li><a href="#EXTENSIONS">EXTENSIONS</a>
-<ul><li><a href="#blit">blit </a></li>
+<ul><li><a href="#load">load</a></li>
+<li><a href="#blit">blit </a></li>
 <li><a href="#blit_by">blit_by</a></li>
 <li><a href="#flip">flip</a></li>
 <li><a href="#update">update</a></li>
 <li><a href="#draw_rect">draw_rect</a></li>
 <li><a href="#draw_line">draw_line</a></li>
+<li><a href="#draw_gfx_text">draw_gfx_text</a></li>
 </ul>
 </li>
-<li><a href="#AUTHOR">AUTHOR</a>
+<li><a href="#AUTHORS">AUTHORS</a>
 </li>
 </ul><hr />
 <!-- INDEX END -->
 <div id="EXTENSIONS_CONTENT">
 
 </div>
+<h2 id="load">load</h2>
+<div id="load_CONTENT">
+<pre> my $surface = SDLx::Surface-&gt;load( 'hero.png' );
+ my $surface = SDLx::Surface-&gt;load( 'hero.dat', 'bmp' );
+
+</pre>
+<p>Loads the given image file into a <i>new</i> SDLx::Surface surface. A new
+surface is <strong>always</strong> created, even if you call it from an already crafted
+object. Croaks on errors such as no support built for that image extension
+or a file reading error (the error message is SDL::get_error and should
+give more details).</p>
+<p>Note that load() will automatically figure out the extension based on the
+filename you provide. If you wish to force an extension for whatever reason
+(like having a filename with a different extension or none at all), you can
+optionally pass the file type as a second parameter. Case is not relevant.</p>
+<p>If you don't have SDL_image in your build, only bitmap images will be
+supported.</p>
+<p>Returns the new Surface.</p>
+
+
+
+
+
+</div>
 <h2 id="blit">blit </h2>
 <div id="blit_CONTENT">
 <pre> $sdlx_surface-&gt;blit( $dest, $src_rect, $dest_rect );
@@ -200,11 +226,30 @@ This is useful when the surface you have isn't an <code>SDLx::Surface</code>, bu
 <p>Returns $self</p>
 
 </div>
-<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
-<div id="AUTHOR_CONTENT">
-<pre> kthakore 
+<h2 id="draw_gfx_text">draw_gfx_text</h2>
+<div id="draw_gfx_text_CONTENT">
+<p>Draw text using gfx (not pretty but fast) at give vector, color.</p>
+<pre> $surf-&gt;draw_gfx_text( [0,0], 0xffffffff, &quot;fooo&quot;);
+ $surf-&gt;draw_gfx_text( [10,10], [20,20,20,20], &quot;fooo&quot;);
+
+</pre>
+<p>You can also set the gfx font but passing a hash reference as shown below.</p>
+<pre> my $f = '';
+ open( my $FH, '&lt;', 'test/data/5x7.fnt');
+ binmode ($FH);
+ read($FH, $f, 4096);
+ close ($FH);
+
+ my $font =  {data=&gt;$f, cw =&gt; 5, ch =&gt; 7};
+ $surf-&gt;draw_gfx_text( [0,0], 0xffffffff, &quot;fooo&quot;, $font );
 
 </pre>
+<p>Returns $self</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