Ejemplo n.º 1
0
        private void ReadZrlePackedPixels(int tw, int th, int[] palette, int palSize, int[] tile)
        {
            var bppp = palSize > 16 ? 8 :
                       (palSize > 4 ? 4 : (palSize > 2 ? 2 : 1));
            var ptr = 0;

            for (var i = 0; i < th; i++)
            {
                var eol   = ptr + tw;
                var b     = 0;
                var nbits = 0;

                while (ptr < eol)
                {
                    if (nbits == 0)
                    {
                        b     = _DSerializer.ReadByte();
                        nbits = 8;
                    }
                    nbits -= bppp;
                    var index = (b >> nbits) & ((1 << bppp) - 1) & 127;
                    tile[ptr++] = palette[index];
                }
            }
        }
Ejemplo n.º 2
0
        private void GetSecurityTypes()
        {
            if (ServerVersion == RfbVersions.v3_3)
            {
                var type = serializer.ReadUInt32();
                securityTypes = new byte[] { (byte)type };
            }
            else
            {
                var n = serializer.ReadByte();
                if (n == 0)
                {
                    throw new Exception();
                }

                securityTypes = serializer.ReadBytes(n);
            }
        }