Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » GC.copyArea offscreen widgets
GC.copyArea offscreen widgets [message #547383] Fri, 16 July 2010 14:25 Go to next message
Stuart Caunt is currently offline Stuart CauntFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

Is it possible to generate an image from a canvas that is not visible (either outside the window bounds or covered by another window) ?

I've tried with the GC.copyArea but this copies the screen pixels or remains blank if the chosen area is outside the display.

Many thanks !
Stuart


Re: GC.copyArea offscreen widgets [message #547431 is a reply to message #547383] Fri, 16 July 2010 18:12 Go to previous messageGo to next message
stuart pond is currently offline stuart pondFriend
Messages: 11
Registered: July 2009
Junior Member
I have played around with this and the answer appears to be platform
specific. I have gotten it to work (not reliably) for Windows 7 64 bit ,
but does not work on Windows XP.

So the short answer is I do not believe SWT supports a platform independent
way of doing this that is reliable in all situations.

-Stu Pond

"Stuart Caunt" <caunt@ill.fr> wrote in message
news:i1pq3t$b99$1@build.eclipse.org...
> Hi,
>
> Is it possible to generate an image from a canvas that is not visible
> (either outside the window bounds or covered by another window) ?
>
> I've tried with the GC.copyArea but this copies the screen pixels or
> remains blank if the chosen area is outside the display.
>
> Many thanks !
> Stuart
>
>
>
Re: GC.copyArea offscreen widgets [message #547482 is a reply to message #547383] Sat, 17 July 2010 14:20 Go to previous messageGo to next message
Alex Ignácio da Silva is currently offline Alex Ignácio da SilvaFriend
Messages: 23
Registered: July 2009
Junior Member
Hi Stuart,

Do you have control over the Canvas' code? If so a possible workaround
would be to refactor its painting method to accept a GC argument, and
then handle it a GC instantiated from an Image.

Regards,

Alex

On 07/16/2010 11:25 AM, Stuart Caunt wrote:
> Hi,
>
> Is it possible to generate an image from a canvas that is not visible
> (either outside the window bounds or covered by another window) ?
>
> I've tried with the GC.copyArea but this copies the screen pixels or
> remains blank if the chosen area is outside the display.
>
> Many thanks !
> Stuart
>
>
>
Re: GC.copyArea offscreen widgets [message #547551 is a reply to message #547383] Sun, 18 July 2010 18:30 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi Stuart,

You can use Control.print(GC) to get a snapshot of the control.
Please see the snippet here for an example:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet292.java?view=co

HTH,


Lakshmi P Shanmugam
Re: GC.copyArea offscreen widgets [message #547574 is a reply to message #547551] Sun, 18 July 2010 22:43 Go to previous messageGo to next message
Alex Ignácio da Silva is currently offline Alex Ignácio da SilvaFriend
Messages: 23
Registered: July 2009
Junior Member
Hi Lakshmi,

This method returns a boolean indicating if the operation was
successful. Under what circumstances could it fail? Will it always work
for a Canvas?

Thanks,

Alex

On 07/18/2010 03:30 PM, Lakshmi Shanmugam wrote:
> Hi Stuart,
>
> You can use Control.print(GC) to get a snapshot of the control.
> Please see the snippet here for an example:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet292.java?view=co
>
>
> HTH,
Re: GC.copyArea offscreen widgets [message #547685 is a reply to message #547551] Mon, 19 July 2010 11:10 Go to previous messageGo to next message
Stuart Caunt is currently offline Stuart CauntFriend
Messages: 3
Registered: July 2009
Junior Member
Hi Lakshmi,

Thanks for your reply! The Control.print(GC) method works perfectly! This really helps us a lot!

Thanks again and best regards,
Stuart



Re: GC.copyArea offscreen widgets [message #547714 is a reply to message #547574] Mon, 19 July 2010 12:59 Go to previous message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi Alex,

Only when Control.print() is not supported on the platform, it'll return false. It is supported on windows XP and later versions of windows, GTK, carbon and cocoa. On the other platforms it'll return false.

HTH,


Lakshmi P Shanmugam
Previous Topic:Problems with Images on StyledText on SnowLeopard
Next Topic:WebKit browser in Java app
Goto Forum:
  


Current Time: Thu Mar 28 10:59:25 GMT 2024

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

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

Back to the top