Java Reference
In-Depth Information
transparencyattributes
TransparencyAttributes specifies transparency attributes, which are, in turn, depending on
two parameters, the transparency mode, and the transparency value. Transparency mode
(tmode) defines how transparency is applied to an appearance component object. The pos-
sibilities are listed below:
FASTEST: Makes use of the fastest available method.
NICEST: Uses the nicest available method.
SCREEN_DOOR: Uses screen-door transparency. An on/off stipple pattern is used.
The percentage of transparent pixels is approximately equal to the value specified by
the transparency value.
BLENDED: Uses alpha blended transparency. All the pixels are partially transparent
at a percentage given by the transparency value.
NONE: No transparency. The object is opaque.
Figure 17. Code segment and result of Sphere_exhibit.java
1.
private Appearance Case_App()
2.
{
3.
Color3f white = new Color3f(1.0f,1.0f,1.0f);
4.
5.
Appearance look = new Appearance();
6.
ColoringAttributes ca = new ColoringAttributes(white,ColoringAttributes.FASTEST);
7.
LineAttributes la = new LineAttributes(3, LineAttributes.PATTERN_SOLID, false);
8.
PolygonAttributes pa = new PolygonAttributes();
9. TransparencyAttributes ta = new
10. TransparencyAttributes(TransparencyAttributes.NICEST,0.3f)
11.
12. //to make both sides of the face appear
13. pa.setCullFace(PolygonAttributes.CULL_NONE);
14.
look.setColoringAttributes(ca);
15.
look.setPolygonAttributes(pa);
16.
look.setTransparencyAttributes(ta);
17.
18. return look;
19.
20. }//end Case_App() method
21.
Search WWH ::




Custom Search