java-gnome version 4.0.19

org.gnome.screenshot
Class Screenshot

Object
  extended by org.gnome.glib.Glib
      extended by org.gnome.screenshot.Screenshot

public final class Screenshot
extends Glib

Take screenshots. This class is explicitly here to support taking the screenshots used as illustrations in the java-gnome API documentation.

Usage is simple: given a Window, present() it, and then call the capture method here.

 final Window window;
 final Pixbuf result;
 
 window.present();
 result = Screenshot.capture();
 result.save(...);
 

Note that for some reason taking screenshots is a very slow and CPU intensive process. Unfortunately, it occurs within the GDK lock and thus will block your UI for a few seconds. Threading can't help you parallelize this.

LICENCE WARNING
This native code used to take screenshots is licenced under the GNU General Public Licence, version 2. As a result, use of this class in an application will mean that entire application will need to be available under a GPL v2 compatible licence.

Since:
4.0.5
Author:
Andrew Cowie

Method Summary
static Pixbuf capture()
          Take a screenshot of the Window which has focus.
 
Methods inherited from class org.gnome.glib.Glib
formatSizeForDisplay, getRealName, getSystemConfigDirs, getSystemDataDirs, getUserCacheDir, getUserConfigDir, getUserDataDir, getUserName, getUserSpecialDir, markupEscapeText, reloadUserSpecialDirsCache, setProgramName
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

capture

public static Pixbuf capture()
Take a screenshot of the Window which has focus. The window decorations drawn by the window manager will be captured (so if you don't want that, be sure to call setDecorated(false) on your Window). An alpha blended drop-shadow will be added for effect.



java-gnome