⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdlsetalpha.html

📁 VC5.6.7的一个扩展库。跟DirectX的功能差不多。
💻 HTML
字号:
<HTML><HEAD><TITLE>SDL_SetAlpha</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="SDL Library Documentation"HREF="index.html"><LINKREL="UP"TITLE="Video"HREF="video.html"><LINKREL="PREVIOUS"TITLE="SDL_SetColorKey"HREF="sdlsetcolorkey.html"><LINKREL="NEXT"TITLE="SDL_SetClipRect"HREF="sdlsetcliprect.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFF8DC"TEXT="#000000"LINK="#0000ee"VLINK="#551a8b"ALINK="#ff0000"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">SDL Library Documentation</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="sdlsetcolorkey.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="sdlsetcliprect.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SDLSETALPHA"></A>SDL_SetAlpha</H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN2096"></A><H2>Name</H2>SDL_SetAlpha&nbsp;--&nbsp;Adjust the alpha properties of a surface</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN2099"></A><H2>Synopsis</H2><DIVCLASS="FUNCSYNOPSIS"><ANAME="AEN2100"></A><P></P><PRECLASS="FUNCSYNOPSISINFO">#include "SDL.h"</PRE><P><CODE><CODECLASS="FUNCDEF">int <BCLASS="FSFUNC">SDL_SetAlpha</B></CODE>(SDL_Surface *surface, Uint32 flag, Uint8 alpha);</CODE></P><P></P></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2106"></A><H2>Description</H2><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>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 (<TTCLASS="LITERAL">SDL_ALPHA_TRANSPARENT</TT>) is now considered transparent and 255 (<TTCLASS="LITERAL">SDL_ALPHA_OPAQUE</TT>) is now considered opaque.</P></BLOCKQUOTE></DIV><P><TTCLASS="FUNCTION">SDL_SetAlpha</TT> is used for setting the per-surface alphavalue and/or enabling and disabling alpha blending.</P><P>The<TTCLASS="PARAMETER"><I>surface</I></TT> parameter specifies which surface whose alphaattributes you wish to adjust. <TTCLASS="PARAMETER"><I>flags</I></TT> is used to specifywhether alpha blending should be used (<TTCLASS="LITERAL">SDL_SRCALPHA</TT>) andwhether the surface should use RLE acceleration for blitting(<TTCLASS="LITERAL">SDL_RLEACCEL</TT>). <TTCLASS="PARAMETER"><I>flags</I></TT> can be an OR'dcombination of these two options, one of these options or 0. If<TTCLASS="LITERAL">SDL_SRCALPHA</TT> is not passed as a flag then all alphainformation is ignored when blitting the surface. The<TTCLASS="PARAMETER"><I>alpha</I></TT> parameter is the per-surface alpha value; asurface need not have an alpha channel to use per-surface alpha and blittingcan still be accelerated with <TTCLASS="LITERAL">SDL_RLEACCEL</TT>.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>The per-surface alpha value of 128 is considered a special case andis optimised, so it's much faster than other per-surface values.</P></BLOCKQUOTE></DIV><P>Alpha effects surface blitting in the following ways:</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN2126"></A><P></P><TABLEBORDER="0"CLASS="CALSTABLE"><TBODY><TR><TDALIGN="LEFT"VALIGN="TOP">RGBA-&#62;RGB with <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The source is alpha-blended with the destination, using the alpha channel. <TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> and the per-surface alpha are ignored.</P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGBA-&#62;RGB without <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored.</P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGB-&#62;RGBA with <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The source is alpha-blended with the destination using the per-surface alphavalue. If <TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> is set, only the pixels notmatching the colorkey value are copied. The alpha channel of the copied pixelsis set to opaque.</P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGB-&#62;RGBA without <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The RGB data is copied from the source and the alpha value of the copied pixelsis set to opaque. If <TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> is set, only the pixelsnot matching the colorkey value are copied. </P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGBA-&#62;RGBA with <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The source is alpha-blended with the destination using the source alphachannel. The alpha channel in the destination surface is left untouched.<TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> is ignored.</P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGBA-&#62;RGBA without <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The RGBA data is copied to the destination surface. If <TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> is set, only the pixels not matching the colorkey value are copied.</P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGB-&#62;RGB with <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The source is alpha-blended with the destination using the per-surface alpha value. If <TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> is set, only the pixels not matching the colorkey value are copied.</P></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP">RGB-&#62;RGB without <TTCLASS="LITERAL">SDL_SRCALPHA</TT></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The RGB data is copied from the source. If <TTCLASS="LITERAL">SDL_SRCCOLORKEY</TT> is set, only the pixels not matching the colorkey value are copied.</P></TD></TR></TBODY></TABLE><P></P></DIV><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B> Note that RGBA-&#62;RGBA blits (with SDL_SRCALPHA set) keep the alphaof the destination surface. This means that you cannot compose two arbitraryRGBA surfaces this way and get the result you would expect from "overlaying"them; the destination alpha will work as a mask.</P><P>Also note that per-pixel and per-surface alpha cannot be combined;the per-pixel alpha is always used if available</P></BLOCKQUOTE></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2179"></A><H2>Return Value</H2><P>This function returns <SPANCLASS="RETURNVALUE">0</SPAN>, or<SPANCLASS="RETURNVALUE">-1</SPAN> if there was an error.</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN2184"></A><H2>See Also</H2><P><AHREF="sdlmaprgba.html"><TTCLASS="FUNCTION">SDL_MapRGBA</TT></A>,<AHREF="sdlgetrgba.html"><TTCLASS="FUNCTION">SDL_GetRGBA</TT></A>,<AHREF="sdldisplayformatalpha.html"><TTCLASS="FUNCTION">SDL_DisplayFormatAlpha</TT></A>,<AHREF="sdlblitsurface.html"><TTCLASS="FUNCTION">SDL_BlitSurface</TT></A></P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="sdlsetcolorkey.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="sdlsetcliprect.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">SDL_SetColorKey</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="video.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">SDL_SetClipRect</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -