- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
public static void createShotAndSend() {
Toolkit tool = Toolkit.getDefaultToolkit();
Dimension screen = tool.getScreenSize();
int w = screen.width;
int h = screen.height;
int x = MouseInfo.getPointerInfo().getLocation().x-W/2;
int y = MouseInfo.getPointerInfo().getLocation().y-H/2;
if(x == ox && y == oy) {
return;
}
ox = x;
oy = y;
int sx = Math.min(Math.max(x, 0), w-W);
int sy = Math.min(Math.max(y, 0), h-H);
BufferedImage capture;
try {
capture = (new Robot()).createScreenCapture(new Rectangle(sx, sy, W, H));
} catch (AWTException ex) {
System.err.println("Failed screen capturing!");
return;
}
ByteArrayOutputStream data = new ByteArrayOutputStream();
try {
ImageIO.write(capture, "JPG", data);
} catch (IOException ex) {
System.err.println("Failed writing capture!");
return;
}
byte[] toSend = data.toByteArray();
int l = data.size();
byte[] size = itob(l);
//pool - Client[]
for(int i = 0; i < pool.length; i++) {
if(pool[i] == null) continue;
if(!pool[i].isActive()) continue;
pool[i].send(size, 0, 4);
pool[i].send(toSend, 0, l);
}
}
делаем скриншот. квадратом в 100 пикселей (курсор в центре).
absolut 19.12.2010 14:50 # +2
komprenda 19.12.2010 15:17 # −11
guest 19.12.2010 16:34 # +2
bugmenot 19.12.2010 16:38 # +1
brainstorm 19.12.2010 18:29 # +1
кстате какова оно пола?
Xander_Bass 20.12.2010 01:52 # +1
istem 19.12.2010 17:24 # +2
komprenda 19.12.2010 15:17 # −9
Lure Of Chaos 19.12.2010 15:38 # +2
komprenda 19.12.2010 15:39 # −10
Анонимус 21.12.2010 00:48 # +2