ImageMagick.ByteConverter.ToShort C# (CSharp) Метод

ToShort() публичный статический Метод

public static ToShort ( byte data, int &offset ) : short
data byte
offset int
Результат short
    public static short ToShort(byte[] data, ref int offset)
    {
      if (offset + 2 > data.Length)
        return 0;

      short result = (short)(data[offset++] << 8);
      result = (short)(result | (short)data[offset++]);
      return (short)(result & 0xffff);
    }
  }

Usage Example

Пример #1
0
        public string Read(byte[] data, int offset, int length)
        {
            Reset(offset);

            while (_Index < offset + length)
            {
                short selector = ByteConverter.ToShort(data, ref _Index);
                switch (selector)
                {
                case 0:
                case 3:
                    SetKnotCount(data);
                    break;

                case 1:
                case 2:
                case 4:
                case 5:
                    AddPath(data);
                    break;

                case 6:
                case 7:
                case 8:
                default:
                    _Index += 24;
                    break;
                }
            }

            return(_Path.ToString());
        }
All Usage Examples Of ImageMagick.ByteConverter::ToShort