Ejemplo n.º 1
0
        private PointD[] CreatePoint(byte[] data)
        {
            PointD[] result = new PointD[3];

            for (int i = 0; i < 3; i++)
            {
                uint yy = (uint)ByteConverter.ToUInt(data, ref _Index);
                int  y  = (int)yy;
                if (yy > 2147483647)
                {
                    y = (int)(yy - 4294967295U - 1);
                }

                uint xx = (uint)ByteConverter.ToUInt(data, ref _Index);
                int  x  = (int)xx;
                if (xx > 2147483647)
                {
                    x = (int)(xx - 4294967295U - 1);
                }

                result[i] = new PointD((double)x * _Width / 4096 / 4096, (double)y * _Height / 4096 / 4096);
            }

            return(result);
        }
Ejemplo n.º 2
0
        private void Initialize()
        {
            if (_clipPaths != null)
            {
                return;
            }

            _clipPaths = new Collection <ClipPath>();
            _values    = new Collection <EightBimValue>();

            int i = 0;

            while (i < Data.Length)
            {
                if (Data[i++] != '8')
                {
                    continue;
                }
                if (Data[i++] != 'B')
                {
                    continue;
                }
                if (Data[i++] != 'I')
                {
                    continue;
                }
                if (Data[i++] != 'M')
                {
                    continue;
                }

                if (i + 7 > Data.Length)
                {
                    return;
                }

                short id         = ByteConverter.ToShort(Data, ref i);
                bool  isClipPath = id > 1999 && id < 2998;

                string name   = null;
                int    length = Data[i++];
                if (length != 0)
                {
                    if (isClipPath && i + length < Data.Length)
                    {
                        name = Encoding.ASCII.GetString(Data, i, length);
                    }

                    i += length;
                }

                if ((length & 0x01) == 0)
                {
                    i++;
                }

                length = ByteConverter.ToUInt(Data, ref i);
                if (i + length > Data.Length)
                {
                    return;
                }

                if (length < 0)
                {
                    return;
                }

                if (length != 0)
                {
                    if (isClipPath)
                    {
                        ClipPath clipPath = CreateClipPath(name, i, length);
                        if (clipPath != null)
                        {
                            _clipPaths.Add(clipPath);
                        }
                    }

                    byte[] data = new byte[length];
                    Array.Copy(Data, i, data, 0, length);
                    _values.Add(new EightBimValue(id, data));
                }

                i += length;
            }
        }
Ejemplo n.º 3
0
        private void Initialize()
        {
            if (_clipPaths != null)
            {
                return;
            }

            _clipPaths = new Collection <IClipPath>();
            _values    = new Collection <IEightBimValue>();

            var data = GetData();

            int i = 0;

            while (i < data.Length)
            {
                if (data[i++] != '8')
                {
                    continue;
                }
                if (data[i++] != 'B')
                {
                    continue;
                }
                if (data[i++] != 'I')
                {
                    continue;
                }
                if (data[i++] != 'M')
                {
                    continue;
                }

                if (i + 7 > data.Length)
                {
                    return;
                }

                var id         = ByteConverter.ToShort(data, ref i);
                var isClipPath = id > 1999 && id < 2998;

                string name   = null;
                int    length = data[i++];
                if (length != 0)
                {
                    if (isClipPath && i + length < data.Length)
                    {
                        name = Encoding.ASCII.GetString(data, i, length);
                    }

                    i += length;
                }

                if ((length & 0x01) == 0)
                {
                    i++;
                }

                length = ByteConverter.ToUInt(data, ref i);
                if (i + length > data.Length)
                {
                    return;
                }

                if (length < 0)
                {
                    return;
                }

                if (length != 0)
                {
                    if (isClipPath)
                    {
                        var clipPath = CreateClipPath(name, i, length);
                        if (clipPath != null)
                        {
                            _clipPaths.Add(clipPath);
                        }
                    }

                    var value = new byte[length];
                    Array.Copy(data, i, value, 0, length);
                    _values.Add(new EightBimValue(id, value));
                }

                i += length;
            }
        }