static void testYanagisawaPic2() { // var bytes = File.ReadAllBytes(@"D:\Program Files (x86)\DOGACGA\DOGA-L3\common\atr\AMI1.PIC"); // var bytes = File.ReadAllBytes(@"C:\Program Files (x86)\DoGA\DOGA-L3\common\atr\AMI1.PIC"); // var bytes = File.ReadAllBytes(@"D:\Program Files (x86)\DOGACGA\DOGA-L3\common\atr\HANAGARA.PIC"); // var bytes = File.ReadAllBytes(@"C:\Program Files (x86)\DoGA\DOGA-L3\common\atr\HANAGARA.PIC"); var bytes = File.ReadAllBytes(@"C:\Program Files (x86)\DoGA\DOGA-L3\common\atr\BAKUHATU.PIC"); // var bytes = File.ReadAllBytes(@"C:\Program Files (x86)\DoGA\DOGA-L3\common\atr\MEISAI1.PIC"); var loader = new YanagisawaPicLoader(bytes, YanagisawaPicLoader.PixelOrder.BGRA, YanagisawaPicLoader.DirectionY.TopToBottom); var result = loader.extract(); var bitmap = new Bitmap(loader.width, loader.height, PixelFormat.Format32bppArgb); var dataBitmap = bitmap.LockBits(new Rectangle(0, 0, loader.width, loader.height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); Marshal.Copy(loader.bytesImageExtracted, 0, dataBitmap.Scan0, loader.bytesImageExtracted.Length); bitmap.UnlockBits(dataBitmap); /* * var bitmap = new Bitmap(loader.width, loader.height, PixelFormat.Format32bppArgb); * * for (var y = 0; y < loader.height; y++) { * // var dataBitmap = bitmap.LockBits(new Rectangle(0, y, loader.width, 1), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); * // var result = loader.extractOneLine(); * // Marshal.Copy(loader.bytesImageExtracted, 0, dataBitmap.Scan0, loader.bytesImageExtracted.Length); * // bitmap.UnlockBits(dataBitmap); * } * var dataBitmap = bitmap.LockBits(new Rectangle(0, 0, loader.width, loader.height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); * Marshal.Copy(loader.bytesImageExtracted, 0, dataBitmap.Scan0, loader.bytesImageExtracted.Length); * bitmap.UnlockBits(dataBitmap); */ // bitmap.Save(@"d:\temp\cap\out.bmp"); bitmap.Save(@"c:\temp\cap\out.png"); }
public static Texture2D loadTextureYanagisawaPic(byte[] bytes) { var loader = new YanagisawaPicLoader(bytes); loader.extract(); var texture = new Texture2D(loader.width, loader.height, TextureFormat.ARGB32, false, false); texture.LoadRawTextureData(loader.bytesImageExtracted); return(texture); }