home *** CD-ROM | disk | FTP | other *** search
- <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
- <!-- available at http://polyglotman.sourceforge.net/ -->
-
- <html>
- <head>
- <title>"SDL_SetAlpha"("3") manual page</title>
- </head>
- <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
- <a href='#toc'>Table of Contents</a><p>
-
- <h2><a name='sect0' href='#toc0'>Name</a></h2>
- SDL_SetAlpha- Adjust the alpha properties of a surface
- <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
- <p>
- <b>#include
- "SDL.h" <p>
- </b><b>int <b>SDL_SetAlpha</b></b>(<b>SDL_Surface *surface, Uint32 flag, Uint8 alpha</b>);
-
- <h2><a name='sect2' href='#toc2'>Description</a></h2>
- <p>
- <blockquote><b>Note: <p>
- 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 (<b>SDL_ALPHA_TRANSPARENT</b></b>) is now considered transparent
- and 255 (<b>SDL_ALPHA_OPAQUE</b>) is now considered opaque. </blockquote>
- <p>
- <b>SDL_SetAlpha</b> is used
- for setting the per-surface alpha value and/or enabling and disabling alpha
- blending. <p>
- The<b>surface</b> parameter specifies which surface whose alpha attributes
- you wish to adjust. <b>flags</b> is used to specify whether alpha blending should
- be used (<b>SDL_SRCALPHA</b>) and whether the surface should use RLE acceleration
- for blitting (<b>SDL_RLEACCEL</b>). <b>flags</b> can be an OR'd combination of these two
- options, one of these options or 0. If <b>SDL_SRCALPHA</b> is not passed as a flag
- then all alpha information is ignored when blitting the surface. The <b>alpha</b>
- 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
- <b>SDL_RLEACCEL</b>. <p>
- <blockquote><b>Note: <p>
- 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. </blockquote>
- <p>
- </b>Alpha effects surface blitting in the following ways:
- <dl>
-
- <dt>RGBA->RGB with
- <b>SDL_SRCALPHA</b> </dt>
- <dd>The source is alpha-blended with the destination, using the
- alpha channel. <b>SDL_SRCCOLORKEY</b> and the per-surface alpha are ignored. </dd>
-
- <dt>RGBA->RGB
- without <b>SDL_SRCALPHA</b> </dt>
- <dd>The RGB data is copied from the source. The source
- alpha channel and the per-surface alpha value are ignored. </dd>
-
- <dt>RGB->RGBA with <b>SDL_SRCALPHA</b>
- </dt>
- <dd>The source is alpha-blended with the destination using the per-surface alpha
- value. If <b>SDL_SRCCOLORKEY</b> is set, only the pixels not matching the colorkey
- value are copied. The alpha channel of the copied pixels is set to opaque.
- </dd>
-
- <dt>RGB->RGBA without <b>SDL_SRCALPHA</b> </dt>
- <dd>The RGB data is copied from the source and
- the alpha value of the copied pixels is set to opaque. If <b>SDL_SRCCOLORKEY</b>
- is set, only the pixels not matching the colorkey value are copied. </dd>
-
- <dt>RGBA->RGBA
- with <b>SDL_SRCALPHA</b> </dt>
- <dd>The source is alpha-blended with the destination using
- the source alpha channel. The alpha channel in the destination surface is
- left untouched. <b>SDL_SRCCOLORKEY</b> is ignored. </dd>
-
- <dt>RGBA->RGBA without <b>SDL_SRCALPHA</b>
- </dt>
- <dd>The RGBA data is copied to the destination surface. If <b>SDL_SRCCOLORKEY</b> is
- set, only the pixels not matching the colorkey value are copied. </dd>
-
- <dt>RGB->RGB
- with <b>SDL_SRCALPHA</b> </dt>
- <dd>The source is alpha-blended with the destination using
- the per-surface alpha value. If <b>SDL_SRCCOLORKEY</b> is set, only the pixels not
- matching the colorkey value are copied. </dd>
-
- <dt>RGB->RGB without <b>SDL_SRCALPHA</b> </dt>
- <dd>The
- RGB data is copied from the source. If <b>SDL_SRCCOLORKEY</b> is set, only the
- pixels not matching the colorkey value are copied. </dd>
- </dl>
- <p>
- <blockquote><b>Note: <p>
- 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.</b><br>
- <p>
- Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel
- alpha is always used if available </blockquote>
-
- <h2><a name='sect3' href='#toc3'>Return Value</a></h2>
- <p>
- This function returns <b>0</b>,
- or <b>-1</b> if there was an error.
- <h2><a name='sect4' href='#toc4'>See Also</a></h2>
- <p>
- <i><b>SDL_MapRGBA</b></i>, <i><b>SDL_GetRGBA</b></i>, <i><b>SDL_DisplayFormatAlpha</b></i>,
- <i><b>SDL_BlitSurface</b></i>
- <!--
-
- <p>
-
- <hr><p>
- <a name='toc'><b>Table of Contents</b></a><p>
- <ul>
- <li><a name='toc0' href='#sect0'>Name</a></li>
- <li><a name='toc1' href='#sect1'>Synopsis</a></li>
- <li><a name='toc2' href='#sect2'>Description</a></li>
- <li><a name='toc3' href='#sect3'>Return Value</a></li>
- <li><a name='toc4' href='#sect4'>See Also</a></li>
- </ul>
- </body>
- </html>
-