1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>GXSetBlendMode</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetBlendMode</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17void GXSetBlendMode(
18    <A href="../Enumerated_Types/GXBlendMode.html">GXBlendMode</A>    type,
19    <A href="../Enumerated_Types/GXBlendFactor.html">GXBlendFactor</A>  src_factor,
20    <A href="../Enumerated_Types/GXBlendFactor.html">GXBlendFactor</A>  dst_factor,
21    <A href="../Enumerated_Types/GXLogicOp.html">GXLogicOp</A>      op );
22</pre></dd></dl>
23
24<H2>Arguments</H2>
25<TABLE class="arguments" border="1" >
26  <TBODY>
27    <TR>
28<TH>type</TH>
29<TD>Blend mode. Accepted values are:<BR>
30      <TABLE class="arguments" border="1" >
31          <tr>
32<TD bgcolor="#C0C0C0">Name</TD>
33<TD bgcolor="#C0C0C0">Mode</TD>
34          </tr>
35          <tr>
36<TH>GX_BM_NONE</TH>
37<TD>Performs neither blending nor logical processing.</TD>
38          </tr>
39          <tr>
40<TH>GX_BM_BLEND</TH>
41<TD>Blending mode.</TD>
42          </tr>
43          <tr>
44<TH>GX_BM_LOGIC</TH>
45<TD>Logical processing mode.</TD>
46          </tr>
47          <tr>
48<TH>GX_BM_SUBTRACT </TH>
49<TD>Subtraction processing mode</TD>
50          </tr>
51      </TABLE>
52      </TD>
53    </TR>
54    <TR>
55<TH><A name="src_factor">src_factor</A></TH>
56<TD>Input coefficient. The pixel color created by the graphics processor is multiplied by this coefficient. Acceptable values are as follows:
57      <TABLE class="arguments" border="1" >
58        <TBODY>
59          <TR>
60<TD bgcolor="#C0C0C0">Name</TD>
61<TD bgcolor="#C0C0C0">Description</TD>
62          </TR>
63          <TR>
64<TH>GX_BL_ZERO</TH>
65<TD>0.0</TD>
66          </TR>
67          <TR>
68<TH>GX_BL_ONE</TH>
69<TD>1.0</TD>
70          </TR>
71          <TR>
72<TH>GX_BL_DSTCLR</TH>
73<TD>Frame buffer color.</TD>
74          </TR>
75          <TR>
76<TH>GX_BL_INVDSTCLR</TH>
77<TD>1.0 - (frame buffer color)</TD>
78          </TR>
79          <TR>
80<TH>GX_BL_SRCALPHA</TH>
81<TD>Source alpha.</TD>
82          </TR>
83          <TR>
84<TH>GX_BL_INVSRCALPHA</TH>
85<TD>1.0 - (source alpha)</TD>
86          </TR>
87          <TR>
88<TH>GX_BL_DSTALPHA</TH>
89<TD>Frame buffer alpha.</TD>
90          </TR>
91          <TR>
92<TH>GX_BL_INVDSTALPHA</TH>
93<TD>1.0 - (frame buffer alpha)</TD>
94          </TR>
95        </TBODY>
96      </TABLE>
97This coefficient works only when <SPAN class="argument">type</SPAN> is <code>GX_BM_BLEND</code>.</TD>
98    </TR>
99    <TR>
100<TH>dst_factor</TH>
101<TD>Output coefficient. <BR>The current frame buffer pixel color is multiplied by this coefficient. Acceptable values are as follows:
102      <TABLE class="arguments" border="1" >
103        <TBODY>
104          <TR>
105<TD bgcolor="#C0C0C0">Name</TD>
106<TD bgcolor="#C0C0C0">Description</TD>
107          </TR>
108          <TR>
109<TH>GX_BL_ZERO</TH>
110<TD>0.0</TD>
111          </TR>
112          <TR>
113<TH>GX_BL_ONE</TH>
114<TD>1.0</TD>
115          </TR>
116          <TR>
117<TH>GX_BL_SRCCLR</TH>
118<TD>Source color.</TD>
119          </TR>
120          <TR>
121<TH>GX_BL_INVSRCCLR</TH>
122<TD>1.0 - (source color)</TD>
123          </TR>
124          <TR>
125<TH>GX_BL_SRCALPHA</TH>
126<TD>Source alpha.</TD>
127          </TR>
128          <TR>
129<TH>GX_BL_INVSRCALPHA</TH>
130<TD>1.0 - (source alpha)</TD>
131          </TR>
132          <TR>
133<TH>GX_BL_DSTALPHA</TH>
134<TD>Frame buffer alpha.</TD>
135          </TR>
136          <TR>
137<TH>GX_BL_INVDSTALPHA</TH>
138<TD>1.0 - (frame buffer alpha)</TD>
139          </TR>
140        </TBODY>
141      </TABLE>
142This coefficient works only when <SPAN class="argument">type</SPAN> is <code>GX_BM_BLEND</code>.</TD>
143    </TR>
144    <TR>
145<TH>op</TH>
146<TD>Blend processing. <BR>The acceptable values and logical operations are as follows:
147      <TABLE class="arguments" border="1" >
148        <TBODY>
149          <TR>
150<TD bgcolor="#C0C0C0">Name</TD>
151<TD bgcolor="#C0C0C0">Bit Operations as Expressed in C</TD>
152          </TR>
153          <TR>
154            <TH>GX_LO_CLEAR</TH>
155            <TD>dst = 0</TD>
156          </TR>
157          <TR>
158            <TH>GX_LO_SET</TH>
159            <TD>dst = 1</TD>
160          </TR>
161          <TR>
162            <TH>GX_LO_COPY</TH>
163            <TD>dst = src</TD>
164          </TR>
165          <TR>
166            <TH>GX_LO_INVCOPY</TH>
167            <TD>dst = ~src</TD>
168          </TR>
169          <TR>
170            <TH>GX_LO_NOOP</TH>
171            <TD>dst = dst</TD>
172          </TR>
173          <TR>
174            <TH>GX_LO_INV</TH>
175            <TD>dst = ~dst</TD>
176          </TR>
177          <TR>
178            <TH>GX_LO_AND</TH>
179            <TD>dst = src &amp; dst</TD>
180          </TR>
181          <TR>
182            <TH>GX_LO_NAND</TH>
183            <TD>dst = ~(src &amp; dst)</TD>
184          </TR>
185          <TR>
186            <TH>GX_LO_OR</TH>
187            <TD>dst = src | dst</TD>
188          </TR>
189          <TR>
190            <TH>GX_LO_NOR</TH>
191            <TD>dst = ~(src | dst)</TD>
192          </TR>
193          <TR>
194            <TH>GX_LO_XOR</TH>
195            <TD>dst = src ^ dst</TD>
196          </TR>
197          <TR>
198            <TH>GX_LO_EQUIV</TH>
199            <TD>dst = ~(src ^ dst)</TD>
200          </TR>
201          <TR>
202            <TH>GX_LO_REVAND</TH>
203            <TD>dst = src &amp; ~dst</TD>
204          </TR>
205          <TR>
206            <TH>GX_LO_INVAND</TH>
207            <TD>dst = ~src &amp; dst</TD>
208          </TR>
209          <TR>
210            <TH>GX_LO_REVOR</TH>
211            <TD>dst = src | ~dst</TD>
212          </TR>
213          <TR>
214            <TH>GX_LO_INVOR</TH>
215            <TD>dst = ~src | dest</TD>
216          </TR>
217        </TBODY>
218      </TABLE>
219This coefficient only functions when <SPAN class="argument">type</SPAN> is <code>GX_BM_LOGIC</code>.</TD>
220    </TR>
221  </TBODY>
222</TABLE>
223
224<H2>Return Values</H2>
225<P>None.</P>
226
227<H2>Description</H2>
228<P>This function determines how the source image, generated by the graphics processor, is blended with the embedded frame buffer (EFB).&nbsp;Be aware that you must call the <A href="GXSetColorUpdate.html"><CODE>GXSetColorUpdate</CODE></A> function to update colors. When <SPAN class="argument">type</SPAN> is set to <CODE>GX_BM_NONE</CODE>, the source data is written directly to the EFB.&nbsp;When <SPAN class="argument">type</SPAN> is set to <CODE>GX_BM_BLEND</CODE>, the source and EFB pixels are&nbsp;blended using the following formula:</P>
229<DL><DD><CODE><EM>dst_pix_clr</EM></CODE> = <CODE><EM>src_pix_clr</EM></CODE> * <SPAN class="argument">src_factor</SPAN> + <CODE><EM>dst_pix_clr</EM></CODE> * <SPAN class="argument">dst_factor</SPAN></DD></DL>
230<P><CODE>GX_BL_DSTALPHA</CODE> and <CODE>GX_BL_INVDSTALPHA</CODE> can be used only when the EFB is set to the <CODE>GX_PF_RGBA6_Z24</CODE> pixel format (see the <A href="GXSetPixelFmt.html"><CODE>GXSetPixelFmt</CODE></A> function).&nbsp;If the pixel format is <CODE>GX_PF_RGBA6_Z24</CODE>, then <SPAN class="argument">src_factor</SPAN> and <SPAN class="argument">dst_factor</SPAN> are also applied to the alpha channel.&nbsp;To write the alpha channel to the EFB you must call the <A href="GXSetAlphaUpdate.html"><CODE>GXSetAlphaUpdate</CODE></A> function.</P>
231<P>When <SPAN class="argument">type</SPAN> is set to <CODE>GX_BM_LOGIC</CODE>, the source and EFB pixels are&nbsp;blended using logical bitwise operations. You cannot use both blending and logical operations at the same time.</P>
232
233<H2>See Also</H2>
234<P class="reference">
235<A href="GXSetPixelFmt.html">GXSetPixelFmt</A>,
236<A href="GXSetZMode.html">GXSetZMode</A>,
237<A href="GXSetColorUpdate.html">GXSetColorUpdate</A>,
238<A href="GXSetAlphaUpdate.html">GXSetAlphaUpdate</A>
239</P>
240
241<H2>Revision History</H2>
242<P>
2432006/03/01 Initial version.<br>
244</P>
245
246<hr><p>CONFIDENTIAL</p></body>
247</HTML>