/// <summary> /// Loads image from a path with texTool /// </summary> /// <param name="texTool">A tool for loading an image</param> /// <param name="sourcePath">Source path of an image</param> /// <param name="isSRgb">Indicate if the texture to load is sRGB</param> /// <returns></returns> private static Image LoadImage(TextureTool texTool, UFile sourcePath, bool isSRgb) { using (var texImage = texTool.Load(sourcePath, isSRgb)) { texTool.Decompress(texImage, isSRgb); if (texImage.Format == PixelFormat.B8G8R8A8_UNorm || texImage.Format == PixelFormat.B8G8R8A8_UNorm_SRgb) { texTool.SwitchChannel(texImage); } return(texTool.ConvertToXenkoImage(texImage)); } }
public void SwitchChannelTest(string file) { var image = texTool.Load(TestTools.InputTestFolder + file); var isInBgraOrder = image.Format.IsBGRAOrder(); texTool.SwitchChannel(image); image.Update(); Assert.IsTrue(isInBgraOrder != image.Format.IsBGRAOrder()); Assert.IsTrue(TestTools.ComputeSHA1(image.Data, image.DataSize).Equals(TestTools.GetInstance().Checksum["TextureTool_SwitchChannel_" + image.Name])); //Console.WriteLine("TextureTool_SwitchChannel_" + image.Name + "." + TestTools.ComputeSHA1(image.Data, image.DataSize)); image.Dispose(); }
private Image LoadImage(TextureTool texTool, UFile sourcePath) { using (var texImage = texTool.Load(sourcePath, false)) { // Decompresses the specified texImage texTool.Decompress(texImage, false); if (texImage.Format == PixelFormat.B8G8R8A8_UNorm) { texTool.SwitchChannel(texImage); } return(texTool.ConvertToStrideImage(texImage)); } }