diff --git a/Assets/Tests/Raindrop/ImagingTests/ImagingTests.cs b/Assets/Tests/Raindrop/ImagingTests/ImagingTests.cs index 5643a95..42d8be7 100644 --- a/Assets/Tests/Raindrop/ImagingTests/ImagingTests.cs +++ b/Assets/Tests/Raindrop/ImagingTests/ImagingTests.cs @@ -73,65 +73,64 @@ namespace Tests.Raindrop Debug.Log($"took time to read jp2, convert to jpg, and save : {(timeEnd - timeStart).ToString()} "); Debug.Log($"read : in StreamingAssets, - {_inputImageSubPath} "); - - - - // [UnityTest] - // // managedimage -> texture2d -> managed image test - // /* 1. create managedimage 2x2 red-blue-green- black image by code. - // * 2. call convert to texture2d. - // * 3. print to screen. - // * 4. convert back to managed image. - // * 5. print to disk. - // */ //weird ass test - // public IEnumerator ManagedImage_Texture2D_conversions() - // { - // //1 load the image using unity's texture 2d (known to be correct.). - // var tex = new Texture2D(1024,1024); - // var b = File.ReadAllBytes("C:\\Users\\Alexis\\Pictures\\menhara.jpg"); - // tex.LoadImage(b); - // // OpenMetaverse.Imaging.LoadTGAClass.LoadTGA( - // // "C:\\Users\\Alexis\\Pictures\\menhara.tga"); - // - // - // - // //1b. check image loading integrity. - // // var bytesa = tex.EncodeToJPG(100); - // // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "menhara_from_t2d.jpg"), bytesa); - // // mi.Blue[2] = 0xFF; - // // mi.Red[0] = 0xFF; - // // mi.Green[1] = 0xFF; - // // // mi.Blue = new byte[]{0x00,0x00,0xFF,0x00}; - // // mi.Red = new byte[]{0xFF,0x00,0x00,0x00}; - // // mi.Green = new byte[]{0x00,0xFF,0x00,0x00}; - // - // //2 print mi to disk in some easy to read format. - // // error! this image is written to disk upside down!. - // ManagedImage mi = new ManagedImage(tex); - // var tgaBytes = mi.ExportTGA(); - // Debug.Log("writing to "+ Path.Combine(Application.persistentDataPath, "exportTGA_managed_image1.tga").ToString()); - // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "exportTGA_managed_image1.tga"), tgaBytes); - // - // //3. convert to t2d and show on screen. - // Texture2D t2d = mi.ExportTex2D(); - // // plane.make - // // plane.show(t2d) - // - // var bytes = t2d.EncodeToJPG(100); - // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "EncodeToJPG_Texture2d.jpg"), bytes); - // - // yield return new WaitForSeconds(1); - // - // //4. convert back to tga, save it as a 2nd file. - // ManagedImage mi2 = new ManagedImage(t2d); - // // error:this method writes a up-side down image. - // var tgaBytes2 = mi2.ExportTGA(); - // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "exportTGA_managedimage2.tga"), tgaBytes2); - // - // Assert.Pass(); - // yield break; - // } - } + + + // [UnityTest] + // // managedimage -> texture2d -> managed image test + // /* 1. create managedimage 2x2 red-blue-green- black image by code. + // * 2. call convert to texture2d. + // * 3. print to screen. + // * 4. convert back to managed image. + // * 5. print to disk. + // */ //weird ass test + // public IEnumerator ManagedImage_Texture2D_conversions() + // { + // //1 load the image using unity's texture 2d (known to be correct.). + // var tex = new Texture2D(1024,1024); + // var b = File.ReadAllBytes("C:\\Users\\Alexis\\Pictures\\menhara.jpg"); + // tex.LoadImage(b); + // // OpenMetaverse.Imaging.LoadTGAClass.LoadTGA( + // // "C:\\Users\\Alexis\\Pictures\\menhara.tga"); + // + // + // + // //1b. check image loading integrity. + // // var bytesa = tex.EncodeToJPG(100); + // // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "menhara_from_t2d.jpg"), bytesa); + // // mi.Blue[2] = 0xFF; + // // mi.Red[0] = 0xFF; + // // mi.Green[1] = 0xFF; + // // // mi.Blue = new byte[]{0x00,0x00,0xFF,0x00}; + // // mi.Red = new byte[]{0xFF,0x00,0x00,0x00}; + // // mi.Green = new byte[]{0x00,0xFF,0x00,0x00}; + // + // //2 print mi to disk in some easy to read format. + // // error! this image is written to disk upside down!. + // ManagedImage mi = new ManagedImage(tex); + // var tgaBytes = mi.ExportTGA(); + // Debug.Log("writing to "+ Path.Combine(Application.persistentDataPath, "exportTGA_managed_image1.tga").ToString()); + // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "exportTGA_managed_image1.tga"), tgaBytes); + // + // //3. convert to t2d and show on screen. + // Texture2D t2d = mi.ExportTex2D(); + // // plane.make + // // plane.show(t2d) + // + // var bytes = t2d.EncodeToJPG(100); + // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "EncodeToJPG_Texture2d.jpg"), bytes); + // + // yield return new WaitForSeconds(1); + // + // //4. convert back to tga, save it as a 2nd file. + // ManagedImage mi2 = new ManagedImage(t2d); + // // error:this method writes a up-side down image. + // var tgaBytes2 = mi2.ExportTGA(); + // System.IO.File.WriteAllBytes(Path.Combine(Application.persistentDataPath, "exportTGA_managedimage2.tga"), tgaBytes2); + // + // Assert.Pass(); + // yield break; + // } + } } \ No newline at end of file