// Path: src/main/java/net/sourceforge/krut/Settings.java
// public class Settings {
// 
//     static {
//     }
// 
//     private static Preferences prefs = Preferences.userNodeForPackage(Run_KRUT.class);
//     public static final String PREF_CAPRECT_X = "PREF_CAPRECT_X";
//     public static final String PREF_CAPRECT_Y = "PREF_CAPRECT_Y";
//     public static final String PREF_CAPRECT_WIDHT = "PREF_CAPRECT_WIDHT";
//     public static final String PREF_CAPRECT_HEIGHT = "PREF_CAPRECT_HEIGHT";
// 
//     /**
//      * The starting value of the capture size.
//      * This is used in the createScreenGrabber() method.
//      * It is also passed on to the KrutSettings constructur
//      * from the init() method.
//      */
//     public static Rectangle getCaptureRect() {
//         return new Rectangle(
//                 prefs.getInt(PREF_CAPRECT_X, 0),
//                 prefs.getInt(PREF_CAPRECT_Y, 0),
//                 prefs.getInt(PREF_CAPRECT_WIDHT, 360),
//                 prefs.getInt(PREF_CAPRECT_HEIGHT, 240)
//         );
//     }
// 
//     public static void setCaptureRect(Rectangle captureRect) {
//         prefs.putInt(PREF_CAPRECT_X, (int) captureRect.getX());
//         prefs.putInt(PREF_CAPRECT_Y, (int) captureRect.getY());
//         prefs.putInt(PREF_CAPRECT_WIDHT, (int) captureRect.getWidth());
//         prefs.putInt(PREF_CAPRECT_HEIGHT, (int) captureRect.getHeight());
//     }
// }
// 
// Path: src/main/java/net/sourceforge/krut/jpeg/JPEGCodec.java
// public class JPEGCodec {
// 
// 	public static JPEGImageEncoder createJPEGEncoder(OutputStream jpgBytes) {
// 		return new JPEGImageEncoder(jpgBytes);
// 	}
// }
// 
// Path: src/main/java/net/sourceforge/krut/jpeg/JPEGEncodeParam.java
// public class JPEGEncodeParam {
// 
// 	private float encQuality;
// 	private boolean b;
// 
// 	public void setQuality(float encQuality, boolean b) {
// 		this.encQuality = encQuality;
// 		this.b = b;
// 	}
// 
// 	public float getEncQuality() {
// 		return this.encQuality;
// 	}
// 
// 	public boolean getB() {
// 		return this.b;
// 	}
// }
// 
// Path: src/main/java/net/sourceforge/krut/jpeg/JPEGImageEncoder.java
// public class JPEGImageEncoder {
// 
// 	private final OutputStream out;
// 	private JPEGEncodeParam JPEGEncodeParam;
// 
// 	public JPEGImageEncoder(OutputStream out) {
// 		this.out = out;
// 	}
// 
// 	public JPEGEncodeParam getDefaultJPEGEncodeParam(BufferedImage image) {
// 		return new JPEGEncodeParam();
// 	}
// 
// 	public void setJPEGEncodeParam(JPEGEncodeParam JPEGEncodeParam) {
// 		this.JPEGEncodeParam = JPEGEncodeParam;
// 	}
// 
// 	public void encode(BufferedImage image) {
// 		try {
// 			ImageIO.write(image, "jpeg", this.out);
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public net.sourceforge.krut.jpeg.JPEGEncodeParam getJPEGEncodeParam() {
// 		return JPEGEncodeParam;
// 	}
// }


import java.awt.AWTException;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import net.sourceforge.krut.Settings;
import net.sourceforge.krut.jpeg.JPEGCodec;
import net.sourceforge.krut.jpeg.JPEGEncodeParam;
import net.sourceforge.krut.jpeg.JPEGImageEncoder;
         *  to later on in the program.
         */
        jpgBytes = new DataOutputStream(fileBuffer);
        /** Figure out how many integers we can hold in the
         *  remaining memory. An integer takes 4B, and we will
         *  have 2 arrays of integers. We don't want to fill the
         *  entire memory, and we have used a third, or possibly
         *  even half, already. So we will allocate 2 arrays of
         *  integers, each using a sixth of the available memory.
         *  That means we can at the most have
         *  convert.intValue() / 24
         *  integers in each array. That also means we can at
         *  the most have that amount of frames in a film.
         *
         *  As a comparison, an integer array of 1 MB can hold
         *  262144 integers, which would be enough for
         *  2h25m38s of film at 30 FPS.
         */
        maxNOPics = (int) (convert.intValue() / 24);
        System.out.println("Memory after filebuffer: " +
                (myRuntime.maxMemory() - myRuntime.totalMemory() + 
                myRuntime.freeMemory()));
        /** Init the encoder to store encoded images directly to memory.
         *  This will be changed later, but is an easy way of getting a
         *  first frame for the film, since that frame is to be kept in
         *  memory anyway  (see below).
         *
         *  First we take an "average (=random)" image for the method
         *  encoder.getDefaultJPEGEncodeParam(image) below.
         */
// Path: src/main/java/net/sourceforge/krut/Settings.java
// public class Settings {
// 
//     static {
//     }
// 
//     private static Preferences prefs = Preferences.userNodeForPackage(Run_KRUT.class);
//     public static final String PREF_CAPRECT_X = "PREF_CAPRECT_X";
//     public static final String PREF_CAPRECT_Y = "PREF_CAPRECT_Y";
//     public static final String PREF_CAPRECT_WIDHT = "PREF_CAPRECT_WIDHT";
//     public static final String PREF_CAPRECT_HEIGHT = "PREF_CAPRECT_HEIGHT";
// 
//     /**
//      * The starting value of the capture size.
//      * This is used in the createScreenGrabber() method.
//      * It is also passed on to the KrutSettings constructur
//      * from the init() method.
//      */
//     public static Rectangle getCaptureRect() {
//         return new Rectangle(
//                 prefs.getInt(PREF_CAPRECT_X, 0),
//                 prefs.getInt(PREF_CAPRECT_Y, 0),
//                 prefs.getInt(PREF_CAPRECT_WIDHT, 360),
//                 prefs.getInt(PREF_CAPRECT_HEIGHT, 240)
//         );
//     }
// 
//     public static void setCaptureRect(Rectangle captureRect) {
//         prefs.putInt(PREF_CAPRECT_X, (int) captureRect.getX());
//         prefs.putInt(PREF_CAPRECT_Y, (int) captureRect.getY());
//         prefs.putInt(PREF_CAPRECT_WIDHT, (int) captureRect.getWidth());
//         prefs.putInt(PREF_CAPRECT_HEIGHT, (int) captureRect.getHeight());
//     }
// }
// 
// Path: src/main/java/net/sourceforge/krut/jpeg/JPEGCodec.java
// public class JPEGCodec {
// 
// 	public static JPEGImageEncoder createJPEGEncoder(OutputStream jpgBytes) {
// 		return new JPEGImageEncoder(jpgBytes);
// 	}
// }
// 
// Path: src/main/java/net/sourceforge/krut/jpeg/JPEGEncodeParam.java
// public class JPEGEncodeParam {
// 
// 	private float encQuality;
// 	private boolean b;
// 
// 	public void setQuality(float encQuality, boolean b) {
// 		this.encQuality = encQuality;
// 		this.b = b;
// 	}
// 
// 	public float getEncQuality() {
// 		return this.encQuality;
// 	}
// 
// 	public boolean getB() {
// 		return this.b;
// 	}
// }
// 
// Path: src/main/java/net/sourceforge/krut/jpeg/JPEGImageEncoder.java
// public class JPEGImageEncoder {
// 
// 	private final OutputStream out;
// 	private JPEGEncodeParam JPEGEncodeParam;
// 
// 	public JPEGImageEncoder(OutputStream out) {
// 		this.out = out;
// 	}
// 
// 	public JPEGEncodeParam getDefaultJPEGEncodeParam(BufferedImage image) {
// 		return new JPEGEncodeParam();
// 	}
// 
// 	public void setJPEGEncodeParam(JPEGEncodeParam JPEGEncodeParam) {
// 		this.JPEGEncodeParam = JPEGEncodeParam;
// 	}
// 
// 	public void encode(BufferedImage image) {
// 		try {
// 			ImageIO.write(image, "jpeg", this.out);
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public net.sourceforge.krut.jpeg.JPEGEncodeParam getJPEGEncodeParam() {
// 		return JPEGEncodeParam;
// 	}
// }


// Path: src/main/java/net/sourceforge/krut/recording/ScreenGrabber.java
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import net.sourceforge.krut.Settings;
import net.sourceforge.krut.jpeg.JPEGCodec;
import net.sourceforge.krut.jpeg.JPEGEncodeParam;
import net.sourceforge.krut.jpeg.JPEGImageEncoder;

         *  to later on in the program.
         */
        jpgBytes = new DataOutputStream(fileBuffer);
        /** Figure out how many integers we can hold in the
         *  remaining memory. An integer takes 4B, and we will
         *  have 2 arrays of integers. We don't want to fill the
         *  entire memory, and we have used a third, or possibly
         *  even half, already. So we will allocate 2 arrays of
         *  integers, each using a sixth of the available memory.
         *  That means we can at the most have
         *  convert.intValue() / 24
         *  integers in each array. That also means we can at
         *  the most have that amount of frames in a film.
         *
         *  As a comparison, an integer array of 1 MB can hold
         *  262144 integers, which would be enough for
         *  2h25m38s of film at 30 FPS.
         */
        maxNOPics = (int) (convert.intValue() / 24);
        System.out.println("Memory after filebuffer: " +
                (myRuntime.maxMemory() - myRuntime.totalMemory() + 
                myRuntime.freeMemory()));
        /** Init the encoder to store encoded images directly to memory.
         *  This will be changed later, but is an easy way of getting a
         *  first frame for the film, since that frame is to be kept in
         *  memory anyway  (see below).
         *
         *  First we take an "average (=random)" image for the method
         *  encoder.getDefaultJPEGEncodeParam(image) below.
         */
        image = robot.createScreenCapture(Settings.getCaptureRect());