Re: VisAD Tutorial now available

Hi Shin-ta,

The TYPE_USHORT_565_RGB sounds like a Windows 16-bit colour image. I've
noticed a number of the AWT classes return an default image type with a
colour format compatible with the display being used as it makes
painting the image much faster. Just as a guess I'd say you were running
on a windows box with 16-bit colour (65536 colours) selected, although I
could be completely wrong.

One way to convert colour formats for images is to create a
BufferedImage with the desired colour model/type and then paint the
source image into it using the Graphics object returned by its
getGraphics() method. There are probably other ways as well.

The above is just guesswork based on what you describe so I apologise in
advance if it is all a red herring.

Tim.

Bill Hibbard wrote:
> 
> Hello Shin-ta,
> 
> > //data Init
> >    DisplayImpl[] dpys = new DisplayImpl[2];
> >     dpys[0] = new DisplayImplJ3D("display1"); // 3D window
> >     dpys[1] = new DisplayImplJ2D("display2"); // 2D window
> >
> > I want to get the images from these two windows and encoding these two
> > inmage into GIF file.
> >
> >    BufferedImage image0= dpysloc[0].getImage();
> >    BufferedImage image1= dpysloc[1].getImage();
> >
> > but I find out the image types are different.
> >
> >          image0= dpys[0].getImage();
> >          //TYPE_USHORT_565_RGB
> >          image1= dpy[1].getImage();
> >          //TYPE_INT_RGB
> >
> > 2D image is sucessful in tranfer into Gif file, 3D image is not.
> >
> > Can I get the same image type from 2D&3D windwos or change image type later?
> 
> This is a mystery.  VisAD actually extracts the BufferedImage
> from Java3D in visad.java3d.VisADCanvasJ3D.postSwap(), where
> the BufferedImage is constructed with TYPE_INT_RGB.
> 
> As a test, I put a:
> 
>   System.out.println(image.getType());
> 
> inside the while(true) loop in Test51.java (the Java3D
> getImage() test) and got '1', which represents TYPE_INT_RGB.
> [I did the same thing in Test50.java (the Java2D getImage()
> test) and got '4', which represents TYPE_INT_BGR.]
> 
> So I don't know where your TYPE_USHORT_565_RGB is coming from.
> 
> However, Don Murray has been writing applications that save
> Java3D displays to JPEG files, so perhaps he can give you some
> advice.
> 
> Cheers,
> Bill
> ----------------------------------------------------------
> Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
> hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
> http://www.ssec.wisc.edu/~billh/vis.html

-- 
Tim Stevenson
Surpac Software International
162A Roslyn Avenue, Blackmans Bay, Tasmania, Australia 7052
Phone/Fax:      +61 3 62294610
Home Phone:     +61 3 62298866
Email:          tims@xxxxxxxxxx