🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
1 messages
1 total messages Started by Hakan Thu, 24 Feb 2005 10:41
Read pixels from a file and display it on the screen
#579
Author: Hakan
Date: Thu, 24 Feb 2005 10:41
20 lines
1502 bytes
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 
correct. 

Any ideas on how I can correct this?
Thank you.

Hakan

       bi = new BufferedImage(width, height,    
BufferedImage.TYPE_USHORT_GRAY);
       WritableRaster wr = bi.getRaster();
       wr.setPixels(0, 0, width, height, valsdisplay);
       repaint();
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads