Hi, All:
I used the following function from PrintCanvas3D to convert my Canvas3D to a BufferedImage:
BufferedImage doRender(int width, int height)
{
{
bImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
ImageComponent2D buffer =
new ImageComponent2D(ImageComponent.FORMAT_RGBA, bImage);
ImageComponent2D buffer =
new ImageComponent2D(ImageComponent.FORMAT_RGBA, bImage);
setOffScreenBuffer(buffer);
renderOffScreenBuffer();
waitForOffScreenRendering();
bImage = getOffScreenBuffer().getImage();
renderOffScreenBuffer();
waitForOffScreenRendering();
bImage = getOffScreenBuffer().getImage();
return bImage;
}
}
It worked for me. Now I want to display this BufferedImage in a HTML file.
In my class, I have a function to return this BufferedImage:
public BufferedImage returnImage()
{
if(bImage == null)
{
System.out.println("bImage in returnImage() of GJ3DFloodZone is null");
}
else
System.out.println("bImage in returnImage() of GJ3DFloodZone is not null");
{
if(bImage == null)
{
System.out.println("bImage in returnImage() of GJ3DFloodZone is null");
}
else
System.out.println("bImage in returnImage() of GJ3DFloodZone is not null");
return bImage;
}
}
The following is a partial list of the HTML file I used to run my Applet:
<HTML>
<HEAD>
<TITLE>3D presentation</TITLE>
<script language=JavaScript>
function returnImage(form)
{
document.test2.returnImage();
var newContent = "<HTML><HEAD><TITLE>Print 3D Image</TITLE></HEAD>"
newContent += "<BODY><FORM><img src=";
newContent += document.test2.returnImage();
newContent += "></FORM></BODY></HTML>";
document.write(newContent);
}
</script>
</HEAD>
<BODY>
<form name=test>
<div align=center>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.0 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 550 HEIGHT = 550 ALIGN = middle
NAME="test2"
codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
<param name="CODE" value="GJ3DFloodZone.class">
<param name=NAME value="test2">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="true">
<COMMENT>
<embed type="application/x-java-applet;version=1.3"
java_CODE="GJ3DFloodZone.class"
NAME="test2"
WIDTH="550" HEIGHT="550" ALIGN="middle"
scriptable=true
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
<noembed>
</COMMENT>
</noembed>
</OBJECT>
<!--"END_CONVERTED_APPLET"-->
<p>
<input type=button value="Display image" >
</div>
</form>
</BODY>
</HTML>
<HEAD>
<TITLE>3D presentation</TITLE>
<script language=JavaScript>
function returnImage(form)
{
document.test2.returnImage();
var newContent = "<HTML><HEAD><TITLE>Print 3D Image</TITLE></HEAD>"
newContent += "<BODY><FORM><img src=";
newContent += document.test2.returnImage();
newContent += "></FORM></BODY></HTML>";
document.write(newContent);
}
</script>
</HEAD>
<BODY>
<form name=test>
<div align=center>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.0 -->
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 550 HEIGHT = 550 ALIGN = middle
NAME="test2"
codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
<param name="CODE" value="GJ3DFloodZone.class">
<param name=NAME value="test2">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="true">
<COMMENT>
<embed type="application/x-java-applet;version=1.3"
java_CODE="GJ3DFloodZone.class"
NAME="test2"
WIDTH="550" HEIGHT="550" ALIGN="middle"
scriptable=true
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
<noembed>
</COMMENT>
</noembed>
</OBJECT>
<!--"END_CONVERTED_APPLET"-->
<p>
<input type=button value="Display image" >
</div>
</form>
</BODY>
</HTML>
After I opened this html file, I can play with it and everything is fine. Now what I want to do is, if I click button "Display image", the JavaScript function returnImage() will be called, the purpose for this function is to pass the BufferedImage to another html file and display it. The reason why I want to display the BufferedImage in the HTML is that I have many other things to display in the HTML file and I want to display all of them in one HTML file.
If I click button "Display image", I did not get any error message in I.E., but the image is not displayed. In NetScape, I got error message: document.test2 has no properties.
Any help will be highly appreciated.
Gaoming
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".