Esempio n. 1
0
        private void BtnExportPNG_Click(object sender, EventArgs e)
        {
            if (LstTextures.SelectedIndex > -1)
            {
                using (SaveFileDialog SaveDlg = new SaveFileDialog())
                {
                    SaveDlg.Filter = "PNG image|*.png";

                    if (SaveDlg.ShowDialog() == DialogResult.OK)
                    {
                        IDDTexture Texture = CurrentFile.Textures[LstTextures.SelectedIndex];

                        byte[] Data   = Texture.TextureData;
                        int    Width  = Texture.Resolution.Width;
                        int    Height = Texture.Resolution.Height;

                        switch (Texture.Format)
                        {
                        case TextureFormat.DXT1: DXT.DXT1_Decode(Data, Width, Height).Save(SaveDlg.FileName); break;

                        case TextureFormat.DXT3: DXT.DXT3_Decode(Data, Width, Height).Save(SaveDlg.FileName); break;

                        case TextureFormat.DXT5: DXT.DXT5_Decode(Data, Width, Height).Save(SaveDlg.FileName); break;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void DisplayTexture(IDDTexture Texture)
        {
            byte[] Data   = Texture.TextureData;
            int    Width  = Texture.Resolution.Width;
            int    Height = Texture.Resolution.Height;

            switch (Texture.Format)
            {
            case TextureFormat.DXT1: TextureImg.Image = DXT.DXT1_Decode(Data, Width, Height); break;

            case TextureFormat.DXT3: TextureImg.Image = DXT.DXT3_Decode(Data, Width, Height); break;

            case TextureFormat.DXT5: TextureImg.Image = DXT.DXT5_Decode(Data, Width, Height); break;
            }
        }