home *** CD-ROM | disk | FTP | other *** search
- <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
- <!-- available at http://polyglotman.sourceforge.net/ -->
-
- <html>
- <head>
- <title>"SDL_BlitSurface"("3") manual page</title>
- </head>
- <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
- <a href='#toc'>Table of Contents</a><p>
-
- <h2><a name='sect0' href='#toc0'>Name</a></h2>
- SDL_BlitSurface- This performs a fast blit from the source surface to
- the destination surface.
- <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
- <p>
- <b>#include "SDL.h" <p>
- </b><b>int <b>SDL_BlitSurface</b></b>(<b>SDL_Surface
- *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect</b>);
- <h2><a name='sect2' href='#toc2'>Description</a></h2>
- <p>
- This
- performs a fast blit from the source surface to the destination surface.
- <p>
- Only the position is used in the <b>dstrect</b> (the width and height are ignored).
- <p>
- If either <b>srcrect</b> or <b>dstrect</b> are <b>NULL</b>, the entire surface (<b>src</b> or <b>dst</b>)
- is copied. <p>
- The final blit rectangle is saved in <b>dstrect</b> after all clipping
- is performed (<b>srcrect</b> is not modified). <p>
- The blit function should not be
- called on a locked surface. <p>
- The results of blitting operations vary greatly
- depending on whether <b>SDL_SRCAPLHA</b> is set or not. See <i>SDL_SetAlpha</i> for an
- explaination of how this affects your results. Colorkeying and alpha attributes
- also interact with surface blitting, as the following pseudo-code should
- hopefully explain. <p>
- <br>
- <pre>CWif (source surface has SDL_SRCALPHA set) {
- if (source surface has alpha channel (that is, format->Amask != 0))
- blit using per-pixel alpha, ignoring any colour key
- else {
- if (source surface has SDL_SRCCOLORKEY set)
- blit using the colour key AND the per-surface alpha value
- else
- blit using the per-surface alpha value
- }
- } else {
- if (source surface has SDL_SRCCOLORKEY set)
- blit using the colour key
- else
- ordinary opaque rectangular blit
- }
- </pre><p>
-
- <h2><a name='sect3' href='#toc3'>Return Value</a></h2>
- <p>
- If the blit is successful, it returns <b>0</b>, otherwise it returns
- <b>-1</b>. <p>
- If either of the surfaces were in video memory, and the blit returns
- <b>-2</b>, the video memory was lost, so it should be reloaded with artwork and
- re-blitted: <p>
- <br>
- <pre>CW while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2
- ) {
- while ( SDL_LockSurface(image)) < 0 )
- Sleep(10);
- -- Write image pixels to image->pixels --
- SDL_UnlockSurface(image);
- }
- </pre><p>
- This happens under DirectX 5.0 when the system switches away from your
- fullscreen application. Locking the surface will also fail until you have
- access to the video memory again.<br>
-
- <h2><a name='sect4' href='#toc4'>See Also</a></h2>
- <p>
- <i><b>SDL_LockSurface</b></i>, <i><b>SDL_FillRect</b></i>, <i><b>SDL_Surface</b></i>, <i><b>SDL_Rect</b></i>
- <!--
-
- <p>
-
- <hr><p>
- <a name='toc'><b>Table of Contents</b></a><p>
- <ul>
- <li><a name='toc0' href='#sect0'>Name</a></li>
- <li><a name='toc1' href='#sect1'>Synopsis</a></li>
- <li><a name='toc2' href='#sect2'>Description</a></li>
- <li><a name='toc3' href='#sect3'>Return Value</a></li>
- <li><a name='toc4' href='#sect4'>See Also</a></li>
- </ul>
- </body>
- </html>
-