コード例 #1
0
        /// <summary>
        /// Initializes new instance.
        /// </summary>
        public HeaderedImage(Stream stream, bool constsize)
        {
            BinaryReader reader = new BinaryReader(stream);

            Width  = reader.ReadInt16();
            Height = reader.ReadInt16();
            reader.ReadByte();
            byte frames = reader.ReadByte();

            Frames    = new HeaderedImage[frames];
            Frames[0] = new HeaderedImage(Width, Height, reader.ReadBytes(Width * Height));
            for (int i = 1; i < frames; i++)
            {
                short width, height;
                if (!constsize)
                {
                    width  = reader.ReadInt16();
                    height = reader.ReadInt16();
                    reader.ReadByte();
                    reader.ReadByte();
                }
                else
                {
                    width  = Width;
                    height = Height;
                }
                Frames[i] = new HeaderedImage(width, height, reader.ReadBytes(width * height));
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes new instance.
 /// </summary>
 public AnimatedHeaderedImage(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     short width = reader.ReadInt16();
     short height = reader.ReadInt16();
     reader.ReadByte();
     FramesCount = reader.ReadByte();
     Frames = new HeaderedImage[FramesCount];
     Frames[0] = new HeaderedImage(width, height, reader.ReadBytes(width*height));
     for(int i = 1; i < FramesCount; i++)
     {
         width = reader.ReadInt16();
         height = reader.ReadInt16();
         reader.ReadByte();
         FramesCount = reader.ReadByte();
         Frames[i] = new HeaderedImage(width, height, reader.ReadBytes(width*height));
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes new instance.
 /// </summary>
 public AnimatedHeaderedImage(byte[] rawdata)
 {
     if(rawdata.Length==0)return;
     short width = BitConverter.ToInt16(rawdata, 0);
     short height = BitConverter.ToInt16(rawdata, 2);
     FramesCount = rawdata[5];
     Frames = new HeaderedImage[FramesCount];
     byte[] data = new byte[width*height];
     Array.Copy(rawdata, 6, data, 0, width*height);
     Frames[0] = new HeaderedImage(width, height, data);
     int nextindex = data.Length+6;
     for(int i = 1; i < FramesCount; i++)
     {
         width = BitConverter.ToInt16(rawdata, nextindex);
         height = BitConverter.ToInt16(rawdata, nextindex+2);
         data = new byte[width*height];
         Array.Copy(rawdata, nextindex+6, data, 0, width*height);
         Frames[i] = new HeaderedImage(width, height, data);
         nextindex += data.Length+6;
     }
 }