Skip to main content
gamedev.net
🔒 Locked

[java] Getting PixelType from a Frame?!

Started by SirGorthon Sep 24, 2005 at 11:30 PM 0 replies 900+ views
Original Post
SirGorthon
SirGorthon
Howdy again ya'll! I hate making a buncha threads, but this is a new question! :( Sorry! I was wondering if there's a simpler way to get the PixelType in a Frame! Right now I use:

pixelType = window.getGraphicsConfiguration().createCompatibleImage(1, 1).getType();
H_o_p_s
H_o_p_s
Here is the function that I use for loading images...
	public static void LoadImage(String Key, String Filename) {		URL url=null;		BufferedImage initial = null;		try { 			url = gc.getClass().getClassLoader().getResource(Filename); 			initial = ImageIO.read(url);			GraphicsConfiguration gC = Battle.Windows.MainWindow.getGraphicsConfiguration();			BufferedImage result = gC.createCompatibleImage(initial.getWidth(),initial.getHeight(), initial.getType());			Graphics2D g = result.createGraphics();			g.drawImage(initial,0,0,null);			g.dispose();			map.put(Key, result);			Log.add(gc, "Image Added: map["+Key+"]="+Filename);					} catch (Exception e) {			System.out.println("GraphicsCache:"+e);			Log.add(gc, "Error Loading \""+Filename+"\", make sure MainWindow is init()");		}	}
Look the same [grin]
BRING BACK THE BLACK (or at least something darker)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.