I'm implementing the RFB protocol (VNC server) in Java.
I'm not able to understand the PIXEL_FORMAT
provided in the protocol.
The definition of Pixel Format Data Structure is:
+--------------+--------------+-----------------+
| No. of bytes | Type [Value] | Description |
+--------------+--------------+-----------------+
| 1 | U8 | bits-per-pixel |
| 1 | U8 | depth |
| 1 | U8 | big-endian-flag |
| 1 | U8 | true-color-flag |
| 2 | U16 | red-max |
| 2 | U16 | green-max |
| 2 | U16 | blue-max |
| 1 | U8 | red-shift |
| 1 | U8 | green-shift |
| 1 | U8 | blue-shift |
| 3 | | padding |
+--------------+--------------+-----------------+
The RFB protocol defines the meaning of each flag in detail, but still I'm not able to determine the right values for a raw ARGB image. I'm using the following values:
bits-per-pixel = 32
depth = 32
big-endian-flag = 1
true-color-flag = 1
red-max = 255
green-max = 255
blue-max = 255
red-shift = 0
green-shift = 0
blue-shift = 0
padding = 0
While using RealVNC client, I get grayscale image and while using TightVNC client I get four different layers of the image side by side.
Can anyone help me get the right encoding?