[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: SWT and Java3D - Resize problem
|
You need to scale the image yourself using GC.drawImage(Image image, int
srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int
destWidth, int destHeight)
For an example that does this, see the latest version of GraphicsExample's
Image->Scale tab.
http://www.eclipse.org/swt/examples.php
Carolyn
"Xinuo Chen" <xinuo.chen@xxxxxxxxx> wrote in message
news:51f938f801bd93ac19f8a23c7d3bef33$1@xxxxxxxxxxxxxxxxxx
> Hi all.
>
> In Swing, if I set a frame as BorderLayout and add a universe(canvas3d) to
> it, then if the frame is resized, the universe is resized too with
> according scale. for e.g., if there is a ball with large size in the
> center of universe, and if the frame is resize to smaller, then the whole
> universe is resized accordingly too and you still can see the ball with
> large size (scaled of course) in the center of universe no matter how
> small the frame is resized to.
>
> However, in SWT, the universe doesn't react like that when a shell is
> resized. if I make the height of the shell which contains the universe
> half, then the universe won't scale accordingly and you can only see half
> of the ball in the universe.
>
> Any way to achieve the same effect as we do in SWING for the universe
> resizing?
>
> Thanks
>
> Xinuo
>
> Code:
>
> SWT_AWT_container = new Composite(parent, SWT.EMBEDDED);
> SWT_AWT_container.setLayout(new FillLayout()); awt =
> SWT_AWT.new_Frame(SWT_AWT_container);
> awt.setLayout(new BorderLayout());
> GraphicsConfiguration gconf3d =
> SimpleUniverse.getPreferredConfiguration();
> canvas = new Canvas3D(gconf3d);
> awt.add(canvas, BorderLayout.CENTER);
>