|
|
|
@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(TgaBitsPerPixelFiles))] |
|
|
|
public void Encode_PreserveBitsPerPixel(string imagePath, TgaBitsPerPixel bmpBitsPerPixel) |
|
|
|
public void TgaEncoder_PreserveBitsPerPixel(string imagePath, TgaBitsPerPixel bmpBitsPerPixel) |
|
|
|
{ |
|
|
|
var options = new TgaEncoder(); |
|
|
|
|
|
|
|
@ -55,7 +55,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[MemberData(nameof(TgaBitsPerPixelFiles))] |
|
|
|
public void Encode_WithCompression_PreserveBitsPerPixel(string imagePath, TgaBitsPerPixel bmpBitsPerPixel) |
|
|
|
public void TgaEncoder_WithCompression_PreserveBitsPerPixel(string imagePath, TgaBitsPerPixel bmpBitsPerPixel) |
|
|
|
{ |
|
|
|
var options = new TgaEncoder() |
|
|
|
{ |
|
|
|
@ -80,52 +80,52 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit8_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel8) |
|
|
|
public void TgaEncoder_Bit8_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel8) |
|
|
|
|
|
|
|
// Using tolerant comparer here. The results from magick differ slightly. Maybe a different ToGrey method is used. The image looks otherwise ok.
|
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.None, useExactComparer: false, compareTolerance: 0.03f); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit16_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel16) |
|
|
|
public void TgaEncoder_Bit16_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel16) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.None, useExactComparer: false); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit24_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel24) |
|
|
|
public void TgaEncoder_Bit24_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel24) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.None); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit32_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel32) |
|
|
|
public void TgaEncoder_Bit32_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel32) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.None); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit8_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel8) |
|
|
|
public void TgaEncoder_Bit8_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel8) |
|
|
|
|
|
|
|
// Using tolerant comparer here. The results from magick differ slightly. Maybe a different ToGrey method is used. The image looks otherwise ok.
|
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.RunLength, useExactComparer: false, compareTolerance: 0.03f); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit16_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel16) |
|
|
|
public void TgaEncoder_Bit16_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel16) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.RunLength, useExactComparer: false); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit24_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel24) |
|
|
|
public void TgaEncoder_Bit24_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel24) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.RunLength); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32)] |
|
|
|
public void Encode_Bit32_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel32) |
|
|
|
public void TgaEncoder_Bit32_WithRunLengthEncoding_Works<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel = TgaBitsPerPixel.Pixel32) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTgaEncoderCore(provider, bitsPerPixel, TgaCompression.RunLength); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(Bit32, PixelTypes.Rgba32, TgaBitsPerPixel.Pixel32)] |
|
|
|
[WithFile(Bit24, PixelTypes.Rgba32, TgaBitsPerPixel.Pixel24)] |
|
|
|
public void Encode_WorksWithDiscontiguousBuffers<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel) |
|
|
|
public void TgaEncoder_WorksWithDiscontiguousBuffers<TPixel>(TestImageProvider<TPixel> provider, TgaBitsPerPixel bitsPerPixel) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100); |
|
|
|
|