public static void DrawCrosshairs() { Bitmap image = new Bitmap($@"{Parameters.BaseDirectory}\Files\crosshair.png"); Color[][] cMatrix = ImageProcessing.CreateBlankColorMatrix(83, 83); ImageProcessing.AddImageIntoMatrix(cMatrix, image, 0, 0); cMatrix = ImageProcessing.Flip(cMatrix, true, false); ImageProcessing.CreateImage(cMatrix).Save($@"{Parameters.BaseDirectory}\\Output\\Crosshair\\CrosshairFrame.png"); foreach (KeyValuePair <MobileType, Dictionary <ShotType, AimPreset> > kvp in MobileMetadata.AimPresets) { foreach (KeyValuePair <ShotType, AimPreset> kvp2 in kvp.Value) { cMatrix = DrawCrosshair( kvp2.Value.AimTrueRotationMin, kvp2.Value.AimTrueRotationMax, kvp2.Value.AimFalseRotationMin, kvp2.Value.AimFalseRotationMax, true); ImageProcessing.CreateImage(cMatrix).Save($@"{Parameters.BaseDirectory}\\Output\\Crosshair\\{kvp.Key}{kvp2.Key}Ally.png"); cMatrix = DrawCrosshair( kvp2.Value.AimTrueRotationMin, kvp2.Value.AimTrueRotationMax, kvp2.Value.AimFalseRotationMin, kvp2.Value.AimFalseRotationMax, false); ImageProcessing.CreateImage(cMatrix).Save($@"{Parameters.BaseDirectory}\\Output\\Crosshair\\{kvp.Key}{kvp2.Key}Enemy.png"); } } Process.Start($@"{Parameters.BaseDirectory}\\Output\\Crosshair"); }
private void Start() { int width = _imgList[0].BitmapImage.Width; int height = _imgList[0].BitmapImage.Height; Console.WriteLine("--Sprites per Line: "); int spritesPerLine = int.Parse(Console.ReadLine()); Color[][] newImageMatrix = ImageProcessing.CreateBlankColorMatrix((width + 2) * spritesPerLine, (height + 2) * (int)Math.Ceiling(_imgList.Count / (double)spritesPerLine)); int accX = 1; int accY = 1; int index = 0; foreach (ImportedImage img in _imgList) { ImageProcessing.AddImageIntoMatrix(newImageMatrix, img.BitmapImage, accX, accY); accX += width + 2; if (++index % spritesPerLine == 0) { accY += height + 2; accX = 1; } } ImageProcessing.CreateImage(newImageMatrix).Save(Parameters.SpritesheetOutputDirectory + @"output.png"); ExplorerHelper.OpenDirectory(Parameters.SpritesheetOutputDirectory); Thread.Sleep(1500); PaintHelper.OpenPictureFromOutputFolder(Parameters.SpritesheetOutputDirectory + @"output.png"); }
private void Start() { (int, int)maxImageSize = (imgList.Max((x) => x.BitmapImage.Width), imgList.Max((x) => x.BitmapImage.Height)); (int, int)maxImagePivot = (imgList.Max((x) => x.Pivot.Item1), imgList.Max((x) => x.Pivot.Item2)); (int, int)minImagePivot = (imgList.Min((x) => x.Pivot.Item1), imgList.Min((x) => x.Pivot.Item2)); (int, int)newSize = ( maxImageSize.Item1 + Math.Max(Math.Abs(minImagePivot.Item1), Math.Abs(minImagePivot.Item1)), maxImageSize.Item2 + Math.Max(Math.Abs(maxImagePivot.Item2), Math.Abs(minImagePivot.Item2))); Console.WriteLine("Sprites per line: "); int imgPerLine = int.Parse(Console.ReadLine()); Console.WriteLine("Squish X factor:"); int squishXFactor = int.Parse(Console.ReadLine()); Console.WriteLine("Squish Y factor:"); int squishYFactor = int.Parse(Console.ReadLine()); Console.WriteLine("Offset X factor:"); int offsetX = int.Parse(Console.ReadLine()); Console.WriteLine("Offset Y factor:"); int offsetY = int.Parse(Console.ReadLine()); (int, int)newBigImageSize = ((newSize.Item1 - squishXFactor) * imgPerLine, (newSize.Item2 - squishYFactor) * (int)Math.Ceiling((double)imgList.Count() / imgPerLine)); Color[][] nCM = ImageProcessing.CreateBlankColorMatrix(newBigImageSize.Item1, newBigImageSize.Item2); int index = 0; int w = 0; int h = 0; foreach (ImportedImage img in imgList) { w = offsetX + (newSize.Item1 - squishXFactor) * (index % imgPerLine) + newSize.Item1 / 2 + img.Pivot.Item1; h = offsetY + (newSize.Item2 - squishYFactor) * (index / imgPerLine) + newSize.Item2 / 2 + img.Pivot.Item2; ImageProcessing.AddImageIntoMatrix(nCM, img.BitmapImage, w, h); index++; } ImageProcessing.CreateImage(nCM).Save(Parameters.SpritesheetOutputDirectory + @"output.png"); ExplorerHelper.OpenDirectory(Parameters.SpritesheetOutputDirectory); Thread.Sleep(1500); PaintHelper.OpenPictureFromOutputFolder(Parameters.SpritesheetOutputDirectory + @"output.png"); }
public void Start() { List <ImportedImage> imgListSFX = _imgListSFX.ToList(); List <ImportedImage> imgList = _imgList.ToList(); int[] imagePerLayer = new int[] { imgList.Count, imgListSFX.Count }; imgList.AddRange(imgListSFX); (int, int)maxImageSize = (imgList.Max((x) => x.BitmapImage.Width), imgList.Max((x) => x.BitmapImage.Height)); (int, int)maxImagePivot = (imgList.Max((x) => x.Pivot.Item1), imgList.Max((x) => x.Pivot.Item2)); (int, int)minImagePivot = (imgList.Min((x) => x.Pivot.Item1), imgList.Min((x) => x.Pivot.Item2)); (int, int)newSize = ( maxImageSize.Item1 + Math.Max(Math.Abs(minImagePivot.Item1), Math.Abs(minImagePivot.Item1)), maxImageSize.Item2 + Math.Max(Math.Abs(maxImagePivot.Item2), Math.Abs(minImagePivot.Item2))); Console.WriteLine("Sprites per line: "); int imgPerLine = int.Parse(Console.ReadLine()); Console.WriteLine("Squish X factor:"); int squishXFactor = int.Parse(Console.ReadLine()); Console.WriteLine("Squish Y factor:"); int squishYFactor = int.Parse(Console.ReadLine()); Console.WriteLine("Initial X Shift factor:"); int initialXFactor = int.Parse(Console.ReadLine()); Console.WriteLine("Initial Y Shift factor:"); int initialYFactor = int.Parse(Console.ReadLine()); (int, int)newBigImageSize = ((newSize.Item1 - squishXFactor + initialXFactor) * imgPerLine, (newSize.Item2 - squishYFactor) * (int)Math.Ceiling((double)imagePerLayer[0] / imgPerLine)); Color[][] nCM1 = ImageProcessing.CreateBlankColorMatrix(newBigImageSize.Item1, newBigImageSize.Item2); Color[][] nCM2 = ImageProcessing.CreateBlankColorMatrix(newBigImageSize.Item1, newBigImageSize.Item2); int index = 0; int w = 0; int h = 0; bool reaply = false; foreach (ImportedImage img in imgList) { w = initialXFactor + /* * (1 + (index % imgPerLine))*/ +(newSize.Item1 - squishXFactor) * (index % imgPerLine) + newSize.Item1 / 2 + img.Pivot.Item1; h = initialYFactor + (newSize.Item2 - squishYFactor) * (index / imgPerLine) + newSize.Item2 / 2 + img.Pivot.Item2; if (!reaply) { ImageProcessing.AddImageIntoMatrix(nCM1, img.BitmapImage, w, h); ImageProcessing.AddImageIntoMatrix(nCM2, img.BitmapImage, w, h); } else { ImageProcessing.BlendImageIntoMatrix(nCM1, img.BitmapImage, w, h, (y, x) => { return(ColorBlending.MultiChannelAlphaBlending(x, y)); }); ImageProcessing.BlendImageIntoMatrix(nCM2, img.BitmapImage, w, h, (x, y) => { return(ColorBlending.MultiChannelAlphaBlending(x, y)); }); } if (++index == imagePerLayer[0] && !reaply) { reaply = true; index = 0; } } ImageProcessing.BlendImageIntoMatrix(nCM1, ImageProcessing.CreateImage(nCM2), 0, 0, (x, y) => { return(Color.FromArgb(Math.Max(x.A, y.A), Math.Max(x.R, y.R), Math.Max(x.G, y.G), Math.Max(x.B, y.B))); }); ImageProcessing.CreateImage(nCM1).Save(Parameters.SpritesheetOutputDirectory + @"output.png"); ExplorerHelper.OpenDirectory(Parameters.SpritesheetOutputDirectory); Thread.Sleep(1500); PaintHelper.OpenPictureFromOutputFolder(Parameters.SpritesheetOutputDirectory + @"output.png"); }