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<H2>C Specification</H2>
13<DL>
14  <DD>
15<PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17<PRE><CODE>void 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 );</CODE></PRE>
22</DL>
23<H2>Arguments</H2>
24<TABLE border="1" cellpadding="3" cellspacing="0.1">
25  <TBODY>
26    <TR>
27<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG>type</STRONG></EM></TD>
28<TD width="520">the blend mode <BR>Accepted values are:<BR>
29      <TABLE border="1" width="500" cellspacing="0.1">
30
31          <tr>
32<TD width="150" bgcolor="#C0C0C0">Name</TD>
33<TD width="350" bgcolor="#C0C0C0">Mode</TD>
34          </tr>
35          <tr>
36<TD width="150"><code>GX_BM_NONE</code></TD>
37<TD width="350">performs neither blending nor logical processing</TD>
38          </tr>
39          <tr>
40<TD width="150"><code>GX_BM_BLEND</code></TD>
41<TD width="350">blending mode</TD>
42          </tr>
43          <tr>
44<TD width="150"><code>GX_BM_LOGIC</code></TD>
45<TD width="350">logical processing mode</TD>
46          </tr>
47          <tr>
48<TD width="150"><code>GX_BM_SUBTRACT </code></TD>
49<TD width="350">subtraction processing mode</TD>
50          </tr>
51
52      </TABLE>
53      </TD>
54    </TR>
55    <TR>
56<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><A name="src_factor">src_factor</A></STRONG></EM></TD>
57<TD width="520">input coefficient <BR>The pixel color created by the graphics processor is multiplied by this coefficient. Acceptable values are as follows:
58      <TABLE border="1" width="500" cellspacing="0.1">
59        <TBODY>
60          <TR>
61<TD width="150" bgcolor="#C0C0C0">Name</TD>
62<TD width="350" bgcolor="#C0C0C0">Description</TD>
63          </TR>
64          <TR>
65<TD width="150"><CODE>GX_BL_ZERO</CODE></TD>
66            <TD width="350">0.0</TD>
67          </TR>
68          <TR>
69<TD width="150"><CODE>GX_BL_ONE</CODE></TD>
70            <TD width="350">1.0</TD>
71          </TR>
72          <TR>
73<TD width="150"><CODE>GX_BL_DSTCLR</CODE></TD>
74<TD width="350">the frame buffer color</TD>
75          </TR>
76          <TR>
77<TD width="150"><CODE>GX_BL_INVDSTCLR</CODE></TD>
78<TD width="350">1.0 - (the frame buffer color)</TD>
79          </TR>
80          <TR>
81<TD width="150"><CODE>GX_BL_SRCALPHA</CODE></TD>
82<TD width="350">the source alpha</TD>
83          </TR>
84          <TR>
85<TD width="150"><CODE>GX_BL_INVSRCALPHA</CODE></TD>
86<TD width="350">1.0 - (the source alpha)</TD>
87          </TR>
88          <TR>
89<TD width="150"><CODE>GX_BL_DSTALPHA</CODE></TD>
90<TD width="350">the frame buffer alpha</TD>
91          </TR>
92          <TR>
93<TD width="150"><CODE>GX_BL_INVDSTALPHA</CODE></TD>
94<TD width="350">1.0 - (the frame buffer alpha)</TD>
95          </TR>
96        </TBODY>
97      </TABLE>
98This coefficient works only when <CODE>type</CODE> is <code>GX_BM_BLEND</code>.</TD>
99    </TR>
100    <TR>
101<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG>dst_factor</STRONG></EM></TD>
102<TD width="520">the output coefficient <BR>The current frame buffer pixel color is multiplied by this coefficient. Acceptable values are as follows:
103      <TABLE border="1" cellspacing="0.1">
104        <TBODY>
105          <TR>
106<TD width="150" bgcolor="#C0C0C0">Name</TD>
107<TD width="350" bgcolor="#C0C0C0">Description</TD>
108          </TR>
109          <TR>
110<TD width="150"><CODE>GX_BL_ZERO</CODE></TD>
111            <TD width="350">0.0</TD>
112          </TR>
113          <TR>
114<TD width="150"><CODE>GX_BL_ONE</CODE></TD>
115            <TD width="350">1.0</TD>
116          </TR>
117          <TR>
118<TD width="150"><CODE>GX_BL_SRCCLR</CODE></TD>
119<TD width="350">source color</TD>
120          </TR>
121          <TR>
122<TD width="150"><CODE>GX_BL_INVSRCCLR</CODE></TD>
123<TD width="350">1.0 - (the source color)</TD>
124          </TR>
125          <TR>
126<TD width="150"><CODE>GX_BL_SRCALPHA</CODE></TD>
127<TD width="350">the source alpha</TD>
128          </TR>
129          <TR>
130<TD width="150"><CODE>GX_BL_INVSRCALPHA</CODE></TD>
131<TD width="350">1.0 - (the source alpha)</TD>
132          </TR>
133          <TR>
134<TD width="150"><CODE>GX_BL_DSTALPHA</CODE></TD>
135<TD width="350">the frame buffer alpha</TD>
136          </TR>
137          <TR>
138<TD width="150"><CODE>GX_BL_INVDSTALPHA</CODE></TD>
139<TD width="350">1.0 - (the frame buffer alpha)</TD>
140          </TR>
141        </TBODY>
142      </TABLE>
143This coefficient works only when <CODE>type</CODE> is <code>GX_BM_BLEND</code>.</TD>
144    </TR>
145    <TR>
146<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG>op</STRONG></EM></TD>
147<TD width="520">blend processing <BR>The acceptable values and logical operations are as follows:
148      <TABLE border="1" width="500" cellspacing="0.1">
149        <TBODY>
150          <TR>
151<TD width="150" bgcolor="#C0C0C0">Name</TD>
152<TD width="350" bgcolor="#C0C0C0">Bit Operations as Expressed in C</TD>
153          </TR>
154          <TR>
155<TD width="150"><CODE>GX_LO_CLEAR</CODE></TD>
156<TD width="350">dst = 0</TD>
157          </TR>
158          <TR>
159<TD width="150"><CODE>GX_LO_SET</CODE></TD>
160<TD width="350">dst = 1</TD>
161          </TR>
162          <TR>
163<TD width="150"><CODE>GX_LO_COPY</CODE></TD>
164<TD width="350">dst = src</TD>
165          </TR>
166          <TR>
167<TD width="150"><CODE>GX_LO_INVCOPY</CODE></TD>
168<TD width="350">dst = ~src</TD>
169          </TR>
170          <TR>
171<TD width="150"><CODE>GX_LO_NOOP</CODE></TD>
172<TD width="350">dst = dst</TD>
173          </TR>
174          <TR>
175<TD width="150"><CODE>GX_LO_INV</CODE></TD>
176<TD width="350">dst = ~dst</TD>
177          </TR>
178          <TR>
179<TD width="150"><CODE>GX_LO_AND</CODE></TD>
180<TD width="350">dst = src &amp; dst</TD>
181          </TR>
182          <TR>
183<TD width="150"><CODE>GX_LO_NAND</CODE></TD>
184<TD width="350">dst = ~(src &amp; dst)</TD>
185          </TR>
186          <TR>
187<TD width="150"><CODE>GX_LO_OR</CODE></TD>
188<TD width="350">dst = src | dst</TD>
189          </TR>
190          <TR>
191<TD width="150"><CODE>GX_LO_NOR</CODE></TD>
192<TD width="350">dst = ~(src | dst)</TD>
193          </TR>
194          <TR>
195<TD width="150"><CODE>GX_LO_XOR</CODE></TD>
196<TD width="350">dst = src ^ dst</TD>
197          </TR>
198          <TR>
199<TD width="150"><CODE>GX_LO_EQUIV</CODE></TD>
200<TD width="350">dst = ~(src ^ dst)</TD>
201          </TR>
202          <TR>
203<TD width="150"><CODE>GX_LO_REVAND</CODE></TD>
204<TD width="350">dst = src &amp; ~dst</TD>
205          </TR>
206          <TR>
207<TD width="150"><CODE>GX_LO_INVAND</CODE></TD>
208<TD width="350">dst = ~src &amp; dst</TD>
209          </TR>
210          <TR>
211<TD width="150"><CODE>GX_LO_REVOR</CODE></TD>
212<TD width="350">dst = src | ~dst</TD>
213          </TR>
214          <TR>
215<TD width="150"><CODE>GX_LO_INVOR</CODE></TD>
216<TD width="350">dst = ~src | dest</TD>
217          </TR>
218        </TBODY>
219      </TABLE>
220This coefficient only functions when <CODE>type</CODE> is <code>GX_BM_LOGIC</code>.</TD>
221    </TR>
222  </TBODY>
223</TABLE>
224<H2>Return Values</H2>
225<P>None.</P>
226<H2>Description</H2>
227<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 color updates are be enabled by calling <a href="GXSetColorUpdate.html"><code>GXSetColorUpdate</code></a>. When <EM><STRONG><code>type</code></STRONG></EM> is set to <code>GX_BM_NONE</code>, the source data is written directly to the EFB.&nbsp;When <em><strong><code>type</code></strong></em> is set to <code>GX_BM_BLEND</code>, the source and EFB pixels are&nbsp;blended using the following formulae.</P>
228<P><code>dst_pix_clr = src_pix_clr * <strong>src_factor</strong> + dst_pix_clr * <strong>dst_factor</strong></code></P>
229<P>The <code>GX_BL_DSTALPHA</code> / <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 <a href="GXSetPixelFmt.html"><code>GXSetPixelFmt</code></a>).&nbsp;If the pixel format is <code>GX_PF_RGBA6_Z24</code> then <CODE>src_factor</CODE> and <CODE>dst_factor</CODE> are also applied to the alpha channel.&nbsp;To write the alpha channel to the EFB you must call <a href="GXSetAlphaUpdate.html"><code>GXSetAlphaUpdate</code></a>.</P>
230<P>When <code>type</code> is set to <code>GX_BM_LOGIC</code>, the source and EFB pixels are&nbsp;blended using logical bitwise operations. You can't use both blending and logic operations at the same time.</P>
231<H2>See Also</H2>
232<P><A href="GXSetPixelFmt.html"><CODE>GXSetPixelFmt</CODE></A><br> <A href="GXSetZMode.html"><CODE>GXSetZMode</CODE></A><br> <A href="GXSetColorUpdate.html"><CODE>GXSetColorUpdate</CODE></A><br> <A href="GXSetAlphaUpdate.html"><CODE>GXSetAlphaUpdate</CODE></A></P>
233<H2>Revision History</H2>
234<P>03/01/2006 Initial version.</P>
235</BODY>
236</HTML>