Anti-aliasing GIF Images

T

Thomas Weidenfeller

Kevin said:
Each dodgem is a gif image. Since the applet often rotates each
dodgem, is there a way that I can use anti-aliasing to reduce the
jagged edges? Or can anti-aliasing only be applied to things 'drawn'
like drawLine, fillRect, or drawString?

Anitaliasing is indeed best done during rasterisation (what you call
'drawing'). Which means, when some data with (theoretically) infinite
resolution is fitted into the discrete raster of which e.g. a gif image
consists of.

There are other techniques to reduce the effect in images. Essentially
these are image filter. Typically a filter, like a bilinear filter, is
applied to a super-sampled version of the image (an image e.g.
originally created twice as large as needed) during downscaling. The
results is a (hopefully only) slightly blurred image. It depends very
much on the contents of the image, and the type of filtering if such an
image is perceived as better or worse than the original. java.awt.image
provides a few filters, you just have to try what works best for you.

/Thomas

PS: comp.lang.java.gui is next door.
 
B

Boudewijn Dijkstra

Kevin Bertman said:
I have created a Java Dodgems game at
http://www.kevinbertman.co.uk/japan/dodgemsRules.shtml

Each dodgem is a gif image. Since the applet often rotates each
dodgem, is there a way that I can use anti-aliasing to reduce the
jagged edges? Or can anti-aliasing only be applied to things 'drawn'
like drawLine, fillRect, or drawString?

Enlarge the gif files. When drawing, rotate them and then rescale.
 
J

John

Kevin said:
I have created a Java Dodgems game at
http://www.kevinbertman.co.uk/japan/dodgemsRules.shtml

Each dodgem is a gif image. Since the applet often rotates each
dodgem, is there a way that I can use anti-aliasing to reduce the
jagged edges? Or can anti-aliasing only be applied to things 'drawn'
like drawLine, fillRect, or drawString?

They're quite simple shapes. Why not define a dodgem as a shape? Then
you can avoid images.

JOhn
 
M

marcus

One time in ancient history I played with partial transparency in an
image in an applet. It will take some digging to find the info, but
what I did was grab the graphics of the image and changed the
transparency byte of each pixel to (255/2) or whatever. This allows the
pixel to blend with the background. Might be easier to make the outside
edge of your image partially transparent than to learn the hardcore
techniques game designers use.

I gave up and created 16 rotated versions of my image, saved them all as
gifs, and loaded them into an array. The thing about antialiasing this
way is it blends the image with a fixed background color, and looks
worse if you change the background later.
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top