In this section, you will studied how to use alpha values to the draw the specific shape in layers.
Use Alpha values to draw in Layers
In this section, you will studied how to use alpha values to the draw the specific shape in layers.
An alpha object produces the alpha value which changes with time
specified by the parameters of the alpha object. The alpha value is the
graphics state parameter that is used to composite objects to the existing page.
At full intensity, objects are opaque. At zero intensity, objects are invisible.
As the intensity decreases, the specific shape becomes transparent. It can be a
part of vertex or texture.
We are providing you an example which uses the alpha
values to show transparency. A frame of size (350,300) is created. The g.fillOval()
fills the oval shape with the color defined in the constructor new Color(150, 100, 100,
70) of class Color. The values defined in the constructor are alpha
values which shows the transparency.
Here is the code of UseAlphaValues.java
import java.awt.*;
|
Output will be displayed as: