annotate docs/man3/SDL_SetAlpha.3 @ 1584:b786d9c15e42

Fixed bug #61 Date: Mon, 24 Feb 2003 13:35:11 +0800 From: "Leonidas" Subject: [SDL] Re: Trigger mouse wheel event -- not in X-environment I have looked into the codes for the IMPS/2 mouse wheel mode of fbcon driver. But I found something weird. Here's the original codes to set a mouse device into IMPS/2 mode in libSDL. In the file src/video/fbcon/SDL_fbevents.c In function static int set_imps2_mode(int fd) ... Uint8 set_imps2[] = {0xf3, 200, 0xf3, 100, 0xf3, 80}; Uint8 reset = 0xff; fd_set fdset; struct timeval tv; int retval = 0; // Set mouse device fd into IMPS/2 mode if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) { // ??? then RESET it..??? if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) { retval = 1; } } ........... Since it sets IMPS/2 mode then reset it, so you will never get a mouse into IMPS/2 mode to use its wheel. What I did to make the wheel usable is remove the RESET codes. .... if ( write(fd, &set_imps2, sizeof(set_imps2)) == sizeof(set_imps2) ) { /* if (write(fd, &reset, sizeof (reset)) == sizeof (reset) ) { } */ retval = 1; } .... And in FB_OpenMouse(_THIS) Make the device /dev/psaux to be setted into imps2 mode such that it can be detected its a imps/2 mouse or not. (my mouse device is on ps2, but the codes only set /dev/input/mice device originally) Then I have done, I can use the mouse wheel when SDL uses frame buff driver. I dont exactly know I did right or wrong, I just change it for my usuage. Correct me please, if I did something wrong. Best regards, Li Tsung Lin IAP Product Dept. Engineer EeRise Corp. (Image Processing System, Computer Vision System) Hsin Tien, Taipei Hsien, Taiwan, R.O.C.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 22 Mar 2006 07:22:40 +0000
parents e5bc29de3f0a
children 546f7c1eb755
rev   line source
181
e5bc29de3f0a Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents: 55
diff changeset
1 .TH "SDL_SetAlpha" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 .SH "NAME"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
3 SDL_SetAlpha\- Adjust the alpha properties of a surface
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4 .SH "SYNOPSIS"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 \fB#include "SDL\&.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 .sp
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 \fBint \fBSDL_SetAlpha\fP\fR(\fBSDL_Surface *surface, Uint32 flag, Uint8 alpha\fR);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9 .SH "DESCRIPTION"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 .RS
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 \fBNote:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14 This function and the semantics of SDL alpha blending have changed since version 1\&.1\&.4\&. Up until version 1\&.1\&.5, an alpha value of 0 was considered opaque and a value of 255 was considered transparent\&. This has now been inverted: 0 (\fBSDL_ALPHA_TRANSPARENT\fP) is now considered transparent and 255 (\fBSDL_ALPHA_OPAQUE\fP) is now considered opaque\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 .RE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 .PP
55
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
17 \fBSDL_SetAlpha\fP is used for setting the per-surface alpha value and/or enabling and disabling alpha blending\&.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18 .PP
55
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
19 The\fBsurface\fR parameter specifies which surface whose alpha attributes you wish to adjust\&. \fBflags\fR is used to specify whether alpha blending should be used (\fBSDL_SRCALPHA\fP) and whether the surface should use RLE acceleration for blitting (\fBSDL_RLEACCEL\fP)\&. \fBflags\fR can be an OR\&'d combination of these two options, one of these options or 0\&. If \fBSDL_SRCALPHA\fP is not passed as a flag then all alpha information is ignored when blitting the surface\&. The \fBalpha\fR parameter is the per-surface alpha value; a surface need not have an alpha channel to use per-surface alpha and blitting can still be accelerated with \fBSDL_RLEACCEL\fP\&.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
20 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 .RS
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22 \fBNote:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 The per-surface alpha value of 128 is considered a special case and is optimised, so it\&'s much faster than other per-surface values\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 .RE
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 Alpha effects surface blitting in the following ways:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 RGBA->RGB with \fBSDL_SRCALPHA\fP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30 The source is alpha-blended with the destination, using the alpha channel\&. \fBSDL_SRCCOLORKEY\fP and the per-surface alpha are ignored\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 RGBA->RGB without \fBSDL_SRCALPHA\fP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 The RGB data is copied from the source\&. The source alpha channel and the per-surface alpha value are ignored\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 RGB->RGBA with \fBSDL_SRCALPHA\fP
55
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
36 The source is alpha-blended with the destination using the per-surface alpha value\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. The alpha channel of the copied pixels is set to opaque\&.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
38 RGB->RGBA without \fBSDL_SRCALPHA\fP
55
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
39 The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 RGBA->RGBA with \fBSDL_SRCALPHA\fP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 The source is alpha-blended with the destination using the source alpha channel\&. The alpha channel in the destination surface is left untouched\&. \fBSDL_SRCCOLORKEY\fP is ignored\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 RGBA->RGBA without \fBSDL_SRCALPHA\fP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 The RGBA data is copied to the destination surface\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47 RGB->RGB with \fBSDL_SRCALPHA\fP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 The source is alpha-blended with the destination using the per-surface alpha value\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 .TP 20
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50 RGB->RGB without \fBSDL_SRCALPHA\fP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 The RGB data is copied from the source\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&.
55
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
52 .PP
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
53 .RS
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
54 \fBNote:
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
55 .PP
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
56 Note that RGBA->RGBA blits (with SDL_SRCALPHA set) keep the alpha of the destination surface\&. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask\&.
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
57 .PP
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
58 Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
59 .RE
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
60 .SH "RETURN VALUE"
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
61 .PP
55f1f1b3e27d Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
62 This function returns \fB0\fR, or \fB-1\fR if there was an error\&.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63 .SH "SEE ALSO"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 .PP
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
65 \fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_DisplayFormatAlpha\fP\fR, \fI\fBSDL_BlitSurface\fP\fR
181
e5bc29de3f0a Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents: 55
diff changeset
66 ...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01