Mercurial > sdl-ios-xcode
annotate docs/html/sdlcreatergbsurfacefrom.html @ 1259:36f24cdfcda7
te: Thu, 17 Apr 2003 11:25:26 -0700
From: "Jim"
Subject: [SDL] Frame buffer patches...
Would seem that GCC 3.2.2 promotes all signed values to unsigned if any single vlaue is unsigned in an expression...
for instance when calculating an elo touch position....evertyhign is an (int) except for cach_vinfo.xres which is unsigned. THerefore if y
ou reverse the SDL_ELO_MIN_X and SDL_ELO_MAX_X values the resulging negative value pegs the expression to it's max. Attached it the accumu
lated patch to typecast the unsigned values to (int)
- *dx = (cache_vinfo.xres - (cache_vinfo.xres * (input_x - ELO_MIN_X)) / width);
+ *dx = ((int)cache_vinfo.xres - ((int)cache_vinfo.xres * (input_x - ELO_MIN_X)) / width);
and also to provide quite failure to operations which have the screen currently locked...
The touch screen I'm using the original values were exactly opposite of any position I touched on the screen - evaluating the math the expr
ession SHOULD have handled reversing the min and max values - and after casting the unsigned .xres and .yres to a signed int - worked well.
..
Jim
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 24 Jan 2006 06:36:43 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CreateRGBSurfaceFrom</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 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_CreateRGBSurface" | |
17 HREF="sdlcreatergbsurface.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_FreeSurface" | |
20 HREF="sdlfreesurface.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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlcreatergbsurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlfreesurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLCREATERGBSURFACEFROM" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_CreateRGBSurfaceFrom</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN1856" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CreateRGBSurfaceFrom -- Create an SDL_Surface from pixel data</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN1859" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN1860" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >SDL_Surface *<B | |
106 CLASS="FSFUNC" | |
107 >SDL_CreateRGBSurfaceFrom</B | |
108 ></CODE | |
109 >(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);</CODE | |
110 ></P | |
111 ><P | |
112 ></P | |
113 ></DIV | |
114 ></DIV | |
115 ><DIV | |
116 CLASS="REFSECT1" | |
117 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
118 NAME="AEN1866" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 >Creates an SDL_Surface from the provided pixel data.</P | |
124 ><P | |
125 >The data stored in <TT | |
126 CLASS="PARAMETER" | |
127 ><I | |
128 >pixels</I | |
129 ></TT | |
130 > is assumed to be of the <TT | |
131 CLASS="PARAMETER" | |
132 ><I | |
133 >depth</I | |
134 ></TT | |
135 > specified in the parameter list. The pixel data is not copied into the <SPAN | |
136 CLASS="STRUCTNAME" | |
137 >SDL_Surface</SPAN | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
138 > structure so it should not be freed until the surface has been freed with a called to <A |
0 | 139 HREF="sdlfreesurface.html" |
140 >SDL_FreeSurface</A | |
141 >. <TT | |
142 CLASS="PARAMETER" | |
143 ><I | |
144 >pitch</I | |
145 ></TT | |
146 > is the length of each scanline in bytes. </P | |
147 ><P | |
148 >See <A | |
149 HREF="sdlcreatergbsurface.html" | |
150 ><TT | |
151 CLASS="FUNCTION" | |
152 >SDL_CreateRGBSurface</TT | |
153 ></A | |
154 > for a more detailed description of the other parameters.</P | |
155 ></DIV | |
156 ><DIV | |
157 CLASS="REFSECT1" | |
158 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
159 NAME="AEN1878" |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
160 ></A |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
161 ><H2 |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
162 >Return Value</H2 |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
163 ><P |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
164 >Returns the created surface, or <SPAN |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
165 CLASS="RETURNVALUE" |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
166 >NULL</SPAN |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
167 > upon error.</P |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
168 ></DIV |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
169 ><DIV |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
170 CLASS="REFSECT1" |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
171 ><A |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
172 NAME="AEN1882" |
0 | 173 ></A |
174 ><H2 | |
175 >See Also</H2 | |
176 ><P | |
177 ><A | |
178 HREF="sdlcreatergbsurface.html" | |
179 ><TT | |
180 CLASS="FUNCTION" | |
181 >SDL_CreateRGBSurface</TT | |
182 ></A | |
183 >, | |
184 <A | |
185 HREF="sdlfreesurface.html" | |
186 ><TT | |
187 CLASS="FUNCTION" | |
188 >SDL_FreeSurface</TT | |
189 ></A | |
190 ></P | |
191 ></DIV | |
192 ><DIV | |
193 CLASS="NAVFOOTER" | |
194 ><HR | |
195 ALIGN="LEFT" | |
196 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
197 SUMMARY="Footer navigation table" |
0 | 198 WIDTH="100%" |
199 BORDER="0" | |
200 CELLPADDING="0" | |
201 CELLSPACING="0" | |
202 ><TR | |
203 ><TD | |
204 WIDTH="33%" | |
205 ALIGN="left" | |
206 VALIGN="top" | |
207 ><A | |
208 HREF="sdlcreatergbsurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
209 ACCESSKEY="P" |
0 | 210 >Prev</A |
211 ></TD | |
212 ><TD | |
213 WIDTH="34%" | |
214 ALIGN="center" | |
215 VALIGN="top" | |
216 ><A | |
217 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
218 ACCESSKEY="H" |
0 | 219 >Home</A |
220 ></TD | |
221 ><TD | |
222 WIDTH="33%" | |
223 ALIGN="right" | |
224 VALIGN="top" | |
225 ><A | |
226 HREF="sdlfreesurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
227 ACCESSKEY="N" |
0 | 228 >Next</A |
229 ></TD | |
230 ></TR | |
231 ><TR | |
232 ><TD | |
233 WIDTH="33%" | |
234 ALIGN="left" | |
235 VALIGN="top" | |
236 >SDL_CreateRGBSurface</TD | |
237 ><TD | |
238 WIDTH="34%" | |
239 ALIGN="center" | |
240 VALIGN="top" | |
241 ><A | |
242 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
243 ACCESSKEY="U" |
0 | 244 >Up</A |
245 ></TD | |
246 ><TD | |
247 WIDTH="33%" | |
248 ALIGN="right" | |
249 VALIGN="top" | |
250 >SDL_FreeSurface</TD | |
251 ></TR | |
252 ></TABLE | |
253 ></DIV | |
254 ></BODY | |
255 ></HTML | |
256 > |