Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Image resizing (a smoother way?)
Image resizing (a smoother way?) [message #449098] Tue, 18 January 2005 11:24 Go to next message
Eclipse UserFriend
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 Go to previous message
Philippe Marschall is currently offline Philippe MarschallFriend
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
>
Previous Topic:importing org.eclipse.swt.internal.carbon
Next Topic:How to access Mac About, Preferences and Quit from SWT
Goto Forum:
  


Current Time: Fri Nov 22 05:22:00 GMT 2019

Powered by FUDForum. Page generated in 0.01792 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top