include client resizing
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
79ea82da4f
commit
1d37ec04a8
BIN
bin/SigShare.jar
BIN
bin/SigShare.jar
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 119 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 48 KiB |
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user