Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [Graphics] Two questions ...
[Graphics] Two questions ... [message #447850] Sun, 19 December 2004 08:56 Go to next message
Arnaud is currently offline ArnaudFriend
Messages: 60
Registered: July 2009
Member
Hi !

With Swing, I used this little piece of code to make a screen capture :

try
{
r = new Robot();
}
catch (AWTException awe)
{
System.out.println("robot exception occurred");
}

Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Image img = r.createScreenCapture(new Rectangle(0, 0, d.width, d.height));

Then, I could play with it using :

Graphics tig = img.getGraphics();

My two questions are :
1) how can I do the same thing using SWT ?
2) is it possible to capture a SWT Shell or any other component of the Shell
using java or have I got to use a "native" way ? (if "native" needed, any
hints on both Windows and Linux platforms ? I only know very few about C
and C++ and nothing about linux libraries).

TIA

--
Arnaud
Re: [Graphics] Two questions ... [message #447867 is a reply to message #447850] Mon, 20 December 2004 15:37 Go to previous messageGo to next message
Charlie Surface is currently offline Charlie SurfaceFriend
Messages: 40
Registered: July 2009
Member
You can create a GC on the Display, and then use GC.copyArea.

Charlie


Arnaud wrote:

> Hi !
>
> With Swing, I used this little piece of code to make a screen capture :
>
> try
> {
> r = new Robot();
> }
> catch (AWTException awe)
> {
> System.out.println("robot exception occurred");
> }
>
> Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
> Image img = r.createScreenCapture(new Rectangle(0, 0, d.width, d.height));
>
> Then, I could play with it using :
>
> Graphics tig = img.getGraphics();
>
> My two questions are :
> 1) how can I do the same thing using SWT ?
> 2) is it possible to capture a SWT Shell or any other component of the Shell
> using java or have I got to use a "native" way ? (if "native" needed, any
> hints on both Windows and Linux platforms ? I only know very few about C
> and C++ and nothing about linux libraries).
>
> TIA
>
Re: [Graphics] Two questions ... [message #447872 is a reply to message #447850] Mon, 20 December 2004 17:33 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
2) See
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet95.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup

"Arnaud" <mail@en.bas> wrote in message news:cq3f80$orn$1@www.eclipse.org...
> Hi !
>
> With Swing, I used this little piece of code to make a screen capture :
>
> try
> {
> r = new Robot();
> }
> catch (AWTException awe)
> {
> System.out.println("robot exception occurred");
> }
>
> Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
> Image img = r.createScreenCapture(new Rectangle(0, 0, d.width, d.height));
>
> Then, I could play with it using :
>
> Graphics tig = img.getGraphics();
>
> My two questions are :
> 1) how can I do the same thing using SWT ?
> 2) is it possible to capture a SWT Shell or any other component of the
Shell
> using java or have I got to use a "native" way ? (if "native" needed, any
> hints on both Windows and Linux platforms ? I only know very few about C
> and C++ and nothing about linux libraries).
>
> TIA
>
> --
> Arnaud
Previous Topic:How to save the table-content
Next Topic:Embed the swt browser in a view
Goto Forum:
  


Current Time: Sun Oct 25 17:57:53 GMT 2020

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

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

Back to the top