public static void CompareWithSmall(DllImageData image, Color.Channel channels) { var tex = new TextureArray2D(image); var colors = tex.GetPixelColors(LayerMipmapSlice.Mip0); CompareWithSmall(colors, channels); }
public static void CompareWithSmall(Image image, Color.Channel channels) { var tex = new TextureArray2D(image); var colors = tex.GetPixelColors(0, 0); CompareWithSmall(colors, channels); }
public static void CompareWithSmall(Color[] colors, Color.Channel channels) { Assert.AreEqual(smallData.Length, colors.Length); for (int i = 0; i < colors.Length; ++i) { Assert.IsTrue(colors[i].Equals(smallData[i], channels, 0.02f)); // high tolerance because of jpg compression } }
public static void CompareColors(Color[] reference, Color[] right, Color.Channel channels = Color.Channel.Rgb, float tolerance = 0.01f) { Assert.AreEqual(reference.Length, right.Length); for (int i = 0; i < reference.Length; ++i) { Assert.IsTrue(reference[i].Equals(right[i], channels, tolerance)); } }
public void VerifySmallHdr(DllImageData image, Color.Channel channels) { Assert.AreEqual(1, image.LayerMipmap.Mipmaps); Assert.AreEqual(1, image.LayerMipmap.Layers); Assert.AreEqual(3, image.Size.Width); Assert.AreEqual(3, image.Size.Height); Assert.AreEqual(Format.R32G32B32A32_Float, image.Format.DxgiFormat); TestData.CompareWithSmall(image, channels); }
private void VerifySmallLdr(DllImageData image, Color.Channel channels) { Assert.AreEqual(1, image.LayerMipmap.Mipmaps); Assert.AreEqual(1, image.LayerMipmap.Layers); Assert.AreEqual(3, image.Size.Width); Assert.AreEqual(3, image.Size.Height); Assert.AreEqual(Format.R8G8B8A8_UNorm_SRgb, image.Format.DxgiFormat); TestData.CompareWithSmall(image, channels); }
public void VerifySmallHdr(Image image, Color.Channel channels) { Assert.AreEqual(1, image.NumMipmaps); Assert.AreEqual(1, image.NumLayers); Assert.AreEqual(3, image.GetSize(0).Width); Assert.AreEqual(3, image.GetSize(0).Height); Assert.AreEqual(Format.R32G32B32A32_Float, image.Format.DxgiFormat); TestData.CompareWithSmall(image, channels); }
private void VerifySmallLdr(Image image, Color.Channel channels) { Assert.AreEqual(1, image.NumMipmaps); Assert.AreEqual(1, image.NumLayers); Assert.AreEqual(3, image.GetSize(0).Width); Assert.AreEqual(3, image.GetSize(0).Height); Assert.AreEqual(Format.R8G8B8A8_UNorm_SRgb, image.Format.DxgiFormat); TestData.CompareWithSmall(image, channels); }
private void CompareAfterExport(string inputImage, string outputImage, string outputExtension, GliFormat format, Color.Channel channels = Color.Channel.Rgb, float tolerance = 0.01f) { var model = new Models(1); model.AddImageFromFile(inputImage); model.Apply(); var origTex = (TextureArray2D)model.Pipelines[0].Image; model.Export.Export(new ExportDescription(origTex, outputImage, outputExtension) { FileFormat = format, Quality = 100 }); var expTex = new TextureArray2D(IO.LoadImage(outputImage + "." + outputExtension)); foreach (var lm in origTex.LayerMipmap.Range) { var origColors = origTex.GetPixelColors(lm); var expColor = expTex.GetPixelColors(lm); TestData.CompareColors(origColors, expColor, channels, tolerance); } }
private void CompareAfterExport(string inputImage, string outputImage, string outputExtension, GliFormat format, Color.Channel channels = Color.Channel.Rgb, float tolerance = 0.01f) { var model = new Models(1); model.AddImageFromFile(inputImage); model.Apply(); var origTex = (TextureArray2D)model.Pipelines[0].Image; model.Export.Quality = 100; model.Export.Export(origTex, new ExportDescription(outputImage, outputExtension, model.Export) { FileFormat = format }); var expTex = new TextureArray2D(IO.LoadImage(outputImage + "." + outputExtension)); for (int curLayer = 0; curLayer < origTex.NumLayers; ++curLayer) { for (int curMipmap = 0; curMipmap < origTex.NumMipmaps; ++curMipmap) { var origColors = origTex.GetPixelColors(curLayer, curMipmap); var expColor = expTex.GetPixelColors(curLayer, curMipmap); TestData.CompareColors(origColors, expColor, channels, tolerance); } } }