// Path: src/org/sleeksnap/util/Utils.java
// public static class DisplayUtil {
// 
// 	/**
// 	 * Get the real screen size, multiple screens..
// 	 * 
// 	 * @return The screen size
// 	 */
// 	public static Rectangle getRealScreenSize() {
// 		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
// 		GraphicsDevice[] screens = ge.getScreenDevices();
// 
// 		Rectangle allScreenBounds = new Rectangle();
// 		for (GraphicsDevice screen : screens) {
// 			Rectangle screenBounds = screen.getDefaultConfiguration().getBounds();
// 
// 			allScreenBounds.width += screenBounds.width;
// 			allScreenBounds.height = Math.max(allScreenBounds.height, screenBounds.height);
// 
// 			if (screenBounds.x < allScreenBounds.y || screenBounds.y < allScreenBounds.y) {
// 				allScreenBounds.x = Math.min(allScreenBounds.x, screenBounds.x);
// 				allScreenBounds.y = Math.min(allScreenBounds.y, screenBounds.y);
// 			}
// 		}
// 		return allScreenBounds;
// 	}
// 
// 	/**
// 	 * Get the real screen size, multiple screens..
// 	 * 
// 	 * @return The screen size
// 	 */
// 	public static Rectangle[] getAllScreenBounds() {
// 		GraphicsEnvironment ge = GraphicsEnvironment
// 				.getLocalGraphicsEnvironment();
// 		GraphicsDevice[] screens = ge.getScreenDevices();
// 
// 		Rectangle[] allScreenBounds = new Rectangle[screens.length];
// 		for (int i = 0; i < screens.length; i++) {
// 			allScreenBounds[i] = screens[i].getDefaultConfiguration().getBounds();
// 		}
// 		return allScreenBounds;
// 	}
// }


import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import org.sleeksnap.util.Utils.DisplayUtil;
/**
 * Sleeksnap, the open source cross-platform screenshot uploader
 * Copyright (C) 2012 Nikki <nikki@nikkii.us>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.sleeksnap.util;



/**
 * A basic screenshot utility
 * 
 * @author Nikki
 * 
 */
public class ScreenshotUtil {

	/**
	 * The robot instance
	 */
	private static Robot robot;

	/**
	 * Initialize it..
	 */
	static {
		try {
			robot = new Robot();
		} catch (AWTException e) {
			// We can't run without this!
			throw new RuntimeException(
					"Robot not initialized, shutting down...");
		}
	}

	/**
	 * Capture a simple screenshot
	 * 
	 * @return The screenshot
	 */
	public static BufferedImage capture() {
// Path: src/org/sleeksnap/util/Utils.java
// public static class DisplayUtil {
// 
// 	/**
// 	 * Get the real screen size, multiple screens..
// 	 * 
// 	 * @return The screen size
// 	 */
// 	public static Rectangle getRealScreenSize() {
// 		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
// 		GraphicsDevice[] screens = ge.getScreenDevices();
// 
// 		Rectangle allScreenBounds = new Rectangle();
// 		for (GraphicsDevice screen : screens) {
// 			Rectangle screenBounds = screen.getDefaultConfiguration().getBounds();
// 
// 			allScreenBounds.width += screenBounds.width;
// 			allScreenBounds.height = Math.max(allScreenBounds.height, screenBounds.height);
// 
// 			if (screenBounds.x < allScreenBounds.y || screenBounds.y < allScreenBounds.y) {
// 				allScreenBounds.x = Math.min(allScreenBounds.x, screenBounds.x);
// 				allScreenBounds.y = Math.min(allScreenBounds.y, screenBounds.y);
// 			}
// 		}
// 		return allScreenBounds;
// 	}
// 
// 	/**
// 	 * Get the real screen size, multiple screens..
// 	 * 
// 	 * @return The screen size
// 	 */
// 	public static Rectangle[] getAllScreenBounds() {
// 		GraphicsEnvironment ge = GraphicsEnvironment
// 				.getLocalGraphicsEnvironment();
// 		GraphicsDevice[] screens = ge.getScreenDevices();
// 
// 		Rectangle[] allScreenBounds = new Rectangle[screens.length];
// 		for (int i = 0; i < screens.length; i++) {
// 			allScreenBounds[i] = screens[i].getDefaultConfiguration().getBounds();
// 		}
// 		return allScreenBounds;
// 	}
// }


// Path: src/org/sleeksnap/util/ScreenshotUtil.java
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import org.sleeksnap.util.Utils.DisplayUtil;

/**
 * Sleeksnap, the open source cross-platform screenshot uploader
 * Copyright (C) 2012 Nikki <nikki@nikkii.us>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.sleeksnap.util;



/**
 * A basic screenshot utility
 * 
 * @author Nikki
 * 
 */
public class ScreenshotUtil {

	/**
	 * The robot instance
	 */
	private static Robot robot;

	/**
	 * Initialize it..
	 */
	static {
		try {
			robot = new Robot();
		} catch (AWTException e) {
			// We can't run without this!
			throw new RuntimeException(
					"Robot not initialized, shutting down...");
		}
	}

	/**
	 * Capture a simple screenshot
	 * 
	 * @return The screenshot
	 */
	public static BufferedImage capture() {
		return capture(DisplayUtil.getRealScreenSize());