Mercurial > hg > Applications > tvnjviewer
changeset 8:136ee08cb788
use AliceVNCMessage for sending information with MessagePack
author | YU |
---|---|
date | Thu, 18 Sep 2014 21:11:51 +0900 |
parents | 9abf7f305bac |
children | 3c0f262384dc |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/AliceVNCMessage.java |
diffstat | 1 files changed, 86 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/AliceVNCMessage.java Thu Sep 18 21:11:51 2014 +0900 @@ -0,0 +1,86 @@ +package com.glavsoft.rfb.encoding.decoder; + +import org.msgpack.annotation.Message; + +import com.glavsoft.rfb.encoding.EncodingType; +import com.glavsoft.rfb.encoding.PixelFormat; +import com.glavsoft.rfb.encoding.ServerInitMessage; + +@Message +public class AliceVNCMessage { + public int x; + public int y; + public int width; + public int height; + public int encodingTypeId; + public byte[] unzip; + public int offset; + + public String name; + + // pixel format info + public byte bitsPerPixel; + public byte depth; + public byte bigEndianFlag; + public byte trueColourFlag; + public short redMax; + public short greenMax; + public short blueMax; + public byte redShift; + public byte greenShift; + public byte blueShift; + + public AliceVNCMessage(){ + + } + + public void setRectangle(FramebufferUpdateRectangle rect){ + x = rect.x; + y = rect.y; + width = rect.width; + height = rect.height; + encodingTypeId = rect.getEncodingType().getId(); + } + + public EncodingType getEncodingType() { + return EncodingType.byId(encodingTypeId); + } + + public void setPixelFormat(PixelFormat pixelFormat) { + bitsPerPixel = pixelFormat.bitsPerPixel; + depth = pixelFormat.depth; + bigEndianFlag = pixelFormat.bigEndianFlag; + trueColourFlag = pixelFormat.trueColourFlag; + redMax = pixelFormat.redMax; + greenMax = pixelFormat.greenMax; + blueMax = pixelFormat.blueMax; + redShift = pixelFormat.redShift; + greenShift = pixelFormat.greenShift; + blueShift = pixelFormat.blueShift; + } + + public PixelFormat getPixelFormat(){ + PixelFormat pixelFormat = new PixelFormat(); + + pixelFormat.bitsPerPixel = bitsPerPixel; + pixelFormat.depth = depth; + pixelFormat.bigEndianFlag = bigEndianFlag; + pixelFormat.trueColourFlag = trueColourFlag; + pixelFormat.redMax = redMax; + pixelFormat.greenMax = greenMax; + pixelFormat.blueMax = blueMax; + pixelFormat.redShift = redShift; + pixelFormat.greenShift = greenShift; + pixelFormat.blueShift = blueShift; + + return pixelFormat; + } + + public void setServerInitMessage(ServerInitMessage serverInitMessage) { + setPixelFormat(serverInitMessage.getPixelFormat()); + width = serverInitMessage.getFrameBufferWidth(); + height = serverInitMessage.getFrameBufferHeight(); + name = serverInitMessage.getName(); + + } +}