Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. <HTML
  2. ><HEAD
  3. ><TITLE
  4. >SDL_SetAlpha</TITLE
  5. ><META
  6. NAME="GENERATOR"
  7. CONTENT="Modular DocBook HTML Stylesheet Version 1.64
  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_SetColorKey"
  17. HREF="sdlsetcolorkey.html"><LINK
  18. REL="NEXT"
  19. TITLE="SDL_SetClipRect"
  20. HREF="sdlsetcliprect.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
  31. WIDTH="100%"
  32. BORDER="0"
  33. CELLPADDING="0"
  34. CELLSPACING="0"
  35. ><TR
  36. ><TH
  37. COLSPAN="3"
  38. ALIGN="center"
  39. >SDL Library Documentation</TH
  40. ></TR
  41. ><TR
  42. ><TD
  43. WIDTH="10%"
  44. ALIGN="left"
  45. VALIGN="bottom"
  46. ><A
  47. HREF="sdlsetcolorkey.html"
  48. >Prev</A
  49. ></TD
  50. ><TD
  51. WIDTH="80%"
  52. ALIGN="center"
  53. VALIGN="bottom"
  54. ></TD
  55. ><TD
  56. WIDTH="10%"
  57. ALIGN="right"
  58. VALIGN="bottom"
  59. ><A
  60. HREF="sdlsetcliprect.html"
  61. >Next</A
  62. ></TD
  63. ></TR
  64. ></TABLE
  65. ><HR
  66. ALIGN="LEFT"
  67. WIDTH="100%"></DIV
  68. ><H1
  69. ><A
  70. NAME="SDLSETALPHA"
  71. >SDL_SetAlpha</A
  72. ></H1
  73. ><DIV
  74. CLASS="REFNAMEDIV"
  75. ><A
  76. NAME="AEN1681"
  77. ></A
  78. ><H2
  79. >Name</H2
  80. >SDL_SetAlpha&nbsp;--&nbsp;Adjust the alpha properties of a surface</DIV
  81. ><DIV
  82. CLASS="REFSYNOPSISDIV"
  83. ><A
  84. NAME="AEN1684"
  85. ></A
  86. ><H2
  87. >Synopsis</H2
  88. ><DIV
  89. CLASS="FUNCSYNOPSIS"
  90. ><A
  91. NAME="AEN1685"
  92. ></A
  93. ><P
  94. ></P
  95. ><PRE
  96. CLASS="FUNCSYNOPSISINFO"
  97. >#include "SDL.h"</PRE
  98. ><P
  99. ><CODE
  100. ><CODE
  101. CLASS="FUNCDEF"
  102. >int <B
  103. CLASS="FSFUNC"
  104. >SDL_SetAlpha</B
  105. ></CODE
  106. >(SDL_Surface *surface, Uint32 flag, Uint8 alpha);</CODE
  107. ></P
  108. ><P
  109. ></P
  110. ></DIV
  111. ></DIV
  112. ><DIV
  113. CLASS="REFSECT1"
  114. ><A
  115. NAME="AEN1691"
  116. ></A
  117. ><H2
  118. >Description</H2
  119. ><DIV
  120. CLASS="NOTE"
  121. ><BLOCKQUOTE
  122. CLASS="NOTE"
  123. ><P
  124. ><B
  125. >Note: </B
  126. >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 (<TT
  127. CLASS="LITERAL"
  128. >SDL_ALPHA_TRANSPARENT</TT
  129. >) is now considered transparent and 255 (<TT
  130. CLASS="LITERAL"
  131. >SDL_ALPHA_OPAQUE</TT
  132. >) is now considered opaque.</P
  133. ></BLOCKQUOTE
  134. ></DIV
  135. ><P
  136. ><TT
  137. CLASS="FUNCTION"
  138. >SDL_SetAlpha</TT
  139. > is used for setting the per-surface alpha
  140. value and/or enabling and disabling alpha blending.</P
  141. ><P
  142. >The<TT
  143. CLASS="PARAMETER"
  144. ><I
  145. >surface</I
  146. ></TT
  147. > parameter specifies which surface whose alpha
  148. attributes you wish to adjust. <TT
  149. CLASS="PARAMETER"
  150. ><I
  151. >flags</I
  152. ></TT
  153. > is used to specify
  154. whether alpha blending should be used (<TT
  155. CLASS="LITERAL"
  156. >SDL_SRCALPHA</TT
  157. >) and
  158. whether the surface should use RLE acceleration for blitting
  159. (<TT
  160. CLASS="LITERAL"
  161. >SDL_RLEACCEL</TT
  162. >). <TT
  163. CLASS="PARAMETER"
  164. ><I
  165. >flags</I
  166. ></TT
  167. > can be an OR'd
  168. combination of these two options, one of these options or 0. If
  169. <TT
  170. CLASS="LITERAL"
  171. >SDL_SRCALPHA</TT
  172. > is not passed as a flag then all alpha
  173. information is ignored when blitting the surface. The
  174. <TT
  175. CLASS="PARAMETER"
  176. ><I
  177. >alpha</I
  178. ></TT
  179. > parameter is the per-surface alpha value; a
  180. surface need not have an alpha channel to use per-surface alpha and blitting
  181. can still be accelerated with <TT
  182. CLASS="LITERAL"
  183. >SDL_RLEACCEL</TT
  184. >.</P
  185. ><DIV
  186. CLASS="NOTE"
  187. ><BLOCKQUOTE
  188. CLASS="NOTE"
  189. ><P
  190. ><B
  191. >Note: </B
  192. >The per-surface alpha value of 128 is considered a special case and
  193. is optimised, so it's much faster than other per-surface values.</P
  194. ></BLOCKQUOTE
  195. ></DIV
  196. ><P
  197. >Alpha effects surface blitting in the following ways:</P
  198. ><DIV
  199. CLASS="INFORMALTABLE"
  200. ><A
  201. NAME="AEN1711"
  202. ></A
  203. ><P
  204. ></P
  205. ><TABLE
  206. BORDER="0"
  207. CLASS="CALSTABLE"
  208. ><TBODY
  209. ><TR
  210. ><TD
  211. ALIGN="LEFT"
  212. VALIGN="TOP"
  213. >RGBA-&#62;RGB with <TT
  214. CLASS="LITERAL"
  215. >SDL_SRCALPHA</TT
  216. ></TD
  217. ><TD
  218. ALIGN="LEFT"
  219. VALIGN="TOP"
  220. ><P
  221. >The source is alpha-blended with the destination, using the alpha channel. <TT
  222. CLASS="LITERAL"
  223. >SDL_SRCCOLORKEY</TT
  224. > and the per-surface alpha are ignored.</P
  225. ></TD
  226. ></TR
  227. ><TR
  228. ><TD
  229. ALIGN="LEFT"
  230. VALIGN="TOP"
  231. >RGBA-&#62;RGB without <TT
  232. CLASS="LITERAL"
  233. >SDL_SRCALPHA</TT
  234. ></TD
  235. ><TD
  236. ALIGN="LEFT"
  237. VALIGN="TOP"
  238. ><P
  239. >The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored.</P
  240. ></TD
  241. ></TR
  242. ><TR
  243. ><TD
  244. ALIGN="LEFT"
  245. VALIGN="TOP"
  246. >RGB-&#62;RGBA with <TT
  247. CLASS="LITERAL"
  248. >SDL_SRCALPHA</TT
  249. ></TD
  250. ><TD
  251. ALIGN="LEFT"
  252. VALIGN="TOP"
  253. ><P
  254. >The source is alpha-blended with the destination using the per-surface alpha
  255. value. If <TT
  256. CLASS="LITERAL"
  257. >SDL_SRCCOLORKEY</TT
  258. > is set, only the pixels not
  259. matching the colorkey value are copied. The alpha channel of the copied pixels
  260. is set to opaque.</P
  261. ></TD
  262. ></TR
  263. ><TR
  264. ><TD
  265. ALIGN="LEFT"
  266. VALIGN="TOP"
  267. >RGB-&#62;RGBA without <TT
  268. CLASS="LITERAL"
  269. >SDL_SRCALPHA</TT
  270. ></TD
  271. ><TD
  272. ALIGN="LEFT"
  273. VALIGN="TOP"
  274. ><P
  275. >The RGB data is copied from the source and the alpha value of the copied pixels
  276. is set to opaque. If <TT
  277. CLASS="LITERAL"
  278. >SDL_SRCCOLORKEY</TT
  279. > is set, only the pixels
  280. not matching the colorkey value are copied. </P
  281. ></TD
  282. ></TR
  283. ><TR
  284. ><TD
  285. ALIGN="LEFT"
  286. VALIGN="TOP"
  287. >RGBA-&#62;RGBA with <TT
  288. CLASS="LITERAL"
  289. >SDL_SRCALPHA</TT
  290. ></TD
  291. ><TD
  292. ALIGN="LEFT"
  293. VALIGN="TOP"
  294. ><P
  295. >The source is alpha-blended with the destination using the source alpha
  296. channel. The alpha channel in the destination surface is left untouched.
  297. <TT
  298. CLASS="LITERAL"
  299. >SDL_SRCCOLORKEY</TT
  300. > is ignored.</P
  301. ></TD
  302. ></TR
  303. ><TR
  304. ><TD
  305. ALIGN="LEFT"
  306. VALIGN="TOP"
  307. >RGBA-&#62;RGBA without <TT
  308. CLASS="LITERAL"
  309. >SDL_SRCALPHA</TT
  310. ></TD
  311. ><TD
  312. ALIGN="LEFT"
  313. VALIGN="TOP"
  314. ><P
  315. >The RGBA data is copied to the destination surface. If <TT
  316. CLASS="LITERAL"
  317. >SDL_SRCCOLORKEY</TT
  318. > is set, only the pixels not matching the colorkey value are copied.</P
  319. ></TD
  320. ></TR
  321. ><TR
  322. ><TD
  323. ALIGN="LEFT"
  324. VALIGN="TOP"
  325. >RGB-&#62;RGB with <TT
  326. CLASS="LITERAL"
  327. >SDL_SRCALPHA</TT
  328. ></TD
  329. ><TD
  330. ALIGN="LEFT"
  331. VALIGN="TOP"
  332. ><P
  333. >The source is alpha-blended with the destination using the per-surface alpha value. If <TT
  334. CLASS="LITERAL"
  335. >SDL_SRCCOLORKEY</TT
  336. > is set, only the pixels not matching the colorkey value are copied.</P
  337. ></TD
  338. ></TR
  339. ><TR
  340. ><TD
  341. ALIGN="LEFT"
  342. VALIGN="TOP"
  343. >RGB-&#62;RGB without <TT
  344. CLASS="LITERAL"
  345. >SDL_SRCALPHA</TT
  346. ></TD
  347. ><TD
  348. ALIGN="LEFT"
  349. VALIGN="TOP"
  350. ><P
  351. >The RGB data is copied from the source. If <TT
  352. CLASS="LITERAL"
  353. >SDL_SRCCOLORKEY</TT
  354. > is set, only the pixels not matching the colorkey value are copied.</P
  355. ></TD
  356. ></TR
  357. ></TBODY
  358. ></TABLE
  359. ><P
  360. ></P
  361. ></DIV
  362. ><DIV
  363. CLASS="NOTE"
  364. ><BLOCKQUOTE
  365. CLASS="NOTE"
  366. ><P
  367. ><B
  368. >Note: </B
  369. > Note that RGBA-&#62;RGBA blits (with SDL_SRCALPHA set) keep the alpha
  370. of the destination surface. This means that you cannot compose two arbitrary
  371. RGBA surfaces this way and get the result you would expect from "overlaying"
  372. them; the destination alpha will work as a mask.</P
  373. ><P
  374. >Also note that per-pixel and per-surface alpha cannot be combined;
  375. the per-pixel alpha is always used if available</P
  376. ></BLOCKQUOTE
  377. ></DIV
  378. ></DIV
  379. ><DIV
  380. CLASS="REFSECT1"
  381. ><A
  382. NAME="AEN1764"
  383. ></A
  384. ><H2
  385. >Return Value</H2
  386. ><P
  387. >This function returns <SPAN
  388. CLASS="RETURNVALUE"
  389. >0</SPAN
  390. >, or
  391. <SPAN
  392. CLASS="RETURNVALUE"
  393. >-1</SPAN
  394. > if there was an error.</P
  395. ></DIV
  396. ><DIV
  397. CLASS="REFSECT1"
  398. ><A
  399. NAME="AEN1769"
  400. ></A
  401. ><H2
  402. >See Also</H2
  403. ><P
  404. ><A
  405. HREF="sdlmaprgba.html"
  406. ><TT
  407. CLASS="FUNCTION"
  408. >SDL_MapRGBA</TT
  409. ></A
  410. >,
  411. <A
  412. HREF="sdlgetrgba.html"
  413. ><TT
  414. CLASS="FUNCTION"
  415. >SDL_GetRGBA</TT
  416. ></A
  417. >,
  418. <A
  419. HREF="sdldisplayformatalpha.html"
  420. ><TT
  421. CLASS="FUNCTION"
  422. >SDL_DisplayFormatAlpha</TT
  423. ></A
  424. >,
  425. <A
  426. HREF="sdlblitsurface.html"
  427. ><TT
  428. CLASS="FUNCTION"
  429. >SDL_BlitSurface</TT
  430. ></A
  431. ></P
  432. ></DIV
  433. ><DIV
  434. CLASS="NAVFOOTER"
  435. ><HR
  436. ALIGN="LEFT"
  437. WIDTH="100%"><TABLE
  438. WIDTH="100%"
  439. BORDER="0"
  440. CELLPADDING="0"
  441. CELLSPACING="0"
  442. ><TR
  443. ><TD
  444. WIDTH="33%"
  445. ALIGN="left"
  446. VALIGN="top"
  447. ><A
  448. HREF="sdlsetcolorkey.html"
  449. >Prev</A
  450. ></TD
  451. ><TD
  452. WIDTH="34%"
  453. ALIGN="center"
  454. VALIGN="top"
  455. ><A
  456. HREF="index.html"
  457. >Home</A
  458. ></TD
  459. ><TD
  460. WIDTH="33%"
  461. ALIGN="right"
  462. VALIGN="top"
  463. ><A
  464. HREF="sdlsetcliprect.html"
  465. >Next</A
  466. ></TD
  467. ></TR
  468. ><TR
  469. ><TD
  470. WIDTH="33%"
  471. ALIGN="left"
  472. VALIGN="top"
  473. >SDL_SetColorKey</TD
  474. ><TD
  475. WIDTH="34%"
  476. ALIGN="center"
  477. VALIGN="top"
  478. ><A
  479. HREF="video.html"
  480. >Up</A
  481. ></TD
  482. ><TD
  483. WIDTH="33%"
  484. ALIGN="right"
  485. VALIGN="top"
  486. >SDL_SetClipRect</TD
  487. ></TR
  488. ></TABLE
  489. ></DIV
  490. ></BODY
  491. ></HTML
  492. >