Exemplo n.º 1
0
        public TmpTDReader(Stream s)
        {
            var width  = s.ReadUInt16();
            var height = s.ReadUInt16();
            var size   = new Size(width, height);

            s.Position += 8;
            var imgStart = s.ReadUInt32();

            s.Position += 8;
            var indexEnd   = s.ReadInt32();
            var indexStart = s.ReadInt32();

            s.Position = indexStart;
            var count = indexEnd - indexStart;
            var tiles = new TmpTile[count];

            Frames = tiles.AsReadOnly();
            var tilesIndex = 0;

            foreach (var b in s.ReadBytes(count))
            {
                if (b != 255)
                {
                    s.Position          = imgStart + b * width * height;
                    tiles[tilesIndex++] = new TmpTile(s.ReadBytes(width * height), size);
                }
                else
                {
                    tiles[tilesIndex++] = new TmpTile(null, size);
                }
            }
        }
Exemplo n.º 2
0
		public TmpTDReader(Stream s)
		{
			var width = s.ReadUInt16();
			var height = s.ReadUInt16();
			var size = new Size(width, height);

			s.Position += 8;
			var imgStart = s.ReadUInt32();
			s.Position += 8;
			var indexEnd = s.ReadInt32();
			var indexStart = s.ReadInt32();

			s.Position = indexStart;
			var count = indexEnd - indexStart;
			var tiles = new TmpTile[count];
			Frames = tiles.AsReadOnly();
			var tilesIndex = 0;
			foreach (var b in s.ReadBytes(count))
			{
				if (b != 255)
				{
					s.Position = imgStart + b * width * height;
					tiles[tilesIndex++] = new TmpTile(s.ReadBytes(width * height), size);
				}
				else
					tiles[tilesIndex++] = new TmpTile(null, size);
			}
		}