home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !SDL / man / SDL_BlitSurface.3 < prev    next >
Encoding:
Text File  |  2006-09-20  |  3.3 KB  |  93 lines

  1. <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
  2. <!-- available at http://polyglotman.sourceforge.net/ -->
  3.  
  4. <html>
  5. <head>
  6. <title>"SDL_BlitSurface"("3") manual page</title>
  7. </head>
  8. <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
  9. <a href='#toc'>Table of Contents</a><p>
  10.  
  11. <h2><a name='sect0' href='#toc0'>Name</a></h2>
  12. SDL_BlitSurface- This performs a fast blit from the source surface to
  13. the destination surface. 
  14. <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
  15. <p>
  16. <b>#include "SDL.h" <p>
  17. </b><b>int <b>SDL_BlitSurface</b></b>(<b>SDL_Surface
  18. *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect</b>); 
  19. <h2><a name='sect2' href='#toc2'>Description</a></h2>
  20. <p>
  21. This
  22. performs a fast blit from the source surface to the destination surface.
  23. <p>
  24. Only the position is used in the <b>dstrect</b> (the width and height are ignored).
  25. <p>
  26. If either <b>srcrect</b> or <b>dstrect</b> are <b>NULL</b>, the entire surface (<b>src</b> or <b>dst</b>)
  27. is copied. <p>
  28. The final blit rectangle is saved in <b>dstrect</b> after all clipping
  29. is performed (<b>srcrect</b> is not modified). <p>
  30. The blit function should not be
  31. called on a locked surface. <p>
  32. The results of blitting operations vary greatly
  33. depending on whether <b>SDL_SRCAPLHA</b> is set or not. See <i>SDL_SetAlpha</i> for an
  34. explaination of how this affects your results. Colorkeying and alpha attributes
  35. also interact with surface blitting, as the following pseudo-code should
  36. hopefully explain.  <p>
  37. <br>
  38. <pre>CWif (source surface has SDL_SRCALPHA set) {
  39.     if (source surface has alpha channel (that is, format->Amask != 0))
  40.         blit using per-pixel alpha, ignoring any colour key
  41.     else {
  42.         if (source surface has SDL_SRCCOLORKEY set)
  43.             blit using the colour key AND the per-surface alpha value
  44.         else
  45.             blit using the per-surface alpha value
  46.     }
  47. } else {
  48.     if (source surface has SDL_SRCCOLORKEY set)
  49.         blit using the colour key
  50.     else
  51.         ordinary opaque rectangular blit
  52. }
  53. </pre><p>
  54.  
  55. <h2><a name='sect3' href='#toc3'>Return Value</a></h2>
  56. <p>
  57. If the blit is successful, it returns <b>0</b>, otherwise it returns
  58. <b>-1</b>. <p>
  59. If either of the surfaces were in video memory, and the blit returns
  60. <b>-2</b>, the video memory was lost, so it should be reloaded with artwork and
  61. re-blitted:  <p>
  62. <br>
  63. <pre>CW        while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2
  64. ) {
  65.                 while ( SDL_LockSurface(image)) < 0 )
  66.                         Sleep(10);
  67.                 -- Write image pixels to image->pixels --
  68.                 SDL_UnlockSurface(image);
  69.         }
  70. </pre><p>
  71.  This happens under DirectX 5.0 when the system switches away from your
  72. fullscreen application. Locking the surface will also fail until you have
  73. access to the video memory again.<br>
  74.  
  75. <h2><a name='sect4' href='#toc4'>See Also</a></h2>
  76. <p>
  77. <i><b>SDL_LockSurface</b></i>, <i><b>SDL_FillRect</b></i>, <i><b>SDL_Surface</b></i>, <i><b>SDL_Rect</b></i> 
  78. <!--
  79.   
  80.  <p>
  81.  
  82. <hr><p>
  83. <a name='toc'><b>Table of Contents</b></a><p>
  84. <ul>
  85. <li><a name='toc0' href='#sect0'>Name</a></li>
  86. <li><a name='toc1' href='#sect1'>Synopsis</a></li>
  87. <li><a name='toc2' href='#sect2'>Description</a></li>
  88. <li><a name='toc3' href='#sect3'>Return Value</a></li>
  89. <li><a name='toc4' href='#sect4'>See Also</a></li>
  90. </ul>
  91. </body>
  92. </html>
  93.