Read pixels from a file and display it on the screen

2005-02-24 06:41:34 PM
Hello all
In my program I decode a file format and display it on a JPanel.
Each pixel in the file is tored as 10 bits so I do some conversion and store each pixel value in an integer (only lower
16 bits contain information) I use BufferedImage(I am not sure
if this is the most suitable one) and dipslay the image on
Jpanel as Black&White (the code is below). But colors don't look
Any ideas on how I can correct this?
Thank you.
bi = new BufferedImage(width, height,
WritableRaster wr = bi.getRaster();
wr.setPixels(0, 0, width, height, valsdisplay);