Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Capture Screen Shot of WorkSpace
Capture Screen Shot of WorkSpace [message #787488] Tue, 31 January 2012 16:32 Go to next message
Raj is currently offline RajFriend
Messages: 67
Registered: July 2009
Member
Hi

I need to capture the complete worksapce in image file.

I looked into
http://wiki.eclipse.org/RAP/FAQ#How_to_display_dynamically_created_images.3F
which can help me creating the image.

I can get all the viewers/editors information from
PlatformUI.getWorkbench().getActiveWorkbenchWindow()

But how to put it on the image????

Thanks
Raj
Re: Capture Screen Shot of WorkSpace [message #787605 is a reply to message #787488] Tue, 31 January 2012 19:29 Go to previous messageGo to next message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
Hi Raj,

In RAP there is not a way to paint on an SWT Image because the Image class does not implement Drawable in RAP. You will have to use AWT image handling.

--Austin
Re: Capture Screen Shot of WorkSpace [message #787644 is a reply to message #787605] Tue, 31 January 2012 20:43 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

It sounds like what you are interested in is taking a screenshot of the RAP application itself. If that is the case, it simply is not possible in a web browser. Here is a good discussion over at StackOverflow[1]. Since RAP runs as HTML and Javascript in the browser, the discussion applies to RAP as well.

[1] http://stackoverflow.com/questions/1794719/capture-screenshot-of-website-on-the-client-javascript-or-flash

Cole
Re: Capture Screen Shot of WorkSpace [message #787648 is a reply to message #787605] Tue, 31 January 2012 20:44 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

It sounds like what you are interested in is taking a screenshot of the RAP application itself. If that is the case, it simply is not possible in a web browser. Here is a good discussion over at StackOverflow[1]. Since RAP runs as HTML and Javascript in the browser, the discussion applies to RAP as well.

[1] http://stackoverflow.com/questions/1794719/capture-screenshot-of-website-on-the-client-javascript-or-flash

Cole
Re: Capture Screen Shot of WorkSpace [message #787685 is a reply to message #787648] Tue, 31 January 2012 21:41 Go to previous messageGo to next message
Raj  is currently offline Raj Friend
Messages: 74
Registered: August 2011
Member
Hi Cole

I do not want to do in the browser.

I want to do sometihg like

// Take the snapshot into a display Image. This works very well in SWT.
Point size = myWidget.getSize();
Image image = new Image(display, size.x, size.y);
GC gc = new GC(myWidget);
gc.copyArea(image, 0, 0);
gc.dispose();

but in RAP, we do not have copyArea function.So what is the work around. I know i need to create the image like

private BufferedImage createImage() {
BufferedImage image = new BufferedImage( 200, 200, BufferedImage.TYPE_INT_ARGB );
Graphics2D gr2d = image.createGraphics();
// draw the image
gr2d.setColor( new Color( 0, 0, 255 ) );
gr2d.drawRect( 0, 0, widht - 1, height - 1 );
...
return image;
}

but how to draw the widgets on the image using gr2d???

I will appreciate for some pointers.

Thanks
Raj




Re: Capture Screen Shot of WorkSpace [message #787688 is a reply to message #787648] Tue, 31 January 2012 21:41 Go to previous messageGo to next message
Raj is currently offline RajFriend
Messages: 67
Registered: July 2009
Member
Hi Cole

I do not want to do in the browser.

I want to do sometihg like

// Take the snapshot into a display Image. This works very well in SWT.
Point size = myWidget.getSize();
Image image = new Image(display, size.x, size.y);
GC gc = new GC(myWidget);
gc.copyArea(image, 0, 0);
gc.dispose();

but in RAP, we do not have copyArea function.So what is the work around. I know i need to create the image like

private BufferedImage createImage() {
BufferedImage image = new BufferedImage( 200, 200, BufferedImage.TYPE_INT_ARGB );
Graphics2D gr2d = image.createGraphics();
// draw the image
gr2d.setColor( new Color( 0, 0, 255 ) );
gr2d.drawRect( 0, 0, widht - 1, height - 1 );
...
return image;
}

but how to draw the widgets on the image using gr2d???

I will appreciate for some pointers.

Thanks
Raj
Re: Capture Screen Shot of WorkSpace [message #787702 is a reply to message #787688] Tue, 31 January 2012 22:09 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

Raj,

In RAP, the widgets are drawn by the browser. The server knows where they are but has no way to render them on the server side. Unfortunately it is simply not possible to do what you are asking.

Cole
Re: Capture Screen Shot of WorkSpace [message #789240 is a reply to message #787702] Thu, 02 February 2012 19:22 Go to previous messageGo to next message
Raj  is currently offline Raj Friend
Messages: 74
Registered: August 2011
Member
Hi Cole

I am thinking

1. we can pass the complete html from client to server
2. in the server using the swing(javax.swing.JEditorPane) we can create the image

javax.swing.JEditorPane().setText(<text form client>) ;
                
BufferedImage img = new BufferedImage(prefSize.width, editorPane.getPreferredSize().height, BufferedImage.TYPE_INT_ARGB);
		
Graphics graphics = img.getGraphics();
editorPane.paint(graphics);
return img;


Now how to get the complete html(view and other stuff on browser) text being displayed on client and send it to server.

Re: Capture Screen Shot of WorkSpace [message #789244 is a reply to message #787702] Thu, 02 February 2012 19:22 Go to previous messageGo to next message
Raj is currently offline RajFriend
Messages: 67
Registered: July 2009
Member
Hi Cole

I am thinking

1. we can pass the complete html from client to server
2. in the server using the swing(javax.swing.JEditorPane) we can create the image


javax.swing.JEditorPane().setText(<text form client>) ;

BufferedImage img = new BufferedImage(prefSize.width, editorPane.getPreferredSize().height, BufferedImage.TYPE_INT_ARGB);

Graphics graphics = img.getGraphics();
editorPane.paint(graphics);
return img;


Now how to get the complete html(view and other stuff on browser) text being displayed on client and send it to server.
Re: Capture Screen Shot of WorkSpace [message #793803 is a reply to message #789244] Wed, 08 February 2012 15:37 Go to previous messageGo to next message
Raj  is currently offline Raj Friend
Messages: 74
Registered: August 2011
Member
Hi

I am able to capture the screen shot. I send the complete html to server and then send in email.

As always thanks for pointers.

RAP Rocks...

Thanks
Raj
Re: Capture Screen Shot of WorkSpace [message #793806 is a reply to message #789240] Wed, 08 February 2012 15:37 Go to previous messageGo to next message
Raj is currently offline RajFriend
Messages: 67
Registered: July 2009
Member
Hi

I am able to capture the screen shot. I send the complete html to server and then send in email.

As always thanks for pointers.

RAP Rocks...

Thanks
Raj
Re: Capture Screen Shot of WorkSpace [message #794097 is a reply to message #793806] Wed, 08 February 2012 22:57 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

I would be interested to hear how you got this working.
Re: Capture Screen Shot of WorkSpace [message #794101 is a reply to message #793806] Wed, 08 February 2012 22:57 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

I would be interested to hear how you got this working.
Re: Capture Screen Shot of WorkSpace [message #794744 is a reply to message #794101] Thu, 09 February 2012 16:54 Go to previous message
Raj  is currently offline Raj Friend
Messages: 74
Registered: August 2011
Member
Hi Cole

Steps:

1.Get the client HTML using ( http://qooxdoo.org/documentation/0.8/snippets )
2.Create the javascript method which takes above input and call (JSExecutor.executeJS(<method_name>))
3.Add phaselistener to capture the response at server.

HTH

Thanks
Raj
Previous Topic:Capture Screen Shot of WorkSpace
Next Topic:HTTP Status 404 - ProxyServlet: /tmf_rap/mcrap
Goto Forum:
  


Current Time: Sun Oct 17 22:38:29 GMT 2021

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

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

Back to the top