Hi Nigel,

At 01:40 PM 9/30/99 +0100, Nigel Tamplin wrote:
>[...]
>My problem is that the drawImage method doesn't resize the image very
>well, creating moire effects and so on.
>
>Is there a better way to resize an image, maybe one that averages out
>the colour or pixels instead of chopping out every nth pixel of the
>source?

I think what you're looking for is the KEY_INTERPOLATION
rendering hint. The default is nearest neighbor, which is fast
but doesn't look so great. Set it to bilinear interpolation before
you call drawImage(), like this:

    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
        RenderingHints.VALUE_INTERPOLATION_BICUBIC);

The form of drawImage() you're using is fine. I
think, in Java 2, it's probably just a shortcut for
the drawImage() that takes an AffineTransform anyway.

I hope this helps.

Jonathan

-----
Java 2D Graphics
  http://www.oreilly.com/catalog/java2d/
  http://www.amazon.com/exec/obidos/ASIN/1565924843/

The Unofficial Guide to LEGO MINDSTORMS
  http://www.oreilly.com/catalog/lmstorms/
  http://www.amazon.com/exec/obidos/ASIN/1565926927/
-----

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to