Mercurial > hg > Applications > AliceVNC
diff src/main/java/jp/ac/u_ryukyu/alicevnc/MyServerInitMessage.java @ 3:9d932f70b29a
create MyServerInitMessage. ServerInitMessage could not send with MessagePack for including PixelFormat class
author | YU |
---|---|
date | Sat, 13 Sep 2014 19:48:08 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/MyServerInitMessage.java Sat Sep 13 19:48:08 2014 +0900 @@ -0,0 +1,63 @@ +package jp.ac.u_ryukyu.alicevnc; + +import org.msgpack.annotation.Message; + +import com.glavsoft.rfb.encoding.PixelFormat; +import com.glavsoft.rfb.encoding.ServerInitMessage; + +@Message +public class MyServerInitMessage { + public int width; + public int height; + 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 MyServerInitMessage(){ + + } + + public MyServerInitMessage(ServerInitMessage serverInitMessage) { + height = serverInitMessage.getFrameBufferHeight(); + width = serverInitMessage.getFrameBufferWidth(); + name = serverInitMessage.getName(); + PixelFormat pixelFormat = serverInitMessage.getPixelFormat(); + 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; + } +}