Image resizing (a smoother way?) [message #449098] |
Tue, 18 January 2005 11:24 |
Eclipse User |
|
|
|
Originally posted by: sublick.gmail.com
Hello,
I've been trying to figure out if there was a way to resize an Image
smoothly. I've tried a few things already...
ImageData.scaledTo() is to blocky for my needs.
Converting to an AWT BufferedImage, using
getScaledInstance(,,SCALE_SMOOTH) to get an AWT Image, convert back to a
BufferedImage, then converting back to a SWT ImageData... is to slow.
What about drawImage (Image, srcX, srcY, srcWidth, srcHeight, destX,
destY, destWidth, destHeight)? I'll assume that it will be blocky too (bad
thing to do though, assume... but I'm tired ^_^).
Anyway, just looking to resize an SWT Image quickly and smoothly. Any
tips would be helpful :)
Thanks
|
|
|
Re: Image resizing (a smoother way?) [message #449342 is a reply to message #449098] |
Sat, 22 January 2005 01:27 |
Philippe Marschall Messages: 121 Registered: July 2009 |
Senior Member |
|
|
IIRC the official way is:
Copy the Image to a Swing BufferedImage of the same size.
Create a BufferedImage of the target size.
Copy/Resize the source BufferedImage into the target BufferedImage by
using either bicubic or billinear filtering.
Copy the target BufferedImage into a new Image of the same size.
Paint the target Image.
Yes, this extremely inefficient.
You'd probably better off by directly embedding a Swing Component into SWT.
SublicK wrote:
> Hello,
>
> I've been trying to figure out if there was a way to resize an Image
> smoothly. I've tried a few things already...
>
> ImageData.scaledTo() is to blocky for my needs.
>
> Converting to an AWT BufferedImage, using
> getScaledInstance(,,SCALE_SMOOTH) to get an AWT Image, convert back to a
> BufferedImage, then converting back to a SWT ImageData... is to slow.
>
> What about drawImage (Image, srcX, srcY, srcWidth, srcHeight, destX,
> destY, destWidth, destHeight)? I'll assume that it will be blocky too
> (bad thing to do though, assume... but I'm tired ^_^).
>
> Anyway, just looking to resize an SWT Image quickly and smoothly. Any
> tips would be helpful :)
>
> Thanks
>
|
|
|
Powered by
FUDForum. Page generated in 0.03699 seconds