コード例 #1
0
        public static Image ParseGlyphData(DelphiBinaryReader binaryReader)
        {
            byte[] data = binaryReader.ReadBinary();
            Bitmap bmp;

            using (Stream stream = new MemoryStream(data))
            {
                using (Image image = Image.FromStream(stream))
                {
                    bmp = new Bitmap(image);
                    bmp.MakeTransparent();
                }
            }

            return bmp;
        }
コード例 #2
0
        private static void OutputPictureData(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                string type = reader.ReadString();

                if (type == "TBitmap")
                {
                    byte[] imageData = reader.ReadBinary();

                    if (imageData.Length > 0)
                    {
                        using (Stream imageStream = new MemoryStream(imageData))
                        {
                            Image image = Image.FromStream(imageStream);
                            WriteLine("{0}{1}", indentation, image.Size);
                        }
                    }
                }
                else if (type == "TIcon")
                {
                    byte[] imageData = reader.ReadBytes(data.Length - 6);

                    using (Stream imageStream = new MemoryStream(imageData))
                    {
                        Icon image = new Icon(imageStream);
                        WriteLine("{0}{1}", indentation, image.Size);
                    }
                }
                else if (type == "TMetafile")
                {
                    int len = reader.ReadInt32();
                    byte[] imageData = reader.ReadBytes(len - 4);

                    using (Stream imageStream = new MemoryStream(imageData))
                    {
                        Image image = Image.FromStream(imageStream);
                        WriteLine("{0}{1}", indentation, image.Size);
                    }
                }
                else
                {
                    Debug.Assert(false);
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }
コード例 #3
0
        private static void OutputGlyphData(byte[] data, string indentation)
        {
            using (MemoryStream stream = new MemoryStream(data))
            {
                DelphiBinaryReader reader = new DelphiBinaryReader(stream);
                byte[] imageData = reader.ReadBinary();

                using (Stream imageStream = new MemoryStream(imageData))
                {
                    Image image = Image.FromStream(imageStream);
                    WriteLine("{0}{1}", indentation, image.Size);
                }

                Debug.Assert(stream.Position == stream.Length);
            }
        }