Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How can I manipulate the size of image without scaling ?
How can I manipulate the size of image without scaling ? [message #460611] Thu, 01 September 2005 12:57 Go to next message
Yves Harms is currently offline Yves HarmsFriend
Messages: 80
Registered: July 2009
Member
Is there any way to add additional canvas width to an swt image without
scaling it ? (This would be the same as enlarging the cnavas size in
Photoshop).
The additional canvas space should be transparent.

Background:

Images displayed in a table are always resized to the size of the first
image inserted into the table.
So far so god, but the following images are scaled without respect to
their aspect ratio. So I want to workaround this by normalizing the
aspect ratio of all images by adding additional canvas space before
inserting them into the table.

Any tips would be highly appreciated.

Thanks,
Yves
Re: How can I manipulate the size of image without scaling ? [message #460614 is a reply to message #460611] Thu, 01 September 2005 14:15 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
You could create a new image of the right size, then copy the contents of one image into another, which is probably the easiest approach.

There's some info on ImageData at http://www.eclipse.org/articles/Article-SWT-images/graphics- resources.html
Re: How can I manipulate the size of image without scaling ? [message #460615 is a reply to message #460611] Thu, 01 September 2005 14:17 Go to previous message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Yves Harms" <user@domain.invalid> wrote in message
news:df6u2m$8k5$1@news.eclipse.org...
> Is there any way to add additional canvas width to an swt image without
> scaling it ? (This would be the same as enlarging the cnavas size in
> Photoshop).
> The additional canvas space should be transparent.
>
> Background:
>
> Images displayed in a table are always resized to the size of the first
> image inserted into the table.
> So far so god, but the following images are scaled without respect to
> their aspect ratio. So I want to workaround this by normalizing the aspect
> ratio of all images by adding additional canvas space before inserting
> them into the table.
>
Create a new Image with the increased canvas size.
Create a GC for the new Image.
Draw the old Image in the desired location in the GC.
Dispose the GC.
Dispose the old Image.
---
Sunil
Previous Topic:"redraw()" cannot update the display
Next Topic:KTable FULL_SELECTION
Goto Forum:
  


Current Time: Thu Apr 25 22:58:22 GMT 2024

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

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

Back to the top