0
|
1 <HTML
|
|
2 ><HEAD
|
|
3 ><TITLE
|
|
4 >SDL_BlitSurface</TITLE
|
|
5 ><META
|
|
6 NAME="GENERATOR"
|
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.61
|
|
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="AEN1806"
|
|
77 ></A
|
|
78 ><H2
|
|
79 >Name</H2
|
|
80 >SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.</DIV
|
|
81 ><DIV
|
|
82 CLASS="REFSYNOPSISDIV"
|
|
83 ><A
|
|
84 NAME="AEN1809"
|
|
85 ></A
|
|
86 ><H2
|
|
87 >Synopsis</H2
|
|
88 ><DIV
|
|
89 CLASS="FUNCSYNOPSIS"
|
|
90 ><A
|
|
91 NAME="AEN1810"
|
|
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="AEN1816"
|
|
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 ><DIV
|
|
174 CLASS="NOTE"
|
|
175 ><BLOCKQUOTE
|
|
176 CLASS="NOTE"
|
|
177 ><P
|
|
178 ><B
|
|
179 >Note: </B
|
|
180 >The results of blitting operations vary greatly depending on whether <TT
|
|
181 CLASS="LITERAL"
|
|
182 >SDL_SRCAPLHA</TT
|
|
183 > is set or not. See <A
|
|
184 HREF="sdlsetalpha.html"
|
|
185 >SDL_SetAlpha</A
|
|
186 >.</P
|
|
187 ></BLOCKQUOTE
|
|
188 ></DIV
|
|
189 ></DIV
|
|
190 ><DIV
|
|
191 CLASS="REFSECT1"
|
|
192 ><A
|
|
193 NAME="AEN1835"
|
|
194 ></A
|
|
195 ><H2
|
|
196 >Return Value</H2
|
|
197 ><P
|
|
198 >If the blit is successful, it returns <SPAN
|
|
199 CLASS="RETURNVALUE"
|
|
200 >0</SPAN
|
|
201 >,
|
|
202 otherwise it returns <SPAN
|
|
203 CLASS="RETURNVALUE"
|
|
204 >-1</SPAN
|
|
205 >.</P
|
|
206 ><P
|
|
207 >If either of the surfaces were in video memory, and the blit returns
|
|
208 <SPAN
|
|
209 CLASS="RETURNVALUE"
|
|
210 >-2</SPAN
|
|
211 >, the video memory was lost, so it should be
|
|
212 reloaded with artwork and re-blitted:
|
|
213 <PRE
|
|
214 CLASS="PROGRAMLISTING"
|
|
215 > while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
|
|
216 while ( SDL_LockSurface(image)) < 0 )
|
|
217 Sleep(10);
|
|
218 -- Write image pixels to image->pixels --
|
|
219 SDL_UnlockSurface(image);
|
|
220 }</PRE
|
|
221 >
|
|
222 This happens under DirectX 5.0 when the system switches away from your
|
|
223 fullscreen application. Locking the surface will also fail until you
|
|
224 have access to the video memory again.</P
|
|
225 ></DIV
|
|
226 ><DIV
|
|
227 CLASS="REFSECT1"
|
|
228 ><A
|
|
229 NAME="AEN1843"
|
|
230 ></A
|
|
231 ><H2
|
|
232 >See Also</H2
|
|
233 ><P
|
|
234 ><A
|
|
235 HREF="sdllocksurface.html"
|
|
236 ><TT
|
|
237 CLASS="FUNCTION"
|
|
238 >SDL_LockSurface</TT
|
|
239 ></A
|
|
240 >,
|
|
241 <A
|
|
242 HREF="sdlfillrect.html"
|
|
243 ><TT
|
|
244 CLASS="FUNCTION"
|
|
245 >SDL_FillRect</TT
|
|
246 ></A
|
|
247 >,
|
|
248 <A
|
|
249 HREF="sdlsurface.html"
|
|
250 ><SPAN
|
|
251 CLASS="STRUCTNAME"
|
|
252 >SDL_Surface</SPAN
|
|
253 ></A
|
|
254 >,
|
|
255 <A
|
|
256 HREF="sdlrect.html"
|
|
257 ><SPAN
|
|
258 CLASS="STRUCTNAME"
|
|
259 >SDL_Rect</SPAN
|
|
260 ></A
|
|
261 ></P
|
|
262 ></DIV
|
|
263 ><DIV
|
|
264 CLASS="NAVFOOTER"
|
|
265 ><HR
|
|
266 ALIGN="LEFT"
|
|
267 WIDTH="100%"><TABLE
|
|
268 WIDTH="100%"
|
|
269 BORDER="0"
|
|
270 CELLPADDING="0"
|
|
271 CELLSPACING="0"
|
|
272 ><TR
|
|
273 ><TD
|
|
274 WIDTH="33%"
|
|
275 ALIGN="left"
|
|
276 VALIGN="top"
|
|
277 ><A
|
|
278 HREF="sdlconvertsurface.html"
|
|
279 >Prev</A
|
|
280 ></TD
|
|
281 ><TD
|
|
282 WIDTH="34%"
|
|
283 ALIGN="center"
|
|
284 VALIGN="top"
|
|
285 ><A
|
|
286 HREF="index.html"
|
|
287 >Home</A
|
|
288 ></TD
|
|
289 ><TD
|
|
290 WIDTH="33%"
|
|
291 ALIGN="right"
|
|
292 VALIGN="top"
|
|
293 ><A
|
|
294 HREF="sdlfillrect.html"
|
|
295 >Next</A
|
|
296 ></TD
|
|
297 ></TR
|
|
298 ><TR
|
|
299 ><TD
|
|
300 WIDTH="33%"
|
|
301 ALIGN="left"
|
|
302 VALIGN="top"
|
|
303 >SDL_ConvertSurface</TD
|
|
304 ><TD
|
|
305 WIDTH="34%"
|
|
306 ALIGN="center"
|
|
307 VALIGN="top"
|
|
308 ><A
|
|
309 HREF="video.html"
|
|
310 >Up</A
|
|
311 ></TD
|
|
312 ><TD
|
|
313 WIDTH="33%"
|
|
314 ALIGN="right"
|
|
315 VALIGN="top"
|
|
316 >SDL_FillRect</TD
|
|
317 ></TR
|
|
318 ></TABLE
|
|
319 ></DIV
|
|
320 ></BODY
|
|
321 ></HTML
|
|
322 > |