Exemplo n.º 1
0
        public List <PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;
            MemoryStream _fs = null;
            BinaryReader _fr = null;

            try
            {
                _fs = new MemoryStream(BitConverter.GetBytes(Flags));
                _fr = new BinaryReader(_fs);
                //Byte 1 will be ObjectID
                byte ObjectID = _fr.ReadByte();
                //Byte 2 is the real flags
                byte RealFlags = _fr.ReadByte();
                // 0 1 2 3 4 5 6 7
                // X X X X X X C X
                // if C = 1 Data int16 else float!
                bool Compressed = ((RealFlags & (int)Math.Pow(2, 6)) == (int)Math.Pow(2, 6));
                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);

                Single StartAngle = _br.ReadSingle();
                Single SweepAngle = _br.ReadSingle();
                EMFPen EMFp       = (EMFPen)ObjectTable[ObjectID];
                Pen    p          = EMFp.myPen;
                if (Compressed)
                {
                    DoCompressed(StartAngle, SweepAngle, _br, p);
                }
                else
                {
                    DoFloat(StartAngle, SweepAngle, _br, p);
                }
                return(items);
            }
            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
                if (_fr != null)
                {
                    _fr.Close();
                }
                if (_fs != null)
                {
                    _fs.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        public List <PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;
            MemoryStream _fs = null;
            BinaryReader _fr = null;

            try
            {
                _fs = new MemoryStream(BitConverter.GetBytes(Flags));
                _fr = new BinaryReader(_fs);
                //Byte 1 will be ObjectID
                byte ObjectID = _fr.ReadByte();
                //Byte 2 is the real flags
                byte RealFlags = _fr.ReadByte();
                // 0 1 2 3 4 5 6 7
                // X X X P X L C X
                // if P = 1 Points are Relative to previous point (Ignore C)
                // if C = 1 Points are int16, 0 = Points are Float (ignore P)
                // if L = 1 Draw a line between last and first points
                bool Compressed = ((RealFlags & (int)Math.Pow(2, 6)) == (int)Math.Pow(2, 6));
                bool Relative   = false;
                if (!Compressed)
                {
                    Relative = ((RealFlags & (int)Math.Pow(2, 3)) == (int)Math.Pow(2, 3));
                }
                bool CloseShape = ((RealFlags & (int)Math.Pow(2, 5)) == (int)Math.Pow(2, 5));
                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);
                UInt32 NumberOfPoints = _br.ReadUInt32();
                EMFPen Emfp           = (EMFPen)ObjectTable[ObjectID];
                Pen    p = Emfp.myPen;
                //EMFBrush b = p.myBrush;
                if (Compressed)
                {
                    DoCompressed(NumberOfPoints, _br, p);
                }
                else if (Relative)
                {
                    DoRelative(NumberOfPoints, _br, p);
                }
                else
                {
                    DoFloat(NumberOfPoints, _br, p);
                }
                return(items);
            }

            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
                if (_fr != null)
                {
                    _fr.Close();
                }
                if (_fs != null)
                {
                    _fs.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        internal static EMFRecordObject getObject(int flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;

            try
            {
                //Put the Flags into a stream and then use a binary Reader to read the Flags
                _ms = new MemoryStream(BitConverter.GetBytes(flags));
                _br = new BinaryReader(_ms);
                //ObjectID is least significant byte (which will be the first byte in the byte array due to Little Endian)
                byte Objectid = _br.ReadByte();
                //Object Type next...
                byte ObjectTyp = _br.ReadByte();
                //Don't know what to do if this object continues on the next one!
                bool ContinuesOnNextObject = ((ObjectTyp & 128) == 128);
                if (ContinuesOnNextObject)
                {
                    ObjectTyp ^= 128;
                }

                switch ((UInt16)ObjectTyp)
                {
                case (UInt16)EmfObjectType.invalid:
                    break;

                case (UInt16)EmfObjectType.brush:
                    EMFBrush Obrush = EMFBrush.getEMFBrush(RecordData);
                    Obrush.ObjectID = Objectid;
                    return(Obrush);

                case (UInt16)EmfObjectType.pen:
                    EMFPen OPen = EMFPen.getEMFPen(RecordData);
                    OPen.ObjectID = Objectid;
                    return(OPen);

                case (UInt16)EmfObjectType.path:
                    break;

                case (UInt16)EmfObjectType.region:
                    break;

                case (UInt16)EmfObjectType.image:
                    break;

                case (UInt16)EmfObjectType.font:
                    EMFFont OFont = EMFFont.getEMFFont(RecordData);
                    OFont.ObjectID = Objectid;
                    return(OFont);

                case (UInt16)EmfObjectType.stringformat:
                    EMFStringFormat Ostringformat = EMFStringFormat.getEMFStringFormat(RecordData);
                    Ostringformat.ObjectID = Objectid;
                    return(Ostringformat);

                case (UInt16)EmfObjectType.ImageAttributes:
                    break;

                case (UInt16)EmfObjectType.CustomLineType:
                    break;
                }
                return(null);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        public List <PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;
            MemoryStream _fs = null;
            BinaryReader _fr = null;

            try
            {
                _fs = new MemoryStream(BitConverter.GetBytes(Flags));
                _fr = new BinaryReader(_fs);
                byte ObjectID = _fr.ReadByte();
                //Byte 1 will be ignored
                byte RealFlags = _fr.ReadByte();
                //Byte 2 will be brushtype
                // 0 1 2 3 4 5 6 7
                // X X X X X X C X
                // if C = 1 int16, 0 = Points are Float (ignore P)
                bool Compressed = ((RealFlags & (int)Math.Pow(2, 6)) == (int)Math.Pow(2, 6));

                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);

                EMFPen EMFp = (EMFPen)ObjectTable[ObjectID];
                Pen    p    = EMFp.myPen;

                if (Compressed)
                {
                    Int16 Xp  = _br.ReadInt16();
                    Int16 Yp  = _br.ReadInt16();
                    Int16 Wid = _br.ReadInt16();
                    Int16 Hgt = _br.ReadInt16();
                    DoEllipse(p, Xp, Yp, Wid, Hgt);
                }
                else
                {
                    Single Xp  = _br.ReadSingle();
                    Single Yp  = _br.ReadSingle();
                    Single Wid = _br.ReadSingle();
                    Single Hgt = _br.ReadSingle();
                    DoEllipse(p, Xp, Yp, Wid, Hgt);
                }
                return(items);
            }
            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
                if (_fr != null)
                {
                    _fr.Close();
                }
                if (_fs != null)
                {
                    _fs.Dispose();
                }
            }
        }
