Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How I can capture a SWT Widget FULL Image?
How I can capture a SWT Widget FULL Image? [message #451315] Fri, 25 February 2005 14:02 Go to next message
David is currently offline DavidFriend
Messages: 30
Registered: July 2009
Member
Hi.

I'm using a Treeviewer and I capture the image that is showing when
I execute the program with this lines:


Point size = treeviewer.getTree().getSize();
GC gc = new GC(treeviewer.getTree());
Display display2 = treeviewer.getTree().getDisplay();
final Image image = new Image(display2, size.x, size.y);
gc.copyArea(image, 0, 0);

The problem is that the tree as hidden zones visibles only moving the
scrolls barsa nd theimage only shows the image that the user views.

I need capture an image complete of the tree, without scrollbars and
without hidden zones.

can I do this?
Re: How I can capture a SWT Widget FULL Image? [message #451368 is a reply to message #451315] Mon, 28 February 2005 06:16 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
David Díaz :

Under Windows probably yes.
You could create same Tree on Shell that is not visible on screen,
make it big enough to fix full tree and use WM_PRINT (see MSDN) to get
image. But this is not portable, so try to find better solution.

> Hi.
>
> I'm using a Treeviewer and I capture the image that is showing when
> I execute the program with this lines:
>
>
> Point size = treeviewer.getTree().getSize();
> GC gc = new GC(treeviewer.getTree());
> Display display2 = treeviewer.getTree().getDisplay();
> final Image image = new Image(display2, size.x, size.y);
> gc.copyArea(image, 0, 0);
>
> The problem is that the tree as hidden zones visibles only moving the
> scrolls barsa nd theimage only shows the image that the user views.
>
> I need capture an image complete of the tree, without scrollbars and
> without hidden zones.
>
> can I do this?
>


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)


Konstantin Scheglov,
Google, Inc.
Re: How I can capture a SWT Widget FULL Image? [message #451376 is a reply to message #451368] Mon, 28 February 2005 14:19 Go to previous messageGo to next message
David is currently offline DavidFriend
Messages: 30
Registered: July 2009
Member
Hi again!

The problem is that I don't know the tree size.

I can write '.expandAll' to expand all the tree components but I don't
know the size of this 'open tree' to create a new component with this
size and print.

can I do something?

Many Thanks!!!



Konstantin Scheglov wrote:

> David Díaz :

> Under Windows probably yes.
> You could create same Tree on Shell that is not visible on screen,
> make it big enough to fix full tree and use WM_PRINT (see MSDN) to get
> image. But this is not portable, so try to find better solution.

>> Hi.
>>
>> I'm using a Treeviewer and I capture the image that is showing when
>> I execute the program with this lines:
>>
>>
>> Point size = treeviewer.getTree().getSize();
>> GC gc = new GC(treeviewer.getTree());
>> Display display2 = treeviewer.getTree().getDisplay();
>> final Image image = new Image(display2, size.x, size.y);
>> gc.copyArea(image, 0, 0);
>>
>> The problem is that the tree as hidden zones visibles only moving the
>> scrolls barsa nd theimage only shows the image that the user views.
>>
>> I need capture an image complete of the tree, without scrollbars and
>> without hidden zones.
>>
>> can I do this?
>>
Re: How I can capture a SWT Widget FULL Image? [message #451394 is a reply to message #451376] Tue, 01 March 2005 05:17 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
David Díaz:

> The problem is that I don't know the tree size.
>
> I can write '.expandAll' to expand all the tree components but I don't
> know the size of this 'open tree' to create a new component with this
> size and print.
>
> can I do something?
>
I am not sure, but you can try to use Control.computeSize() with
SWT.DEFAULT sizes.

> Many Thanks!!!
>
>
>
> Konstantin Scheglov wrote:
>
>> David Díaz :
>
>
>> Under Windows probably yes.
>> You could create same Tree on Shell that is not visible on screen,
>> make it big enough to fix full tree and use WM_PRINT (see MSDN) to get
>> image. But this is not portable, so try to find better solution.
>
>
>>> Hi.
>>>
>>> I'm using a Treeviewer and I capture the image that is showing when
>>> I execute the program with this lines:
>>>
>>>
>>> Point size = treeviewer.getTree().getSize();
>>> GC gc = new GC(treeviewer.getTree());
>>> Display display2 = treeviewer.getTree().getDisplay();
>>> final Image image = new Image(display2, size.x, size.y);
>>> gc.copyArea(image, 0, 0);
>>>
>>> The problem is that the tree as hidden zones visibles only moving the
>>> scrolls barsa nd theimage only shows the image that the user views.
>>>
>>> I need capture an image complete of the tree, without scrollbars and
>>> without hidden zones.
>>>
>>> can I do this?
>>>
>
>
>
>


--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)


Konstantin Scheglov,
Google, Inc.
Re: How I can capture a SWT Widget FULL Image? [message #451818 is a reply to message #451394] Wed, 09 March 2005 15:28 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
The default behaviour of Tree.computeSize(SWT.DEFAULT,SWT.DEFAULT) is to
answer the size that's needed to display the root-level items only. So I
don't think that there's an easy way to determine the size of a
fully-expanded Tree, though there is a report related to the current
Tree.computeSize(...) behaviour, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=85533 .

Grant

"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:sLOwI4hHFHA.3736@fairy.ao.nlmk...
> David D
Previous Topic:SWT Experimental OpenGL Plug-in on Mac
Next Topic:Changing the TabItem or CTabItem's shape
Goto Forum:
  


Current Time: Fri Apr 19 00:49:34 GMT 2024

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

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

Back to the top