|
1 .TH "SDL_BlitSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference" |
|
2 .SH "NAME" |
|
3 SDL_BlitSurface \- This performs a fast blit from the source surface to the destination surface\&. |
|
4 .SH "SYNOPSIS" |
|
5 .PP |
|
6 \fB#include "SDL\&.h" |
|
7 .sp |
|
8 \fBint \fBSDL_BlitSurface\fP\fR(\fBSDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect\fR); |
|
9 .SH "DESCRIPTION" |
|
10 .PP |
|
11 This performs a fast blit from the source surface to the destination surface\&. |
|
12 .PP |
|
13 Only the position is used in the \fBdstrect\fR (the width and height are ignored)\&. |
|
14 .PP |
|
15 If either \fBsrcrect\fR or \fBdstrect\fR are \fBNULL\fP, the entire surface (\fBsrc\fR or \fBdst\fR) is copied\&. |
|
16 .PP |
|
17 The final blit rectangle is saved in \fBdstrect\fR after all clipping is performed (\fBsrcrect\fR is not modified)\&. |
|
18 .PP |
|
19 The blit function should not be called on a locked surface\&. |
|
20 .PP |
|
21 The results of blitting operations vary greatly depending on whether \fBSDL_SRCAPLHA\fP is set or not\&. See \fISDL_SetAlpha\fR 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\&. |
|
22 .PP |
|
23 .nf |
|
24 \f(CWif (source surface has SDL_SRCALPHA set) { |
|
25 if (source surface has alpha channel (that is, format->Amask != 0)) |
|
26 blit using per-pixel alpha, ignoring any colour key |
|
27 else { |
|
28 if (source surface has SDL_SRCCOLORKEY set) |
|
29 blit using the colour key AND the per-surface alpha value |
|
30 else |
|
31 blit using the per-surface alpha value |
|
32 } |
|
33 } else { |
|
34 if (source surface has SDL_SRCCOLORKEY set) |
|
35 blit using the colour key |
|
36 else |
|
37 ordinary opaque rectangular blit |
|
38 }\fR |
|
39 .fi |
|
40 .PP |
|
41 .SH "RETURN VALUE" |
|
42 .PP |
|
43 If the blit is successful, it returns \fB0\fR, otherwise it returns \fB-1\fR\&. |
|
44 .PP |
|
45 If either of the surfaces were in video memory, and the blit returns \fB-2\fR, the video memory was lost, so it should be reloaded with artwork and re-blitted: |
|
46 .PP |
|
47 .nf |
|
48 \f(CW while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { |
|
49 while ( SDL_LockSurface(image)) < 0 ) |
|
50 Sleep(10); |
|
51 -- Write image pixels to image->pixels -- |
|
52 SDL_UnlockSurface(image); |
|
53 }\fR |
|
54 .fi |
|
55 .PP |
|
56 This happens under DirectX 5\&.0 when the system switches away from your fullscreen application\&. Locking the surface will also fail until you have access to the video memory again\&. |
|
57 .SH "SEE ALSO" |
|
58 .PP |
|
59 \fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_FillRect\fP\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_Rect\fR\fR |
|
60 ...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01 |