Exemplo n.º 5
0
        public List <PageItem> Process(int Flags, byte[] RecordData)
        {
            MemoryStream _ms = null;
            BinaryReader _br = null;
            MemoryStream _fs = null;
            BinaryReader _fr = null;

            try
            {
                _fs = new MemoryStream(BitConverter.GetBytes(Flags));
                _fr = new BinaryReader(_fs);
                //Byte 1 will be ObjectID
                byte ObjectID = _fr.ReadByte();
                //Byte 2 is the real flags
                byte RealFlags = _fr.ReadByte();
                // 0 1 2 3 4 5 6 7
                // X X X X X X C X
                // if C = 1 Points are int16, 0 = Points are Float

                bool Compressed = ((RealFlags & (int)Math.Pow(2, 6)) == (int)Math.Pow(2, 6));

                _ms = new MemoryStream(RecordData);
                _br = new BinaryReader(_ms);

                float  Tension          = _br.ReadSingle();// _br.ReadUInt32(); //20081110 PJR & GJL EMF+ Definition is WRONG!!!
                UInt32 Offset           = _br.ReadUInt32();
                UInt32 NumberOfPoints   = _br.ReadUInt32();
                UInt32 NumberOfSegments = _br.ReadUInt32();
                EMFPen Emfp             = (EMFPen)ObjectTable[ObjectID];
                Pen    p = Emfp.myPen;
                //EMFBrush b = p.myBrush;
                if (Compressed)
                {
                    DoCompressed(NumberOfPoints, _br, p, Offset, NumberOfSegments, Tension);
                }
                else
                {
                    DoFloat(NumberOfPoints, _br, p, Offset, NumberOfSegments, Tension);
                }
                return(items);
            }

            finally
            {
                if (_br != null)
                {
                    _br.Close();
                }
                if (_ms != null)
                {
                    _ms.Dispose();
                }
                if (_fr != null)
                {
                    _fr.Close();
                }
                if (_fs != null)
                {
                    _fs.Dispose();
                }
            }
        }