Anti-aliasing GIF Images

Discussion in 'Java' started by Kevin Bertman, Nov 26, 2004.

  1. 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?
     
    Kevin Bertman, Nov 26, 2004
    #1
    1. Advertising

  2. Kevin Bertman wrote:
    > 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.

    --
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
     
    Thomas Weidenfeller, Nov 26, 2004
    #2
    1. Advertising

  3. "Kevin Bertman" <> schreef in bericht
    news:...
    >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.
     
    Boudewijn Dijkstra, Nov 27, 2004
    #3
  4. Kevin Bertman

    John Guest

    Kevin Bertman wrote:
    > 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
     
    John, Nov 27, 2004
    #4
  5. Kevin Bertman

    marcus Guest

    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.

    Kevin Bertman wrote:
    > 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?
     
    marcus, Nov 29, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Rae
    Replies:
    0
    Views:
    644
    Mark Rae
    Mar 7, 2006
  2. John B. Matthews
    Replies:
    0
    Views:
    725
    John B. Matthews
    Aug 14, 2008
  3. Knute Johnson
    Replies:
    0
    Views:
    471
    Knute Johnson
    Aug 14, 2008
  4. Knute Johnson
    Replies:
    1
    Views:
    577
    Knute Johnson
    Aug 14, 2008
  5. Knute Johnson
    Replies:
    1
    Views:
    513
    John B. Matthews
    Aug 14, 2008
Loading...

Share This Page