GPBBLF (srcf,destf) |
Purpose
Use GPBBLF to insert a Set Back Blending Function structure element into the open structure following the element pointer, or to replace the element pointed at by the element pointer with a Set Back Blending Function structure element, depending upon the current edit mode.
Blending is a method of combining the colors of the primitive being rendered (called the source) with previously rendered output (called the destination) to create a new color for the destination. The blending function specifies how you combine the source and destination colors. Conceptually:
COLOR = ( srcf COLORsrc ) + ( destf COLORdest )
where srcf and destf are the source and destination blending functions respectively.
This element specifies the source blending function (srcf) and the destination blending function (destf) you use when you blend subsequent primitives with previously rendered output. Blending occurs when the Transparency Processing Mode of the view table entry is 3=BLEND or 4=BLEND_ALL
The traversal default for srcf is 3=SRCBF_SRC_ALPHA and for destf is 4=DSTBF_ONE_MINUS_SRC_ALPHA
This element specifies the methods you use to control the blending calculations performed on back facing portions of subsequent area primitives. The graPHIGS API uses the specified methods if the face distinguish mode (GPFDMO) is set to 2=COLOR_SURFACE_PROPERTIES
The source and destination blending functions are selected by your application using the srcf and destf parameters for GPBBLF as indicated in the following table:
Table 1. Blending Functions. Summary of source and destination blending functions.
Source function ID |
srcf |
Destination function ID |
destf |
---|---|---|---|
1 |
0 |
1 |
0 |
2 |
1 |
2 |
1 |
3 |
src |
3 |
src |
4 |
1 - src |
4 |
1 - src |
5 |
dest |
5 |
dest |
6 |
1 - dest |
6 |
1 - dest |
7 |
R>dest , Gdest , or dest |
7 |
Rsrc , Gsrc , src , or src |
8 |
1 - (Rdest , Gdest , or dest ) |
8 |
1 - (Rsrc , Gsrc , src , or src ) |
9 |
min (src , 1 - dest ) |
For example, if srcf has the value 2=SRCBF_ONE and destf has the value 1=DSTBF_ZERO , then the blending function becomes:
COLOR = (1.0 COLORsrc ) + ( 0.0 COLORdest )
which causes the source color to replace the destination color.In Table 1 the blending coefficients, also called alpha values (alpha), are floating-point numbers in the range [0.0,1.0] where 0.0 is fully transparent and 1.0 is fully opaque (opposite of the definition of a transparency coefficient). The source blending coefficient (src ) is calculated from the source transparency coefficient (coeff) as follows:
src = 1.0 - coeff
where coeff is in the range [0.0,1.0] and is specified by the Set Back Transparency Coefficient procedure (GPBTCO) , or by the transparency coefficient of the Set Back Surface Properties subroutine (GPBSPR) . (These two subroutines set the same transparency coefficient). You can also specify the transparency coefficient as part of the vertex information of certain primitives. Alternately, you can directly supply alpha values and transparency coefficients as part of a texture map. Where available, the alpha buffer provides the destination blending coefficient (dest ) defined by some of the blending functions. If a blending function is not supported by the workstation, or if a destination blending function is specified on a workstation that does not have alpha buffers, then the element is ignored. Use GPQWDT to inquire the transparency facilities of a specified workstation.
A new blending coefficient is calculated from the blending equation and stored with each color (pixel) on those workstations which support alpha buffers. Those workstations which do not support alpha buffers do not support blending functions from Table 1 which include dest The dest value is typically stored as an integer in the range [0,255] The initial dest value for a view's shield can be specified using the Set Extended View Representation (GPXVR) .
Parameters
Error Codes
Related Subroutines
RCP code
201343508 (X'0C004214')