public static GameImage FromTex(TexFileReader reader) { const short x = 0; const short y = 0; using (DisposableStack insurance = new DisposableStack(2)) { GLTexture layer = insurance.Add(reader.ReadImage()); GLTexture palettes = insurance.Add(GLTextureFactory.FromBitmapPalettes(reader.Palettes)); GameImage result = new GameImage(x, y, layer, palettes); insurance.Clear(); return(result); } }
private void ReadTextureFromTexFiles(string[] files) { GLTexture[] textures = new GLTexture[2]; using (DisposableStack disposables = new DisposableStack(2)) { for (int i = 0; i < 2; i++) { using (FileStream input = File.OpenRead(files[i])) using (TexFileReader texReader = new TexFileReader(input)) textures[i] = disposables.Add(texReader.ReadImage()); } _texture = GLTextureFactory.HorizontalJoin(textures[0], textures[1]); _ownTexture = true; } }