private static void TestTgaEncoderCore <TPixel>( TestImageProvider <TPixel> provider, TgaBitsPerPixel bitsPerPixel, TgaCompression compression = TgaCompression.None, bool useExactComparer = true, float compareTolerance = 0.01f) where TPixel : unmanaged, IPixel <TPixel> { using (Image <TPixel> image = provider.GetImage()) { var encoder = new TgaEncoder { BitsPerPixel = bitsPerPixel, Compression = compression }; using (var memStream = new MemoryStream()) { image.Save(memStream, encoder); memStream.Position = 0; using (var encodedImage = (Image <TPixel>)Image.Load(memStream)) { TgaTestUtils.CompareWithReferenceDecoder(provider, encodedImage, useExactComparer, compareTolerance); } } } }
/// <summary> /// Initializes a new instance of the <see cref="TgaEncoderCore"/> class. /// </summary> /// <param name="options">The encoder options.</param> /// <param name="memoryAllocator">The memory manager.</param> public TgaEncoderCore(ITgaEncoderOptions options, MemoryAllocator memoryAllocator) { this.memoryAllocator = memoryAllocator; this.bitsPerPixel = options.BitsPerPixel; this.compression = options.Compression; }