diff --git a/bin/SigShare.jar b/bin/SigShare.jar index b1a4df9..aaca633 100644 Binary files a/bin/SigShare.jar and b/bin/SigShare.jar differ diff --git a/bin/screenshot.jpg b/bin/screenshot.jpg index 4e6072f..26a3eaf 100644 Binary files a/bin/screenshot.jpg and b/bin/screenshot.jpg differ diff --git a/bin/screenshot_out.jpg b/bin/screenshot_out.jpg index cda3475..4240b46 100644 Binary files a/bin/screenshot_out.jpg and b/bin/screenshot_out.jpg differ diff --git a/src/sig/SigShare.java b/src/sig/SigShare.java index a8e02e2..e0d6db6 100644 --- a/src/sig/SigShare.java +++ b/src/sig/SigShare.java @@ -37,6 +37,9 @@ import java.awt.Graphics2D; public class SigShare { static Robot r; public static final String PROGRAM_NAME="SigShare"; + public static double SCREEN_MULT=2; + public static int SCREEN_WIDTH=(int)(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth()/SCREEN_MULT); + public static int SCREEN_HEIGHT=(int)(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight()/SCREEN_MULT); public static void main(String[] args) throws AWTException { r = new Robot(); if (args.length==2&&args[1].equalsIgnoreCase("server")) { @@ -50,9 +53,6 @@ public class SigShare { System.out.println("Sending initial data..."); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream(),"ISO-8859-1")); DataOutputStream clientOutput = new DataOutputStream(client.getOutputStream()); - double SCREEN_MULT=2; - int SCREEN_WIDTH=(int)(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth()/SCREEN_MULT); - int SCREEN_HEIGHT=(int)(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight()/SCREEN_MULT); clientOutput.write(("DESKTOP "+SCREEN_WIDTH+" "+SCREEN_HEIGHT+"\r\n").getBytes()); System.out.println("Send initial screen"); //char[] screen = new char[SCREEN_WIDTH*SCREEN_HEIGHT]; @@ -113,8 +113,8 @@ public class SigShare { if (line.contains("DESKTOP")) { String[] split = line.split(Pattern.quote(" ")); - int SCREEN_WIDTH=Integer.parseInt(split[1]); - int SCREEN_HEIGHT=Integer.parseInt(split[2]); + SCREEN_WIDTH=Integer.parseInt(split[1]); + SCREEN_HEIGHT=Integer.parseInt(split[2]); p.init(SCREEN_WIDTH,SCREEN_HEIGHT); f.add(p); @@ -176,7 +176,7 @@ public class SigShare { ImageWriter writer = iter.next(); ImageWriteParam iwp = writer.getDefaultWriteParam(); iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); - iwp.setCompressionQuality(0.3f); + iwp.setCompressionQuality(0.8f); writer.setOutput(ios); writer.write(null, new IIOImage(resizeImage(r.createScreenCapture(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()),w,h),null,null),iwp); writer.dispose(); diff --git a/src/sig/engine/Panel.java b/src/sig/engine/Panel.java index b2978e3..c707b44 100644 --- a/src/sig/engine/Panel.java +++ b/src/sig/engine/Panel.java @@ -56,7 +56,7 @@ public class Panel extends JPanel implements Runnable { @Override public void componentResized(ComponentEvent e) { System.out.println("Resized"); - + setSize(getWidth(), getHeight()); } @Override @@ -107,7 +107,7 @@ public class Panel extends JPanel implements Runnable { // ask ImageProducer to update image mImageProducer.newPixels(); // draw it on panel - g.drawImage(this.imageBuffer, 0, 0, this); + g.drawImage(this.imageBuffer.getScaledInstance(getWidth(), getHeight(), Image.SCALE_FAST), 0, 0, this); if (window!=null&&System.currentTimeMillis()-lastSecond>=1000) {