As of JDK 5.0, all images created with a
BufferedImage
constructor are now managed images
and can be cached in video memory or, in the case of a remote X
server, on the X server side. Earlier, implementations
managed only compatible images: those created with the
Component
createImage(int, int)
method or
with the GraphicsConfiguration
createCompatibleImage
methods. Managed images
generally perform better than unmanaged images.
The bug report that corresponds to this change is: 4881082
The Image
class has three new methods related to
hardware acceleration. The
getCapabilities
method, formerly defined only in
VolatileImage
,
allows you to determine whether the image is currently accelerated.
Two other methods let you set or get a hint about how important
acceleration is for the image:
setAccelerationPriority
and getAccelerationPriority
.
The GraphicsConfiguration
class has two new
methods,
createCompatibleVolatileImage(int, int, int)
and
createCompatibleVolatileImage(int, int, ImageCapabilities,
int)
, that allow you to create transparent
VolatileImage
s.
setAccelerationPriority
is ignored, and images created with the
createCompatibleVolatileImage
methods are not always
hardware accelerated. On Linux and Solaris systems, only
OPAQUE
VolatileImages
are hardware
accelerated. On Microsoft Windows systems, images created with
createCompatibleVolatileImage
in JDK 5.0 are hardware
accelerated only if the hardware supports acceleration and one of
the following is true:
OPAQUE
.TRANSLUCENT
and
translucency acceleration has been specifically enabled at runtime
(sun.java2d.translaccel=true
).The bug reports that correspond to this change are: 4607536 and 5008045.
JDK 5.0 includes a new OpenGL-based pipeline for Java 2D. This pipeline provides hardware acceleration for simple rendering operations (text, images, lines, and filled primitives) as well as those that involve complex transforms, paints, composites, and clips. This pipeline is available on all platforms (Solaris, Linux, and Microsoft Windows) and is currently disabled by default.
To silently enable the OpenGL-based pipeline, specify the following system property on the command line:
-Dsun.java2d.opengl=true
To receive verbose console output about whether the OpenGL-based
pipeline is initialized successfully for a particular screen,
specify "True
" (note the uppercase
T):
-Dsun.java2d.opengl=True
Minimum requirements for Solaris/Linux:
Minimum requirements for Microsoft Windows:
The following framebuffers are known to work with the OpenGL-based Java 2D pipeline:
Accelerated OpenGL libraries for the Solaris x86 platform are not available from Sun. However, third-parties such as Xi Graphics are known to support OpenGL libraries for Solaris x86.
Most Linux distributions include the Mesa 3D graphics library, which is a software implementation of the OpenGL specification. Since Mesa does not take advantage of hardware acceleration, it is likely that the OpenGL-based Java 2D pipeline will run much more slowly than the default (X11-based) pipeline. Therefore, to achieve optimal performance with the OpenGL-based pipeline, it is recommended that you install accelerated OpenGL drivers provided by your graphics hardware manufacturer.
The following web sites may have accelerated OpenGL drivers you can download.
To achieve optimal performance with the OpenGL-based pipeline, install accelerated OpenGL drivers provided by your graphics hardware manufacturer. The following websites have accelerated OpenGL drivers available for download that are known to be compatible with the OpenGL-based Java 2D pipeline:
Note: The latest drivers from both Nvidia and ATI have known issues on Microsoft Windows that might cause rendering artifacts in your application. We are actively investigating these driver bugs and are working with the manufacturers to have them resolved in future driver updates.
The bug reports that correspond to this change are: 4641868 and 4683270
Solaris and Linux systems can now use printers configured as CUPS (Common UNIX Printing System) printers. This expands the printers the Java platform can use to all those supported by CUPS, including most PostScript and raster printers, making it much easier to use low-cost printers with Linux. CUPS is based on IPP (Internet Printing Protocol).
See CUPS for more information.
The bug report that corresponds to this change is: 4200154
The 2D implementation now supports bicubic interpolation and
uses it whenever requested. Previously, the
VALUE_INTERPOLATION_BICUBIC
hint defined by the
RenderingHints
class wasn't honored, and bilinear interpolation was used instead.
Now the bicubic rendering hint is honored, and a new constant
TYPE_BICUBIC
has been added to AffineTransformOp
.
The bug reports that correspond to this change are: 4390880 and 4468862
It is now possible to create Font
objects from Type
1 fonts and to create Font
objects directly from files
containing either Type 1 or TrueType font data.
To support the new functionality, the Font
class
has a new
createFont
method that creates Font
objects
from files. The pre-existing
createFont
method creates Font
objects from streams. A new constant, Font.TYPE1_FONT
,
specifies Type 1 fonts to either createFont
method.
The bug report that corresponds to this change is: 4641861
A number of internal changes to text rendering code greatly improve its robustness, performance, and scalability.
The bug report that corresponds to this change is: 4097028
2D text rendering using logical fonts now takes advantage of installed host OS fonts for all supported writing systems to render multilingual text. For example, if you run in a Thai locale environment but have Korean fonts installed, both Thai and Korean are rendered.