comparison src/main/java/com/glavsoft/rfb/encoding/decoder/FramebufferUpdateRectangle.java @ 0:4689cc86d6cb

create TreeViewer2 Repository
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 03 Jul 2012 13:20:49 +0900
parents
children 225e3873d75f 472a9bcacb21
comparison
equal deleted inserted replaced
-1:000000000000 0:4689cc86d6cb
1 // Copyright (C) 2010, 2011 GlavSoft LLC.
2 // All rights reserved.
3 //
4 //-------------------------------------------------------------------------
5 // This file is part of the TightVNC software. Please visit our Web site:
6 //
7 // http://www.tightvnc.com/
8 //
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License along
20 // with this program; if not, write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 //-------------------------------------------------------------------------
23 //
24
25 package com.glavsoft.rfb.encoding.decoder;
26
27 import com.glavsoft.exceptions.TransportException;
28 import com.glavsoft.rfb.encoding.EncodingType;
29 import com.glavsoft.transport.Reader;
30
31 /**
32 * Header for framebuffer-update-rectangle header server message
33 * 2 - U16 - x-position
34 * 2 - U16 - y-position
35 * 2 - U16 - width
36 * 2 - U16 - height
37 * 4 - S32 - encoding-type
38 * and then follows the pixel data in the specified encoding
39 */
40 public class FramebufferUpdateRectangle {
41 public int x;
42 public int y;
43 public int width;
44 public int height;
45 private EncodingType encodingType;
46
47 public FramebufferUpdateRectangle() {
48 // nop
49 }
50
51 public FramebufferUpdateRectangle(int x, int y, int w, int h) {
52 this.x = x; this.y = y;
53 width = w; height = h;
54 }
55
56 public void fill(Reader reader) throws TransportException {
57 x = reader.readUInt16();
58 y = reader.readUInt16();
59 width = reader.readUInt16();
60 height = reader.readUInt16();
61 int encoding = reader.readInt32();
62 encodingType = EncodingType.byId(encoding);
63 }
64
65 public EncodingType getEncodingType() {
66 return encodingType;
67 }
68
69 @Override
70 public String toString() {
71 return "FramebufferUpdateRect: [x: " + x + ", y: " + y +
72 ", width: " + width + ", height: " + height +
73 ", encodingType: " + encodingType +
74 "]";
75 }
76
77 }