|
Tutorial
Index
By Dennis Sigel and Saif
Hasan
July 2000
Overview | Tutorial
The Java Advanced Imaging (JAI) Tutorial 1.0 provides an overview of JAI 1.0-1.0.2 features, source code, and demos in the form of an interactive book. Examples show key JAI 1.0-1.0.2 functionality and coding style to incorporate advanced imaging features into programs or applets, including:
- Convolution filtering
- Basic image arithmetic operators
- Look up table operations (brightness and contrast)
- Pan and zoom
- Image compositing
The tutorial was written using the Java Foundation Classes and Project Swing components. To view this tutorial or to develop applets using JAI 1.0 or 1.0.2, you must download and install the Java Plug-In and the JAI 1.0 or 1.0.2 package. This tutorial is also available in application form on the JAI web site.
Tutorial Set Up
To view JAI 1.0 tutorial applets in your browser:
- Download and install the latest version of Java Plug-In.
-
Download and install the 1.0 or 1.0.2 version of JAI. The JAI installation puts the files into the JDK on the system. To use JAI 1.0 or 1.0.2 with applets in browsers, copy the appropriate JAR files to the virtual machine used by the browser.
For Solaris
The next steps assume that Netscape has been installed in the following path:
/opt/NSCPcom/
- Set the following environment variables (in csh):
% setenv THREADS_FLAG native
% setenv NPX_PLUGIN_PATH /opt/NSCPcom/plugins
% setenv NPX_JRE_PATH /opt/NSCPcom/j2pi
- Copy the JAI 1.0 or 1.0.2 files to the
plugin directory:
$PLUGIN is the location Netscape has been installed.
$ARCH is the architecture(sparc/i386).
$JAVAHOME is the location of the JDK.
// Type each %cp command on one line
%cp $JAVAHOME/jre/lib/ext/jai_core.jar $PLUGIN
/j2pi/lib/
%cp $JAVAHOME/jre/lib/ext/jai_codec.jar
$PLUGIN/j2pi/lib/
%cp $JAVAHOME/jre/lib/ext/mlibwrapper_jai.jar
$PLUGIN/j2pi/lib/
%cp $JAVAHOME/jre/lib/ext/registryFile.jai
$PLUGIN/j2pi/lib/
%cp $JAVAHOME/jre/lib/$ARCH/libmlib_java_jai.so
$PLUGIN/j2pi/lib/$ARCH/
|
- If
$ARCH is sparc, do the following:
// Type the following on one line
%cp $JAVAHOME/jre/lib/$ARCH
/libmlib_java_jai_vis.so
$PLUGIN/j2pi/lib/$ARCH/
|
For Windows
Copy the JAI 1.0 or 1.0.2 files to the JRE in the JavaSoft directory.
C:\Program Files\JavaSoft\JRE\
Copying the files can be done either from the command line or from Windows Explorer.
- From the command line:
%JAVAHOME% is the location of the JDK.
%JRE% is the location of the Java Runtime Environment.
()
// Type each of the commands on one line
C:\>copy %JAVAHOME%\jre\lib\ext
\jai_core.jar %JRE%\lib\ext
C:\>copy %JAVAHOME%\jre\lib\ext
\jai_codec.jar %JRE%\lib\ext
C:\>copy %JAVAHOME%\jre\lib\ext
\mlibwrapper_jai.jar %JRE%\lib\ext
C:\>copy %JAVAHOME%\jre\lib\ext
\registryFile.jai %JRE%\lib\ext
C:\>copy %JAVAHOME%\jre\bin\
mlib_image_jai.dll %JRE%\bin\
C:\>copy %JAVAHOME%\jre\bin
\mlib_java_jai.dll %JRE%\bin\
|
- From Windows Explorer:
Copy and paste the files from
\lib\ext
to:
C:\Program Files\JavaSoft\JRE\
In addition, copy and paste the files in
\bin\
to:
C:\Program Files\JavaSoft\JRE\
These steps ensure that the JAI 1.0 or 1.0.2 files are picked up by the plugin at runtime.
Applet Permissions
For JAI 1.0 or 1.0.2 applets to use native acceleration on the Sparc and Windows platforms, appropriate security permissions must be given.
Edit the java.policy file to set permissions. The location of java.policy depends on your operating system.
Warning: Setting these security permissions grants ALL applets complete privileges on your system, which may expose your system to danger from rogue applets.
Note: In case an OutOfMemoryException is encountered while running some of the demos in the tutorial, try changing the amount of memory available to the Java Virtual Machine1 by adding the following "Java Run Time Parameters" in the Java Plug In Control Panel:
-ms16m -mx64m
The Java Plug In Control Panel is located in the Control Panel on Windows machine and in the Java Plug In directory on Solaris machines (typically /opt/NSCPcom/j2pi)
Overview | Tutorial
_______
1 As used on this web site, the terms "Java Virtual Machine" or "JVM" mean a virtual machine for the Java platform.
|