NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
REL="HOME"
TITLE="SDL Library Documentation"
REL="UP"
TITLE="Video"
REL="PREVIOUS"
TITLE="SDL_SetColorKey"
HREF="sdlsetcolorkey.html"><
LINK
REL="NEXT"
TITLE="SDL_SetClipRect"
HREF="sdlsetcliprect.html"><
/HEAD
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
CLASS="NAVHEADER"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation<
/TH
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
HREF="sdlsetcolorkey.html"
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
HREF="sdlsetcliprect.html"
ALIGN="LEFT"
NAME="SDLSETALPHA"
CLASS="REFNAMEDIV"
NAME="AEN1681"
>SDL_SetAlpha -- Adjust the alpha properties of a surface<
/DIV
CLASS="REFSYNOPSISDIV"
NAME="AEN1684"
CLASS="FUNCSYNOPSIS"
NAME="AEN1685"
CLASS="FUNCSYNOPSISINFO"
CLASS="FUNCDEF"
CLASS="FSFUNC"
>
(SDL_Surface *surface, Uint32 flag, Uint8 alpha
);<
/CODE
CLASS="REFSECT1"
NAME="AEN1691"
CLASS="NOTE"
CLASS="NOTE"
>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
CLASS="LITERAL"
>SDL_ALPHA_TRANSPARENT<
/TT
>
) is now considered transparent and
255 (<
TT
CLASS="LITERAL"
>
) is now considered opaque.<
/P
CLASS="FUNCTION"
> is used for setting the per-surface alpha
value and
/or enabling and disabling alpha blending.<
/P
CLASS="PARAMETER"
> parameter specifies which surface whose alpha
attributes you wish to adjust. <
TT
CLASS="PARAMETER"
> is used to specify
whether alpha blending should be used
(<
TT
CLASS="LITERAL"
>) and
whether the surface should use RLE acceleration for blitting
CLASS="LITERAL"
CLASS="PARAMETER"
> can be an OR'd
combination of these two options, one of these options or 0. If
<TT
CLASS="LITERAL"
>SDL_SRCALPHA</TT
> is not passed as a flag then all alpha
information is ignored when blitting the surface. The
<TT
CLASS="PARAMETER"
><I
>alpha</I
></TT
> 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 <TT
CLASS="LITERAL"
>SDL_RLEACCEL</TT
>.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>Note: </B
>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.<
/P
>Alpha effects surface blitting in the following ways:<
/P
CLASS="INFORMALTABLE"
NAME="AEN1711"
BORDER="0"
CLASS="CALSTABLE"
ALIGN="LEFT"
VALIGN="TOP"
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The source is alpha-blended with the destination, using the alpha channel. <
TT
CLASS="LITERAL"
> and the per-surface alpha are ignored.<
/P
ALIGN="LEFT"
VALIGN="TOP"
>RGBA-&#
62;RGB without <
TT
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The RGB
data is copied from the source. The source alpha channel and the per-surface alpha
value are ignored.<
/P
ALIGN="LEFT"
VALIGN="TOP"
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The source is alpha-blended with the destination using the per-surface alpha
CLASS="LITERAL"
> is set, only the pixels not
matching the colorkey value are copied. The alpha channel of the copied pixels
ALIGN="LEFT"
VALIGN="TOP"
>RGB-&#
62;RGBA without <
TT
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The RGB data is copied from the source and the alpha value of the copied pixels
CLASS="LITERAL"
> is set, only the pixels
not matching the colorkey
value are copied. <
/P
ALIGN="LEFT"
VALIGN="TOP"
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The source is alpha-blended with the destination using the source alpha
channel. The alpha channel in the destination surface is left untouched.
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>RGBA-&#
62;RGBA without <
TT
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The RGBA
data is copied to the destination surface. If <
TT
CLASS="LITERAL"
> is set, only the pixels not matching the colorkey
value are copied.<
/P
ALIGN="LEFT"
VALIGN="TOP"
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The source is alpha-blended with the destination using the per-surface alpha
value. If <
TT
CLASS="LITERAL"
> is set, only the pixels not matching the colorkey
value are copied.<
/P
ALIGN="LEFT"
VALIGN="TOP"
>RGB-&#
62;RGB without <
TT
CLASS="LITERAL"
ALIGN="LEFT"
VALIGN="TOP"
>The RGB
data is copied from the source. If <
TT
CLASS="LITERAL"
> is set, only the pixels not matching the colorkey
value are copied.<
/P
CLASS="NOTE"
CLASS="NOTE"
> 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.<
/P
>Also note that per-pixel and per-surface alpha cannot be combined;
the per-pixel alpha is always used if available<
/P
CLASS="REFSECT1"
NAME="AEN1764"
>This function returns <
SPAN
CLASS="RETURNVALUE"
>, or
CLASS="RETURNVALUE"
> if there was an error.<
/P
CLASS="REFSECT1"
NAME="AEN1769"
HREF="sdlmaprgba.html"
CLASS="FUNCTION"
>,
HREF="sdlgetrgba.html"
CLASS="FUNCTION"
>,
HREF="sdldisplayformatalpha.html"
CLASS="FUNCTION"
>SDL_DisplayFormatAlpha<
/TT
>,
HREF="sdlblitsurface.html"
CLASS="FUNCTION"
CLASS="NAVFOOTER"
ALIGN="LEFT"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
WIDTH="33%"
ALIGN="left"
VALIGN="top"
HREF="sdlsetcolorkey.html"
WIDTH="34%"
ALIGN="center"
VALIGN="top"
HREF="index.html"
WIDTH="33%"
ALIGN="right"
VALIGN="top"
HREF="sdlsetcliprect.html"
WIDTH="33%"
ALIGN="left"
VALIGN="top"
WIDTH="34%"
ALIGN="center"
VALIGN="top"
HREF="video.html"
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>