示例#1
0
 private void ExportBackgroundImage(string path)//导出参考图像参数
 {
     if (File.Exists(path))
     {
         Save.SaveImage imageInfo;
         Save.SaveBackgroundImageInfo(out imageInfo);
         var texture = Instantiate(objManager.imageBackground.GetComponent <Image>().mainTexture) as Texture2D;
         var s       = ObjManager.StringToFloat(imageInfo.scale);
         var a       = ObjManager.StringToFloat(imageInfo.alpha);
         var nt      = ObjManager.GetModifiedTexture2D(texture, (int)(s * texture.width), (int)(s * texture.height), a);
         var bytes   = nt.EncodeToPNG();
         File.WriteAllBytes(path, bytes);
     }
     else
     {
         Debug.Log("no such ExportBackgroundImage file!");
     }
 }