[1836] in java-interest
Re: Display an Image
daemon@ATHENA.MIT.EDU (Jim Graham)
Mon Sep 18 19:27:36 1995
Date: Fri, 15 Sep 1995 14:27:45 -0700
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM
Hi Mary,
> I have a simple problem, but I just cant seem to get it to
> work. I have a buffer of raw image data, the red, green and
> blue bands of image data reside in the buffer.
>
> My goal is to retrieve the data and display it on an applet
> in the browser.
>
> I'm working with alpha3.
In Alpha 3, you create an image by making an awt.DIBitmap object out
of it and using the "item.parent.createImage()" method. Unfortunately
since the DIBitmap object can only express an 8-bit image with a fixed
colormap, you will have to dither your RGB bands into an 8-bit colormap
using some kind of color cube.
In Beta, you can create a memory buffer containing the image data and
then create a MemoryImageSource from that buffer. You can look at the
DitherTest and ImageTest applets in the JDK release for examples of how
to do this. These images can be full 24-bit so you wouldn't have to
do any dithering, although if your red, green, and blue bands are in
separate pieces, you would have to combine them into a single buffer
with the red, green, and blue components for each pixel coalesced into
a single integer.
...jim
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com