I have an image that I wanted to print... This image is constructed
using MemoryImageSource using an array of bytes, with each byte
representing a pixel.
I also have a DirectColorModal to translate the color in each pixel.
image = createImage
(new MemoryImageSource
(d.width,
d.height,
dcm, /* Direct Color
Model */
pixels, /* array of bytes
*/
0,
d.width) );
When I tried to print the image. I keep getting this error(listed
below). But when I change the array of bytes to array of ints. It
worked. But I do not want to store my data as ints when bytes works
fine... So any ideas???
Error Message:
============
Exception occurred during event dispatching:
java.lang.ClassCastException: java.awt.image.DirectColorModel
at sun.awt.motif.PSGraphics.blitImage(Compiled Code)
at sun.awt.motif.PSGraphics.drawImage(Compiled Code)
at MyCanvas.paint(Compiled Code)
at MemoryImageSourceTest1.actionPerformed(Compiled Code)
at java.awt.Button.processActionEvent(Compiled Code)
at java.awt.Button.processEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
Chang-Cheng (Eric) Chao
Merlin Software Technologies Inc.
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]