Browse Source

Fix compression namespace

pull/1457/head
Brian Popow 6 years ago
parent
commit
a124685c9b
  1. 2
      src/ImageSharp/Formats/Tiff/Compression/DeflateTiffCompression.cs
  2. 2
      src/ImageSharp/Formats/Tiff/Compression/LzwTiffCompression.cs
  3. 2
      src/ImageSharp/Formats/Tiff/Compression/NoneTiffCompression.cs
  4. 2
      src/ImageSharp/Formats/Tiff/Compression/PackBitsTiffCompression.cs
  5. 2
      src/ImageSharp/Formats/Tiff/Compression/TiffBaseCompression.cs
  6. 17
      src/ImageSharp/Formats/Tiff/Compression/TiffCompressionFactory.cs
  7. 6
      src/ImageSharp/Formats/Tiff/Compression/TiffDecoderCompressionType.cs
  8. 4
      src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
  9. 13
      src/ImageSharp/Formats/Tiff/TiffDecoderHelpers.cs
  10. 5
      tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs
  11. 1
      tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs
  12. 2
      tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs
  13. 1
      tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs

2
src/ImageSharp/Formats/Tiff/Compression/DeflateTiffCompression.cs

@ -6,7 +6,7 @@ using System.IO;
using System.IO.Compression;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
/// <summary>
/// Class to handle cases where TIFF image data is compressed using Deflate compression.

2
src/ImageSharp/Formats/Tiff/Compression/LzwTiffCompression.cs

@ -5,7 +5,7 @@ using System;
using System.IO;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
/// <summary>
/// Class to handle cases where TIFF image data is compressed using LZW compression.

2
src/ImageSharp/Formats/Tiff/Compression/NoneTiffCompression.cs

@ -5,7 +5,7 @@ using System;
using System.IO;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
/// <summary>
/// Class to handle cases where TIFF image data is not compressed.

2
src/ImageSharp/Formats/Tiff/Compression/PackBitsTiffCompression.cs

@ -6,7 +6,7 @@ using System.Buffers;
using System.IO;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
/// <summary>
/// Class to handle cases where TIFF image data is compressed using PackBits compression.

2
src/ImageSharp/Formats/Tiff/Compression/TiffBaseCompression.cs

@ -5,7 +5,7 @@ using System;
using System.IO;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
/// <summary>
/// Base tiff decompressor class.

17
src/ImageSharp/Formats/Tiff/Compression/TiffCompressionFactory.cs

@ -1,28 +1,27 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
internal static class TiffCompressionFactory
{
public static TiffBaseCompression Create(TiffCompressionType compressionType, MemoryAllocator allocator, TiffPhotometricInterpretation photometricInterpretation, int width)
public static TiffBaseCompression Create(TiffDecoderCompressionType compressionType, MemoryAllocator allocator, TiffPhotometricInterpretation photometricInterpretation, int width)
{
switch (compressionType)
{
case TiffCompressionType.None:
case TiffDecoderCompressionType.None:
return new NoneTiffCompression(allocator);
case TiffCompressionType.PackBits:
case TiffDecoderCompressionType.PackBits:
return new PackBitsTiffCompression(allocator);
case TiffCompressionType.Deflate:
case TiffDecoderCompressionType.Deflate:
return new DeflateTiffCompression(allocator);
case TiffCompressionType.Lzw:
case TiffDecoderCompressionType.Lzw:
return new LzwTiffCompression(allocator);
case TiffCompressionType.T4:
case TiffDecoderCompressionType.T4:
return new T4TiffCompression(allocator, photometricInterpretation, width);
case TiffCompressionType.HuffmanRle:
case TiffDecoderCompressionType.HuffmanRle:
return new ModifiedHuffmanTiffCompression(allocator, photometricInterpretation, width);
default:
throw TiffThrowHelper.NotSupportedCompression(nameof(compressionType));

6
src/ImageSharp/Formats/Tiff/Compression/TiffCompressionType.cs → src/ImageSharp/Formats/Tiff/Compression/TiffDecoderCompressionType.cs

@ -1,12 +1,12 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.Formats.Tiff
namespace SixLabors.ImageSharp.Formats.Tiff.Compression
{
/// <summary>
/// Provides enumeration of the various TIFF compression types.
/// Provides enumeration of the various TIFF compression types the decoder can handle.
/// </summary>
internal enum TiffCompressionType
internal enum TiffDecoderCompressionType
{
/// <summary>
/// Image data is stored uncompressed in the TIFF file.

4
src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs

@ -5,6 +5,8 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using SixLabors.ImageSharp.IO;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Metadata;
@ -80,7 +82,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff
/// <summary>
/// Gets or sets the compression implementation to use when decoding the image.
/// </summary>
public TiffCompressionType CompressionType { get; set; }
public TiffDecoderCompressionType CompressionType { get; set; }
/// <summary>
/// Gets or sets the planar configuration type to use when decoding the image.

13
src/ImageSharp/Formats/Tiff/TiffDecoderHelpers.cs

@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.Metadata.Profiles.Icc;
@ -323,38 +324,38 @@ namespace SixLabors.ImageSharp.Formats.Tiff
{
case TiffCompression.None:
{
options.CompressionType = TiffCompressionType.None;
options.CompressionType = TiffDecoderCompressionType.None;
break;
}
case TiffCompression.PackBits:
{
options.CompressionType = TiffCompressionType.PackBits;
options.CompressionType = TiffDecoderCompressionType.PackBits;
break;
}
case TiffCompression.Deflate:
case TiffCompression.OldDeflate:
{
options.CompressionType = TiffCompressionType.Deflate;
options.CompressionType = TiffDecoderCompressionType.Deflate;
break;
}
case TiffCompression.Lzw:
{
options.CompressionType = TiffCompressionType.Lzw;
options.CompressionType = TiffDecoderCompressionType.Lzw;
break;
}
case TiffCompression.CcittGroup3Fax:
{
options.CompressionType = TiffCompressionType.T4;
options.CompressionType = TiffDecoderCompressionType.T4;
break;
}
case TiffCompression.Ccitt1D:
{
options.CompressionType = TiffCompressionType.HuffmanRle;
options.CompressionType = TiffDecoderCompressionType.HuffmanRle;
break;
}

5
tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs

@ -3,8 +3,7 @@
using System.IO;
using SixLabors.ImageSharp.Formats.Png.Zlib;
using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Formats.Tiff
@ -22,7 +21,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
{
using (Stream stream = CreateCompressedStream(data))
{
byte[] buffer = new byte[data.Length];
var buffer = new byte[data.Length];
new DeflateTiffCompression(null).Decompress(stream, (int)stream.Length, buffer);

1
tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs

@ -3,6 +3,7 @@
using System.IO;
using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Formats.Tiff

2
tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System.IO;
using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Formats.Tiff

1
tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs

@ -3,6 +3,7 @@
using System.IO;
using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Formats.Tiff.Compression;
using SixLabors.ImageSharp.Memory;
using Xunit;

Loading…
Cancel
Save