/**<summary>Replaces the coin textures in the dust texture.</summary>*/ private static void ReplaceDust() { Image dustBmp = XnbExtractor.ExtractBitmap(Path.Combine(ImageDir, "Dust.xnb")); Bitmap gBmp = new Bitmap(dustBmp); using (Graphics g = Graphics.FromImage(gBmp)) { g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; Point point = new Point(440, 60); int spacing = 10; g.DrawImage(GetImage(ImageTypes.Dust, Copper), point); point.X += spacing; g.DrawImage(GetImage(ImageTypes.Dust, Silver), point); point.X += spacing; g.DrawImage(GetImage(ImageTypes.Dust, Gold), point); point.X += spacing; g.DrawImage(GetImage(ImageTypes.Dust, Platinum), point); point.X += spacing; } PngConverter.Convert(gBmp, Path.Combine(ImageDir, "Dust.xnb")); }
static void BulkConvertAtxMulti(string inPath, string filter, bool recursive) { foreach (var path in Directory.GetFiles(inPath, filter, recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)) { using (var fs = Utils.CheckDecompress(File.OpenRead(path))) { var tex = new AlTexture(); tex.Read(new BinaryReader(fs)); if (tex.ChildTextures.Count < 2) { continue; } Console.WriteLine(path); var img = new AlImage(); using (Stream ms = Utils.CheckDecompress(new MemoryStream(tex.ImageData))) { img.Read(new BinaryReader(ms)); if (img.PixelFormat != "BGRA") { Console.WriteLine("Not BGRA, skipping"); continue; } using (MemoryStream ims = new MemoryStream(img.Mipmaps[0])) using (var imgConv = PngConverter.ConvertBgra32(new BinaryReader(ims), (int)img.Width, (int)img.Height)) { foreach (var child in tex.ChildTextures) { // First mip only var bounds = child.Bounds[0]; using (var childImage = new Image <Bgra32>(bounds.W, bounds.H)) { childImage.Mutate(ctx => ctx.DrawImage(imgConv, new Point(-bounds.X, -bounds.Y), 1f)); childImage.SaveAsPng($"{Path.ChangeExtension(path, null)}_{child.Id:x8}.png"); } } } } } } }
/**<summary>Replaces an image content file.</summary>*/ private static void ReplaceImage(ImageTypes type, RupeeColors color, string outputFile) { PngConverter.Convert(GetImage(type, color), Path.Combine(ImageDir, outputFile)); }
//=========== HELPERS ============ #region Helpers /**<summary>Replaces an image content file.</summary>*/ private static void ReplaceImage(string name, string outputFile) { PngConverter.Convert(GetImage(name), Path.Combine(ImageDir, outputFile)); }