private void Calculate() { string savePath = Path.Combine(Atlas.MapImagesFolder, "map{0}-{1}.bmp"); Array mapNames = Enum.GetValues(typeof(MapName)); int progressDelta = Convert.ToInt32(Math.Round(100 / (double)mapNames.Length)); foreach (MapName mapName in mapNames) { int mapIndex = (int)mapName; Map currentMap = Map.Get(mapName); ReportProgress(mapIndex * progressDelta + 1, String.Format("Extracting Map {0}... (this may take a while)", mapIndex)); Image mapImage = currentMap.ToImage(true); // Zoom 1/16 Image mapImageResized = new Bitmap(mapImage, new Size(currentMap.Width / 16, currentMap.Height / 16)); mapImageResized.Save(String.Format(savePath, mapIndex, "6.25%"), ImageFormat.Png); mapImageResized.Dispose(); // Zoom 1/8 mapImageResized = new Bitmap(mapImage, new Size(currentMap.Width / 8, currentMap.Height / 8)); mapImageResized.Save(String.Format(savePath, mapIndex, "12.5%"), ImageFormat.Png); mapImageResized.Dispose(); // Zoom 1/4 mapImageResized = new Bitmap(mapImage, new Size(currentMap.Width / 4, currentMap.Height / 4)); mapImageResized.Save(String.Format(savePath, mapIndex, "25%"), ImageFormat.Png); mapImageResized.Dispose(); // Zoom 1/2 mapImageResized = new Bitmap(mapImage, new Size(currentMap.Width / 2, currentMap.Height / 2)); mapImageResized.Save(String.Format(savePath, mapIndex, "50%"), ImageFormat.Png); mapImageResized.Dispose(); // Zoom 100% mapImage.Save(String.Format(savePath, mapIndex, "100%"), ImageFormat.Bmp); mapImage.Dispose(); GC.Collect(); // GC.WaitForPendingFinalizers(); } ReportProgress(100, "Image Update completed"); }
public static void Calculate() { string savePath = Path.Combine(Atlas.MapImagesFolder, "map{0}-{1}.png"); for (int mapIndex = 0; mapIndex < 5; mapIndex++) { Map currentMap = Map.Get((MapName)mapIndex); ReportProgress(mapIndex * 20 + 1, String.Format("Extracting Map {0}... (this may take a while)", mapIndex)); Image mapImage = currentMap.ToImage(true); // Zoom 50% Image mapImage_resized = new Bitmap(mapImage, new Size(currentMap.Width / 16, currentMap.Height / 16)); mapImage_resized.Save(String.Format(savePath, mapIndex, "50%"), ImageFormat.Png); mapImage_resized.Dispose(); // Zoom 100% mapImage_resized = new Bitmap(mapImage, new Size(currentMap.Width / 8, currentMap.Height / 8)); mapImage_resized.Save(String.Format(savePath, mapIndex, "100%"), ImageFormat.Png); mapImage_resized.Dispose(); // Zoom 200% mapImage_resized = new Bitmap(mapImage, new Size(currentMap.Width / 4, currentMap.Height / 4)); mapImage_resized.Save(String.Format(savePath, mapIndex, "200%"), ImageFormat.Png); mapImage_resized.Dispose(); // Zoom 400% mapImage_resized = new Bitmap(mapImage, new Size(currentMap.Width / 2, currentMap.Height / 2)); mapImage_resized.Save(String.Format(savePath, mapIndex, "400%"), ImageFormat.Png); mapImage_resized.Dispose(); // Zoom 800% mapImage.Save(String.Format(savePath, mapIndex, "800%"), ImageFormat.Png); mapImage.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); } ReportProgress(100, "Image Update completed"); }