4 >SDL_BlitSurface</TITLE
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
10 TITLE="SDL Library Documentation"
11 HREF="index.html"><LINK
14 HREF="video.html"><LINK
16 TITLE="SDL_ConvertSurface"
17 HREF="sdlconvertsurface.html"><LINK
20 HREF="sdlfillrect.html"></HEAD
31 SUMMARY="Header navigation table"
40 >SDL Library Documentation</TH
48 HREF="sdlconvertsurface.html"
62 HREF="sdlfillrect.html"
83 >SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.</DIV
85 CLASS="REFSYNOPSISDIV"
99 CLASS="FUNCSYNOPSISINFO"
100 >#include "SDL.h"</PRE
109 >(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);</CODE
123 >This performs a fast blit from the source surface to the destination surface.</P
125 >The width and height in <TT
131 size of the copied rectangle. Only the position is used in the
137 > (the width and height are ignored).</P
148 entire surface is copied. If <TT
157 >, then the destination position (upper left
158 corner) is (0, 0).</P
160 >The final blit rectangle is saved in
166 > after all clipping is performed
172 > is not modified).</P
174 >The blit function should not be called on a locked surface.</P
176 >The results of blitting operations vary greatly depending on whether <TT
179 > is set or not. See <A
180 HREF="sdlsetalpha.html"
182 > 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.
184 CLASS="PROGRAMLISTING"
185 >if (source surface has SDL_SRCALPHA set) {
186 if (source surface has alpha channel (that is, format->Amask != 0))
187 blit using per-pixel alpha, ignoring any colour key
189 if (source surface has SDL_SRCCOLORKEY set)
190 blit using the colour key AND the per-surface alpha value
192 blit using the per-surface alpha value
195 if (source surface has SDL_SRCCOLORKEY set)
196 blit using the colour key
198 ordinary opaque rectangular blit
210 >If the blit is successful, it returns <SPAN
214 otherwise it returns <SPAN
219 >If either of the surfaces were in video memory, and the blit returns
223 >, the video memory was lost, so it should be
224 reloaded with artwork and re-blitted:
226 CLASS="PROGRAMLISTING"
227 > while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
228 while ( SDL_LockSurface(image)) < 0 )
230 -- Write image pixels to image->pixels --
231 SDL_UnlockSurface(image);
234 This happens under DirectX 5.0 when the system switches away from your
235 fullscreen application. Locking the surface will also fail until you
236 have access to the video memory again.</P
247 HREF="sdllocksurface.html"
254 HREF="sdlfillrect.html"
261 HREF="sdlsurface.html"
280 SUMMARY="Footer navigation table"
291 HREF="sdlconvertsurface.html"
309 HREF="sdlfillrect.html"
319 >SDL_ConvertSurface</TD