Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. <HTML
  2. ><HEAD
  3. ><TITLE
  4. >SDL_BlitSurface</TITLE
  5. ><META
  6. NAME="GENERATOR"
  7. CONTENT="Modular DocBook HTML Stylesheet Version 1.64
  8. "><LINK
  9. REL="HOME"
  10. TITLE="SDL Library Documentation"
  11. HREF="index.html"><LINK
  12. REL="UP"
  13. TITLE="Video"
  14. HREF="video.html"><LINK
  15. REL="PREVIOUS"
  16. TITLE="SDL_ConvertSurface"
  17. HREF="sdlconvertsurface.html"><LINK
  18. REL="NEXT"
  19. TITLE="SDL_FillRect"
  20. HREF="sdlfillrect.html"></HEAD
  21. ><BODY
  22. CLASS="REFENTRY"
  23. BGCOLOR="#FFF8DC"
  24. TEXT="#000000"
  25. LINK="#0000ee"
  26. VLINK="#551a8b"
  27. ALINK="#ff0000"
  28. ><DIV
  29. CLASS="NAVHEADER"
  30. ><TABLE
  31. WIDTH="100%"
  32. BORDER="0"
  33. CELLPADDING="0"
  34. CELLSPACING="0"
  35. ><TR
  36. ><TH
  37. COLSPAN="3"
  38. ALIGN="center"
  39. >SDL Library Documentation</TH
  40. ></TR
  41. ><TR
  42. ><TD
  43. WIDTH="10%"
  44. ALIGN="left"
  45. VALIGN="bottom"
  46. ><A
  47. HREF="sdlconvertsurface.html"
  48. >Prev</A
  49. ></TD
  50. ><TD
  51. WIDTH="80%"
  52. ALIGN="center"
  53. VALIGN="bottom"
  54. ></TD
  55. ><TD
  56. WIDTH="10%"
  57. ALIGN="right"
  58. VALIGN="bottom"
  59. ><A
  60. HREF="sdlfillrect.html"
  61. >Next</A
  62. ></TD
  63. ></TR
  64. ></TABLE
  65. ><HR
  66. ALIGN="LEFT"
  67. WIDTH="100%"></DIV
  68. ><H1
  69. ><A
  70. NAME="SDLBLITSURFACE"
  71. >SDL_BlitSurface</A
  72. ></H1
  73. ><DIV
  74. CLASS="REFNAMEDIV"
  75. ><A
  76. NAME="AEN1883"
  77. ></A
  78. ><H2
  79. >Name</H2
  80. >SDL_BlitSurface&nbsp;--&nbsp;This performs a fast blit from the source surface to the destination surface.</DIV
  81. ><DIV
  82. CLASS="REFSYNOPSISDIV"
  83. ><A
  84. NAME="AEN1886"
  85. ></A
  86. ><H2
  87. >Synopsis</H2
  88. ><DIV
  89. CLASS="FUNCSYNOPSIS"
  90. ><A
  91. NAME="AEN1887"
  92. ></A
  93. ><P
  94. ></P
  95. ><PRE
  96. CLASS="FUNCSYNOPSISINFO"
  97. >#include "SDL.h"</PRE
  98. ><P
  99. ><CODE
  100. ><CODE
  101. CLASS="FUNCDEF"
  102. >int <B
  103. CLASS="FSFUNC"
  104. >SDL_BlitSurface</B
  105. ></CODE
  106. >(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);</CODE
  107. ></P
  108. ><P
  109. ></P
  110. ></DIV
  111. ></DIV
  112. ><DIV
  113. CLASS="REFSECT1"
  114. ><A
  115. NAME="AEN1893"
  116. ></A
  117. ><H2
  118. >Description</H2
  119. ><P
  120. >This performs a fast blit from the source surface to the destination surface.</P
  121. ><P
  122. >Only the position is used in the <TT
  123. CLASS="PARAMETER"
  124. ><I
  125. >dstrect</I
  126. ></TT
  127. > (the
  128. width and height are ignored).</P
  129. ><P
  130. >If either <TT
  131. CLASS="PARAMETER"
  132. ><I
  133. >srcrect</I
  134. ></TT
  135. > or
  136. <TT
  137. CLASS="PARAMETER"
  138. ><I
  139. >dstrect</I
  140. ></TT
  141. > are <TT
  142. CLASS="LITERAL"
  143. >NULL</TT
  144. >, the entire
  145. surface (<TT
  146. CLASS="PARAMETER"
  147. ><I
  148. >src</I
  149. ></TT
  150. > or <TT
  151. CLASS="PARAMETER"
  152. ><I
  153. >dst</I
  154. ></TT
  155. >) is
  156. copied.</P
  157. ><P
  158. >The final blit rectangle is saved in
  159. <TT
  160. CLASS="PARAMETER"
  161. ><I
  162. >dstrect</I
  163. ></TT
  164. > after all clipping is performed
  165. (<TT
  166. CLASS="PARAMETER"
  167. ><I
  168. >srcrect</I
  169. ></TT
  170. > is not modified).</P
  171. ><P
  172. >The blit function should not be called on a locked surface.</P
  173. ><P
  174. >The results of blitting operations vary greatly depending on whether <TT
  175. CLASS="LITERAL"
  176. >SDL_SRCAPLHA</TT
  177. > is set or not. See <A
  178. HREF="sdlsetalpha.html"
  179. >SDL_SetAlpha</A
  180. > 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.
  181. <PRE
  182. CLASS="PROGRAMLISTING"
  183. >if (source surface has SDL_SRCALPHA set) {
  184.     if (source surface has alpha channel (that is, format-&#62;Amask != 0))
  185.         blit using per-pixel alpha, ignoring any colour key
  186.     else {
  187.         if (source surface has SDL_SRCCOLORKEY set)
  188.             blit using the colour key AND the per-surface alpha value
  189.         else
  190.             blit using the per-surface alpha value
  191.     }
  192. } else {
  193.     if (source surface has SDL_SRCCOLORKEY set)
  194.         blit using the colour key
  195.     else
  196.         ordinary opaque rectangular blit
  197. }</PRE
  198. ></P
  199. ></DIV
  200. ><DIV
  201. CLASS="REFSECT1"
  202. ><A
  203. NAME="AEN1912"
  204. ></A
  205. ><H2
  206. >Return Value</H2
  207. ><P
  208. >If the blit is successful, it returns <SPAN
  209. CLASS="RETURNVALUE"
  210. >0</SPAN
  211. >,
  212. otherwise it returns <SPAN
  213. CLASS="RETURNVALUE"
  214. >-1</SPAN
  215. >.</P
  216. ><P
  217. >If either of the surfaces were in video memory, and the blit returns
  218. <SPAN
  219. CLASS="RETURNVALUE"
  220. >-2</SPAN
  221. >, the video memory was lost, so it should be
  222. reloaded with artwork and re-blitted:
  223. <PRE
  224. CLASS="PROGRAMLISTING"
  225. >        while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
  226.                 while ( SDL_LockSurface(image)) &#60; 0 )
  227.                         Sleep(10);
  228.                 -- Write image pixels to image-&#62;pixels --
  229.                 SDL_UnlockSurface(image);
  230.         }</PRE
  231. >
  232. This happens under DirectX 5.0 when the system switches away from your
  233. fullscreen application.  Locking the surface will also fail until you
  234. have access to the video memory again.</P
  235. ></DIV
  236. ><DIV
  237. CLASS="REFSECT1"
  238. ><A
  239. NAME="AEN1920"
  240. ></A
  241. ><H2
  242. >See Also</H2
  243. ><P
  244. ><A
  245. HREF="sdllocksurface.html"
  246. ><TT
  247. CLASS="FUNCTION"
  248. >SDL_LockSurface</TT
  249. ></A
  250. >,
  251. <A
  252. HREF="sdlfillrect.html"
  253. ><TT
  254. CLASS="FUNCTION"
  255. >SDL_FillRect</TT
  256. ></A
  257. >,
  258. <A
  259. HREF="sdlsurface.html"
  260. ><SPAN
  261. CLASS="STRUCTNAME"
  262. >SDL_Surface</SPAN
  263. ></A
  264. >,
  265. <A
  266. HREF="sdlrect.html"
  267. ><SPAN
  268. CLASS="STRUCTNAME"
  269. >SDL_Rect</SPAN
  270. ></A
  271. ></P
  272. ></DIV
  273. ><DIV
  274. CLASS="NAVFOOTER"
  275. ><HR
  276. ALIGN="LEFT"
  277. WIDTH="100%"><TABLE
  278. WIDTH="100%"
  279. BORDER="0"
  280. CELLPADDING="0"
  281. CELLSPACING="0"
  282. ><TR
  283. ><TD
  284. WIDTH="33%"
  285. ALIGN="left"
  286. VALIGN="top"
  287. ><A
  288. HREF="sdlconvertsurface.html"
  289. >Prev</A
  290. ></TD
  291. ><TD
  292. WIDTH="34%"
  293. ALIGN="center"
  294. VALIGN="top"
  295. ><A
  296. HREF="index.html"
  297. >Home</A
  298. ></TD
  299. ><TD
  300. WIDTH="33%"
  301. ALIGN="right"
  302. VALIGN="top"
  303. ><A
  304. HREF="sdlfillrect.html"
  305. >Next</A
  306. ></TD
  307. ></TR
  308. ><TR
  309. ><TD
  310. WIDTH="33%"
  311. ALIGN="left"
  312. VALIGN="top"
  313. >SDL_ConvertSurface</TD
  314. ><TD
  315. WIDTH="34%"
  316. ALIGN="center"
  317. VALIGN="top"
  318. ><A
  319. HREF="video.html"
  320. >Up</A
  321. ></TD
  322. ><TD
  323. WIDTH="33%"
  324. ALIGN="right"
  325. VALIGN="top"
  326. >SDL_FillRect</TD
  327. ></TR
  328. ></TABLE
  329. ></DIV
  330. ></BODY
  331. ></HTML
  332. >