Mercurial > hg > Applications > tvnjviewer
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/AliceVNCMessage.java @ 19:6886a2e890cc
separate pixelByteArray from AliceVNCMessage
author | sugi |
---|---|
date | Tue, 04 Nov 2014 11:37:09 +0900 |
parents | f9e319a08111 |
children | 419ac2f759d5 |
rev | line source |
---|---|
8
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
1 package com.glavsoft.rfb.encoding.decoder; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
2 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
3 import org.msgpack.annotation.Message; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
4 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
5 import com.glavsoft.rfb.encoding.EncodingType; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
6 import com.glavsoft.rfb.encoding.PixelFormat; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
7 import com.glavsoft.rfb.encoding.ServerInitMessage; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
8 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
9 @Message |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
10 public class AliceVNCMessage { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
11 public int x; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
12 public int y; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
13 public int width; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
14 public int height; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
15 public int encodingTypeId; |
19 | 16 //public byte[] buf; |
8
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
17 public int offset; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
18 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
19 public String name; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
20 |
11 | 21 // use RichCursorDecoder |
22 public byte[] bitmask; | |
23 | |
8
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
24 // pixel format info |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
25 public byte bitsPerPixel; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
26 public byte depth; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
27 public byte bigEndianFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
28 public byte trueColourFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
29 public short redMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
30 public short greenMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
31 public short blueMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
32 public byte redShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
33 public byte greenShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
34 public byte blueShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
35 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
36 public AliceVNCMessage(){ |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
37 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
38 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
39 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
40 public void setRectangle(FramebufferUpdateRectangle rect){ |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
41 x = rect.x; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
42 y = rect.y; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
43 width = rect.width; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
44 height = rect.height; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
45 encodingTypeId = rect.getEncodingType().getId(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
46 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
47 |
11 | 48 public FramebufferUpdateRectangle getFramebufferUpdateRectangle(){ |
49 FramebufferUpdateRectangle rect = | |
50 new FramebufferUpdateRectangle(x, y, width, height); | |
51 rect.encodingType = EncodingType.byId(encodingTypeId); | |
52 | |
53 return rect; | |
54 } | |
55 | |
8
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
56 public EncodingType getEncodingType() { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
57 return EncodingType.byId(encodingTypeId); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
58 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
59 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
60 public void setPixelFormat(PixelFormat pixelFormat) { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
61 bitsPerPixel = pixelFormat.bitsPerPixel; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
62 depth = pixelFormat.depth; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
63 bigEndianFlag = pixelFormat.bigEndianFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
64 trueColourFlag = pixelFormat.trueColourFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
65 redMax = pixelFormat.redMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
66 greenMax = pixelFormat.greenMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
67 blueMax = pixelFormat.blueMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
68 redShift = pixelFormat.redShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
69 greenShift = pixelFormat.greenShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
70 blueShift = pixelFormat.blueShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
71 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
72 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
73 public PixelFormat getPixelFormat(){ |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
74 PixelFormat pixelFormat = new PixelFormat(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
75 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
76 pixelFormat.bitsPerPixel = bitsPerPixel; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
77 pixelFormat.depth = depth; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
78 pixelFormat.bigEndianFlag = bigEndianFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
79 pixelFormat.trueColourFlag = trueColourFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
80 pixelFormat.redMax = redMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
81 pixelFormat.greenMax = greenMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
82 pixelFormat.blueMax = blueMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
83 pixelFormat.redShift = redShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
84 pixelFormat.greenShift = greenShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
85 pixelFormat.blueShift = blueShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
86 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
87 return pixelFormat; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
88 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
89 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
90 public void setServerInitMessage(ServerInitMessage serverInitMessage) { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
91 setPixelFormat(serverInitMessage.getPixelFormat()); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
92 width = serverInitMessage.getFrameBufferWidth(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
93 height = serverInitMessage.getFrameBufferHeight(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
94 name = serverInitMessage.getName(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
95 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
96 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
97 } |