[5543] in java-interest

home help back first fref pref prev next nref lref last post

16 bit Java

daemon@ATHENA.MIT.EDU (David Lipscomb)
Thu Feb 15 16:18:30 1996

Date: Thu, 15 Feb 1996 11:53:18 -0800
From: David Lipscomb <dlipscom@mbed.com>
To: java-interest@java.sun.com
CC: dlipscom@mbed.com, evan@mbed.com, brent@mbed.com

This is a multi-part message in MIME format.

--------------6615632799
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

All:

I am trying to write an applet to show graphics using 16 bit color.  The 
applet code and html file are at the end of this mail message (you can 
also view the running applet at 
http://www.mbed.com/test/SixteenBit.html).  If I load this html file in 
Netscape 2.0 running my Windows monitor at 16 bit color, the first image 
(the one displayed by the html tag <img src=...>) is shown in 16 bit 
color, but the same image displayed by the java applet appears dithered 
to 8 bit color.  

I also have the same problem with the applet viewer; it seems to default 
to 8 bit color as well.

Is there some way to get a 16 bit color graphics context for the applet? 
  Or is there another way to achieve the desired result?

Sincerely,

-- 
David Lipscomb                        Voice - 415 778-0931
mBED Software                         Email - dlipscom@mbed.com

--------------------------------------------------
--------------- Sixteen.html ---------------------
--------------------------------------------------
<title>16 Bit Image</title>
<HR>
<H4>FIRST : IMAGE DIPLAYED USING HTML's IMG TAG.</H4>
<H4>SECOND : JAVA DIPLAYING SAME IMAGE</H4>
<IMG SRC="SixteenBit.jpg">
<applet code="SixteenBit.class" width=200 height=320>
  <param name=IMAGE value="SixteenBit.jpg">
</applet>
<hr>
<a href="SixteenBit.java">The source.</a>
--------------------------------------------------
--------------- Sixteen.java ---------------------
--------------------------------------------------
import java.io.InputStream;
import java.awt.*;
import java.net.*;
public class SixteenBit extends java.applet.Applet implements Runnable 
{
  Image img = null;
  Thread kicker = null;
  public void run() 
  {
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    img = getImage(getCodeBase(), getParameter("IMAGE"));
    repaint();
    while (true)
    {
      try  {Thread.sleep(1000);}
      catch (InterruptedException e) ;
    }
}
public void paint(Graphics g) 
{
  if (img != null)
  g.drawImage(img, 0, 0, this);
}
public void start()
{
  if (kicker == null)
  {
    kicker = new Thread(this);
    kicker.start();
  }
}
public void stop() 
{
  kicker = null;
}

--------------6615632799
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="SixteenBit.java"

import java.io.InputStream;
import java.awt.*;
import java.net.*;

public class SixteenBit extends java.applet.Applet implements Runnable 
{
	Image img = null;
	Thread kicker = null;

    public void run() 
	{
		Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
		img = getImage(getCodeBase(), getParameter("IMAGE"));
		repaint();
		while (true)
		{
			try  {Thread.sleep(1000);}
			catch (InterruptedException e) ;
		}
    }

    public void paint(Graphics g) 
	{
		if (img != null)
			g.drawImage(img, 0, 0, this);
	}

	public void start() 
	{
		if (kicker == null)
		{
			kicker = new Thread(this);
			kicker.start();
		}
	}

	public void stop() 
	{
		kicker = null;
	}
}

--------------6615632799--

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post