1SDL_BlitSurface(3)             SDL API Reference            SDL_BlitSurface(3)
2
3
4

NAME

6       SDL_BlitSurface  - This performs a fast blit from the source surface to
7       the destination surface.
8

SYNOPSIS

10       #include "SDL.h"
11
12       int SDL_BlitSurface(SDL_Surface *src,  SDL_Rect  *srcrect,  SDL_Surface
13       *dst, SDL_Rect *dstrect);
14

DESCRIPTION

16       This  performs  a  fast blit from the source surface to the destination
17       surface.
18
19       Only the position is used in the dstrect  (the  width  and  height  are
20       ignored).
21
22       If  either srcrect or dstrect are NULL, the entire surface (src or dst)
23       is copied.
24
25       The final blit rectangle is saved in dstrect after all clipping is per‐
26       formed (srcrect is not modified).
27
28       The blit function should not be called on a locked surface.
29
30       The  results  of  blitting operations vary greatly depending on whether
31       SDL_SRCAPLHA is set or not. See SDL_SetAlpha for an explaination of how
32       this affects your results. Colorkeying and alpha attributes also inter‐
33       act with surface blitting, as the following  pseudo-code  should  hope‐
34       fully explain.
35
36       if (source surface has SDL_SRCALPHA set) {
37           if (source surface has alpha channel (that is, format->Amask != 0))
38               blit using per-pixel alpha, ignoring any colour key
39           else {
40               if (source surface has SDL_SRCCOLORKEY set)
41                   blit using the colour key AND the per-surface alpha value
42               else
43                   blit using the per-surface alpha value
44           }
45       } else {
46           if (source surface has SDL_SRCCOLORKEY set)
47               blit using the colour key
48           else
49               ordinary opaque rectangular blit
50       }
51

RETURN VALUE

53       If the blit is successful, it returns 0, otherwise it returns -1.
54
55       If  either  of  the surfaces were in video memory, and the blit returns
56       -2, the video memory was lost, so it should be  reloaded  with  artwork
57       and re-blitted:
58
59               while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
60                       while ( SDL_LockSurface(image)) < 0 )
61                               Sleep(10);
62                       -- Write image pixels to image->pixels --
63                       SDL_UnlockSurface(image);
64               }
65
66        This happens under DirectX 5.0 when the system switches away from your
67       fullscreen application. Locking the surface will also  fail  until  you
68       have access to the video memory again.
69

SEE ALSO

71       SDL_LockSurface, SDL_FillRect, SDL_Surface, SDL_Rect
72
73
74
75SDL                         Tue 11 Sep 2001, 23:01          SDL_BlitSurface(3)
Impressum