Game Development Reference
In-Depth Information
Figure 4-5
.
Run the project to see if the Stage object is transparent; clearly, something is set to White
There must be something else in the processing pipeline that is not yet defining its
background
using the
transparency
value. Transparency is defined using a hexa-
decimal value of
#00000000
, which signifies that all
AARRGGBB
(alpha channel,
red, green, blue) color and opacity values are turned off. You will need to start thinking
about the JavaFX components of your application as
layers
(currently, these are
stage-
scene-stackPane-button
). You will be learning about digital imaging concepts such as
color depth, alpha channels, layers, blending, and all the technical information that
relates to processing pixels in a 2D plane as the topic progresses.
The next thing you should try to set to this transparent value is the next level down
in the JavaFX Scene Graph hierarchy from the stage, which contains the Scene Graph
itself. The next most top-level component, as discussed previously, is the
Scene
object,
which also has a background color value parameter or attribute.
Like the Stage class (object), the Scene class (object) does not have a style constant
of TRANSPARENT, so you will have to approach setting the Scene object's back-
ground to a transparency value in a different way, using a different method and con-
stant. One thing you should know is that everything in JavaFX that writes itself to the
screen will in some way support transparency to allow multiple-layer
compositing
in
JavaFX applications.