예제 #1
0
        /// <summary>
        /// Save the generated file as a raw file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void IL2Save(object sender, RoutedEventArgs e)
        {
            if (bitmap != null)
            {
                var dialog = new Microsoft.Win32.SaveFileDialog();
                dialog.InitialDirectory = SRTMdirectory;
                dialog.Title            = "Save generated image";
                dialog.Filter           = "IL2 files (*.tga)|*.tga";

                if (dialog.ShowDialog() == true)
                {
                    Mouse.OverrideCursor = Cursors.Wait;

                    IL2Mapping  map       = new IL2Mapping();
                    IL2Colour[] newPixels = new IL2Colour[settings.ImageWidth * settings.ImageHeight];

                    for (int i = 0; i < settings.ImageHeight * settings.ImageWidth; i++)
                    {
                        newPixels[i] = map.GetColour(Pixels[i]);
                    }

                    TGAWriter.Save(newPixels, settings.ImageWidth, settings.ImageHeight, dialog.FileName);

                    Mouse.OverrideCursor = null;
                }
            }
        }
예제 #2
0
        public void IL2Save(string path)
        {
            IL2Mapping map = new IL2Mapping();

            IL2Colour[] newPixels = new IL2Colour[settings.ImageWidth * settings.ImageHeight];

            for (int i = 0; i < settings.ImageHeight * settings.ImageWidth; i++)
            {
                newPixels[i] = map.GetColour(Pixels[i]);
            }

            TGAWriter.Save(newPixels, settings.ImageWidth, settings.ImageHeight, path);
        }