/// <summary> /// Loads and reads DDS file /// </summary> /// <param name="fileName"></param> public void Read(string fileName) { byte[] rawData = File.ReadAllBytes(fileName + EXTENSION); imageData = new List <TexelBlock>(); using (MemoryStream ms = new MemoryStream(rawData)) { using (BinaryReader r = new BinaryReader(ms)) { fileHeader.Parse(r); TexelBlock t; while (r.BaseStream.Position != r.BaseStream.Length) { t = new TexelBlock(); t.color0 = r.ReadUInt16(); t.color1 = r.ReadUInt16(); t.blocks = new byte[4]; t.blocks[0] = r.ReadByte(); t.blocks[1] = r.ReadByte(); t.blocks[2] = r.ReadByte(); t.blocks[3] = r.ReadByte(); imageData.Add(t); } } } }
/// <summary> /// Loads and reads DDS file /// </summary> /// <param name="fileName"></param> public void Read(string fileName) { byte[] rawData = File.ReadAllBytes(fileName+ EXTENSION); imageData = new List<TexelBlock>(); using (MemoryStream ms = new MemoryStream(rawData)) { using (BinaryReader r = new BinaryReader(ms)) { fileHeader.Parse(r); TexelBlock t; while (r.BaseStream.Position != r.BaseStream.Length) { t = new TexelBlock(); t.color0 = r.ReadUInt16(); t.color1 = r.ReadUInt16(); t.blocks = new byte[4]; t.blocks[0] = r.ReadByte(); t.blocks[1] = r.ReadByte(); t.blocks[2] = r.ReadByte(); t.blocks[3] = r.ReadByte(); imageData.Add(t); } } } }
public void AddImageData(TexelBlock tb) { imageData.Add(tb); }