Java rendering problems when antialiasing is enabled

C

coder1024

I've written a Java app which uses Swing to display images and text.

The app consists of a JFrame which contains a JPanel-derived class. In
the paint() method of the JPanel-derived class, I call
Graphics.drawImage() to render an image file previously loaded with
ImageIO.read().

This was working fine until I enabled antialiasing in my video card
settings (GeForce FX 5200 w/128MB RAM, Windows XP SP2). With
antialiasing, none of the content gets rendered in the window. The
problem exhibits itself when I'm tring to render the image myself and
when I just have a JProgressBar control displayed in the window (i.e.
the Swing components themselves aren't correctly rendering with
antialiasing turned on either).

I've received feedback from multiple users seeing this issue as well,
so its not just my machine.

Any ideas? Disabling antialiasing fixes the problem, but I'd like to
be able to get my app to work regardless of whether antialiasing is
enabled/disabled.
 
R

Roedy Green

I've received feedback from multiple users seeing this issue as well,
so its not just my machine.

There is another anti-alias control:

Start | Control Panel | Display | Effects | Smooth

what happens when you toggle it?

I am using Win2K with a nVidia Riva TNT2 model 64 chipset. I have not
seen the sorts of trouble you mentioned. I have done a lot of fiddling
round with antialiasing lately, so likely the problem is likely in
your video drivers. I trust you have the latest and greatest
installed.

see http://mindprod.com/jgloss/antialiasing.html
 
C

coder1024

There is another anti-alias control:
Start | Control Panel | Display | Effects | Smooth

what happens when you toggle it?

I don't have that option. And the thing is, even if I did have that
option and it did fix the problem, it wouldn't be an ideal solution. I
know I can already ask the user to turn off antialiasing and that will
fix the problem too. I'm hoping there's something different I can do
in the code to make it work, even when antialiasing is turned on.
I am using Win2K with a nVidia Riva TNT2 model 64 chipset. I have not
seen the sorts of trouble you mentioned. I have done a lot of fiddling
round with antialiasing lately, so likely the problem is likely in
your video drivers. I trust you have the latest and greatest
installed.

yes I do, and the thing is this has been reported by multiple users
with different systems, so its not just my drivers.
 
R

Roedy Green

I don't have that option. And the thing is, even if I did have that
option and it did fix the problem, it wouldn't be an ideal solution. I
know I can already ask the user to turn off antialiasing and that will
fix the problem too. I'm hoping there's something different I can do
in the code to make it work, even when antialiasing is turned on.
It is possible that turning that switch on and off in combination
with the hardware switch will make it work.

Perhaps both have to be on or both off.
 
C

coder1024

As I said before, even if there are display options which will make it
work that doesn't solve the problem. I can't expect anyone using the
app to go configure their display settings to run my app.

What I need is a way to get it to work without changing display
settings.
 
R

Roedy Green

What I need is a way to get it to work without changing display
settings.

Given that you know the problem is printer driver specific, and that
there is no code in Java that lets you get even near the driver
interface level, I don't think you have much hope of solving it by
tweaking something at a very high level in Java. Somebody needs to
find out why the problem is happening and get the vendor to fix his
video driver.
 
C

coder1024

I assume you meant "video driver specific". No, I do not know that the
problem is video driver specific. The test info I've received actually
indicates that the issue is not specific to a particular video driver.
As I said before, multiple users reported the problem using different
video cards, so I don't think there's a driver issue.

Perhaps there's some switch in Java to disable antialiasing
programmatically for a particular window?
 
R

Roedy Green

I assume you meant "video driver specific". No, I do not know that the
problem is video driver specific. The test info I've received actually
indicates that the issue is not specific to a particular video driver.
As I said before, multiple users reported the problem using different
video cards, so I don't think there's a driver issue.

Sorry, I understood you to say this only happened when you turned on
an anti-alias feature at the device driver level in a particular model
of video card, and that other people with the same card had the same
problem, so it was not faulty hardware.

Just where do people turn on the anti-alias with other cards to
trigger the problem?

With AWT anti-alias follows the system default set in the control
panel.

With Swing, the default is no anti-alias, unless you turn it on
programmatically for each component, though now in 1.5 there is a
global switch. See http://mindprod.com/jgloss/antialiasing.html
 
C

coder1024

Sorry, I understood you to say this only happened when you turned on
an anti-alias feature at the device driver level in a particular model
of video card, and that other people with the same card had the same
problem, so it was not faulty hardware.

The other users did not have the same video card. The problem occurs
with antialiasing with different video cards.
Just where do people turn on the anti-alias with other cards to
trigger the problem?
From the display control panel, there's an Advanced section for your
video card which lets you turn things on and off and adjust performance
settings. The specific options and where they're located within this
vary from card to card. The bottom line is that, however you do it for
your card, turning on antialiasing is interfering with Java rendering.
Sure, you could just turn it off, but I'm hoping on being able to have
the code work regardless.
With AWT anti-alias follows the system default set in the control
panel.

With Swing, the default is no anti-alias, unless you turn it on
programmatically for each component, though now in 1.5 there is a
global switch. See http://mindprod.com/jgloss/antialiasing.html

maybe the problem is I need to turn it on if the system has it enabled.
there has to be some way to make the window just "work" regardless of
the system antialiasing setting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top