Esempio n. 1
0
 private void SetGeneralAndDimensionsText(NutTexture tex)
 {
     textureIdTB.Text = tex.ToString();
     formatLabel.Text = "Format: " + (tex.pixelInternalFormat == PixelInternalFormat.Rgba ? "" + tex.pixelFormat : "" + tex.pixelInternalFormat);
     widthLabel.Text  = "Width: " + tex.Width;
     heightLabel.Text = "Height:" + tex.Height;
 }
Esempio n. 2
0
        private void exportTextureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentNut == null || textureListBox.SelectedItem == null)
            {
                return;
            }

            using (var sfd = new SaveFileDialog())
            {
                NutTexture tex = (NutTexture)(textureListBox.SelectedItem);

                sfd.FileName = tex.ToString() + ".dds";

                // OpenGL is used for simplifying conversion to PNG.
                if (OpenTkSharedResources.SetupStatus == OpenTkSharedResources.SharedResourceStatus.Initialized)
                {
                    sfd.Filter = "Supported Formats|*.dds;*.png|" +
                                 "DirectDraw Surface (.dds)|*.dds|" +
                                 "Portable Network Graphics (.png)|*.png|" +
                                 "All files(*.*)|*.*";
                }
                else
                {
                    sfd.Filter = "DirectDraw Surface (.dds)|*.dds|" +
                                 "All files(*.*)|*.*";
                }

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    string extension = Path.GetExtension(sfd.FileName).ToLowerInvariant();

                    if (extension == ".dds")
                    {
                        ExportDds(sfd.FileName, tex);
                    }
                    else if (extension == ".png")
                    {
                        ExportPng(sfd.FileName, tex);
                    }
                }
            }
        }