_C_ License Applicability. Except to the extent portions of this file are
_C_ made subject to an alternative license as permitted in the SGI Free
_C_ Software License B, Version 1.1 (the "License"), the contents of this
_C_ file are subject only to the provisions of the License. You may not use
_C_ this file except in compliance with the License. You may obtain a copy
_C_ of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
_C_ Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
_C_ 
_C_ http://oss.sgi.com/projects/FreeB
_C_ 
_C_ Note that, as provided in the License, the Software is distributed on an
_C_ "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
_C_ DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
_C_ CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
_C_ PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
_C_ 
_C_ Original Code. The Original Code is: OpenGL Sample Implementation,
_C_ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
_C_ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
_C_ Copyright in any portions created by third parties is as indicated
_C_ elsewhere herein. All Rights Reserved.
_C_ 
_C_ Additional Notice Provisions: The application programming interfaces
_C_ established by SGI in conjunction with the Original Code are The
_C_ OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
_C_ April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
_C_ 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
_C_ Window System(R) (Version 1.3), released October 19, 1998. This software
_C_ was created using the OpenGL(R) version 1.2.1 Sample Implementation
_C_ published by SGI, but has not been independently verified as being
_C_ compliant with the OpenGL(R) version 1.2.1 Specification.
_C_
_C_ $Date$ $Revision$
_C_ The first character in this file must be an '_'!
_C_ Anything on a line after _C_ is ignored
_define(_filters,tbl|eqn)_C_
_C_      eqn is automatically replaced with neqn for nroff
_header(BlendEquation, set the blend equation)
_names(BlendEquation)
.EQ
delim $$
.EN
.SH PARAMETERS
_phead(_param1)
specifies how source and destination colors are combined.
It must be _const(FUNC_ADD), _const(FUNC_SUBTRACT),
_const(FUNC_REVERSE_SUBTRACT), _const(MIN), _const(MAX).

.SH DESCRIPTION
The blend equation determines how a new pixel (the ``source'' color)
is combined with a pixel already in the framebuffer (the ``destination''
color).
.TP
_const(MIN)
sets the blend equation so that each component of the result color
is the minimum of the corresponding components of the source and destination
colors.
.TP
_const(MAX)
sets the blend equation so that each component of the result color
is the maximum of the corresponding components of the source and destination
colors.
.P
The remaining blend equations use the source and destination blend factors
specified by _cmnd(BlendFunc).
See _cmnd(BlendFunc) for a description of the various blend factors. 
.P
In the equations that follow, source and destination
color components are referred to as
$(R sub s, G sub s, B sub s, A sub s )$ 
and
$(R sub d, G sub d, B sub d, A sub d )$,
respectively.
The result color is referred to as 
$(R sub r, G sub r, B sub r, A sub r )$.
The source and destination blend factors are denoted 
$(s sub R, s sub G, s sub B, s sub A )$ and 
$(d sub R, d sub G, d sub B, d sub A )$, respectively.
For these equations all color components are understood to have values
in the range [0,\ 1].
.TP
_const(FUNC_ADD)
sets the blend equation so that the source and destination
data are added.
Each component of the source color is
multiplied by the corresponding source factor, then
each component of the destination color is multiplied
by the corresponding destination factor.
The result is the componentwise sum of the two products, clamped to the
range [0,\ 1].
.P
.RS
.nf
.IP
$Rr ~=~ mark   min (1, ~R sub s~s sub R ~+~ R sub d~d sub R )$
$Gr ~=~ lineup min (1, ~G sub s~s sub G ~+~ G sub d~d sub G )$
$Br ~=~ lineup min (1, ~B sub s~s sub B ~+~ B sub d~d sub B )$
$Ar ~=~ lineup min (1, ~A sub s~s sub A ~+~ A sub d~d sub A )$
.fi
.RE
.TP
_const(FUNC_SUBTRACT)
Is like _const(FUNC_ADD) except the product of the destination factor and
the destination color is componentwise subtracted from the product of the
source factor and the source color.
The result is clamped to the range [0,\ 1].
.RS
.nf
.IP
$Rr ~=~ mark   max (0 , ~R sub s~s sub R ~-~ R sub d~d sub R )$
$Gr ~=~ lineup max (0 , ~G sub s~s sub G ~-~ G sub d~d sub G )$
$Br ~=~ lineup max (0 , ~B sub s~s sub B ~-~ B sub d~d sub B )$
$Ar ~=~ lineup max (0 , ~A sub s~s sub A ~-~ A sub d~d sub A )$
.fi
.RE
.TP
_const(FUNC_REVERSE_SUBTRACT)
Is like _const(FUNC_ADD) except the product of the source factor and the
source color is componentwise subtracted from the product of the destination
factor and the destination color.
The result is clamped to the range [0,\ 1].
.RS
.nf
.IP
$Rr ~=~ mark   max (0 , ~R sub d~d sub R ~-~ R sub s~s sub R )$
$Gr ~=~ lineup max (0 , ~G sub d~d sub G ~-~ G sub s~s sub G )$
$Br ~=~ lineup max (0 , ~B sub d~d sub B ~-~ B sub s~s sub B )$
$Ar ~=~ lineup max (0 , ~A sub d~d sub A ~-~ A sub s~s sub A )$
.fi
.RE
.P
The _const(MIN) and _const(MAX) equations are useful for applications
that analyze
.br
image data (image thresholding against a constant color,
for example).
The _const(FUNC_ADD) equation is useful
for antialiasing and transparency, among other things.
.P
Initially, the blend equation is set to _const(FUNC_ADD).
.P
.SH NOTES
_cmnd is part of the _arbstring(imaging) subset. _cmnd is present only
if _arbstring(imaging) is returned when _cmnd(GetString) is called with
_const(EXTENSIONS) as its argument.
.P
The _const(MIN), and _const(MAX) equations do not use
the source or destination factors, only the source and destination colors.
.P
.SH ERRORS
_const(INVALID_ENUM) is generated if _param1 is not one of 
_const(FUNC_ADD), _const(FUNC_SUBTRACT), _const(FUNC_REVERSE_SUBTRACT),
_const(MAX), or _const(MIN).
.P
_const(INVALID_OPERATION) is generated if _cmnd is executed
between the execution of _cmnd(Begin) and the corresponding
execution of _cmnd(End).
.SH ASSOCIATED GETS
.TP
_cmnd(Get) with an argument of _const(BLEND_EQUATION)
.SH SEE ALSO
_cmnd(GetString),
_cmnd(BlendColor),
_cmnd(BlendFunc)
