comparison src/myVncClient/CuiVncCanvas.java @ 93:71bfbb5241bf

modify CuiMyVncClient
author e085711
date Thu, 22 Sep 2011 05:43:48 +0900
parents fe94e353d595
children 1783ca4e4877
comparison
equal deleted inserted replaced
92:405ead268439 93:71bfbb5241bf
379 379
380 // Process the message depending on its type. 380 // Process the message depending on its type.
381 switch (msgType) { 381 switch (msgType) {
382 case MyRfbProto.SpeedCheckMillis: 382 case MyRfbProto.SpeedCheckMillis:
383 rfb.readSpeedCheck(); 383 rfb.readSpeedCheck();
384 384
385 break;
386 case MyRfbProto.WriteJpegData:
387 byte[] b = rfb.readJpegData();
388 drawBufferedImage(b);
385 break; 389 break;
386 case RfbProto.FramebufferUpdate: 390 case RfbProto.FramebufferUpdate:
387 391
388 if (statNumUpdates == viewer.debugStatsExcludeUpdates 392 if (statNumUpdates == viewer.debugStatsExcludeUpdates
389 && !statsRestarted) { 393 && !statsRestarted) {
1937 os.flush(); 1941 os.flush();
1938 os.close(); 1942 os.close();
1939 return bos.toByteArray(); 1943 return bos.toByteArray();
1940 } 1944 }
1941 1945
1946 void drawBufferedImage(byte[] b) throws IOException{
1947 BufferedImage bimg = ImageIO.read(new ByteArrayInputStream(b));
1948 // ImageIO.write(bimg, "jpeg", new File("sample.jpeg"));
1949 memGraphics.setClip(0,0, rfb.framebufferWidth, rfb.framebufferHeight );
1950 memGraphics.drawImage( bimg, 0,0, null);
1951 scheduleRepaint(0, 0, rfb.framebufferWidth, rfb.framebufferHeight );
1952 }
1953
1942 1954
1943 } 1955 }