From a073a9a2d415692ee96df248f4d1282499835141 Mon Sep 17 00:00:00 2001 From: Andrew Wilkinson Date: Tue, 14 Mar 2017 20:59:31 +0000 Subject: [PATCH] Add a number of TIFF specific constants/enums --- .../Constants/TiffCompression.cs | 37 +++++++++++++++++ .../{ => Constants}/TiffConstants.cs | 0 .../Constants/TiffExtraSamples.cs | 19 +++++++++ .../Constants/TiffFillOrder.cs | 18 +++++++++ .../Constants/TiffNewSubfileType.cs | 31 ++++++++++++++ .../Constants/TiffOrientation.cs | 24 +++++++++++ .../TiffPhotometricInterpretation.cs | 40 +++++++++++++++++++ .../Constants/TiffPlanarConfiguration.cs | 18 +++++++++ .../Constants/TiffResolutionUnit.cs | 19 +++++++++ .../Constants/TiffSubfileType.cs | 19 +++++++++ .../{ => Constants}/TiffTags.cs | 0 .../Constants/TiffThreshholding.cs | 19 +++++++++ .../{ => Constants}/TiffType.cs | 0 13 files changed, 244 insertions(+) create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffCompression.cs rename src/ImageSharp.Formats.Tiff/{ => Constants}/TiffConstants.cs (100%) create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffExtraSamples.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffFillOrder.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffNewSubfileType.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffOrientation.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffPhotometricInterpretation.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffPlanarConfiguration.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffResolutionUnit.cs create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffSubfileType.cs rename src/ImageSharp.Formats.Tiff/{ => Constants}/TiffTags.cs (100%) create mode 100644 src/ImageSharp.Formats.Tiff/Constants/TiffThreshholding.cs rename src/ImageSharp.Formats.Tiff/{ => Constants}/TiffType.cs (100%) diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffCompression.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffCompression.cs new file mode 100644 index 0000000000..4caa7887db --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffCompression.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the compression formats defined by the Tiff file-format. + /// + internal enum TiffCompression + { + // TIFF baseline compression types + + None = 1, + Ccitt1D = 2, + PackBits = 32773, + + // TIFF Extension compression types + + CcittGroup3Fax = 3, + CcittGroup4Fax = 4, + Lzw = 5, + OldJpeg = 6, + + // Technote 2 + + Jpeg = 7, + Deflate = 8, + OldDeflate = 32946, + + // TIFF-F/FX Extension + + ItuTRecT82 = 9, + ItuTRecT43 = 10 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/TiffConstants.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffConstants.cs similarity index 100% rename from src/ImageSharp.Formats.Tiff/TiffConstants.cs rename to src/ImageSharp.Formats.Tiff/Constants/TiffConstants.cs diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffExtraSamples.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffExtraSamples.cs new file mode 100644 index 0000000000..4fa153fc54 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffExtraSamples.cs @@ -0,0 +1,19 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the possible uses of extra-samples in TIFF format files. + /// + internal enum TiffExtraSamples + { + // TIFF baseline ExtraSample values + + Unspecified = 0, + AssociatedAlpha = 1, + UnassociatedAlpha = 2 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffFillOrder.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffFillOrder.cs new file mode 100644 index 0000000000..e520599b43 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffFillOrder.cs @@ -0,0 +1,18 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the fill orders defined by the Tiff file-format. + /// + internal enum TiffFillOrder + { + // TIFF baseline FillOrder values + + MostSignificantBitFirst = 1, + LeastSignificantBitFirst = 2 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffNewSubfileType.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffNewSubfileType.cs new file mode 100644 index 0000000000..cf66d6d584 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffNewSubfileType.cs @@ -0,0 +1,31 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + using System; + + /// + /// Enumeration representing the sub-file types defined by the Tiff file-format. + /// + [Flags] + internal enum TiffNewSubfileType + { + // TIFF baseline subfile types + + FullImage = 0x0000, + Preview = 0x0001, + SinglePage = 0x0002, + TransparencyMask = 0x0004, + + // DNG Specification subfile types + + AlternativePreview = 0x10000, + + // TIFF-F/FX Specification subfile types + + MixedRasterContent = 0x0008 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffOrientation.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffOrientation.cs new file mode 100644 index 0000000000..4938a3f7f9 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffOrientation.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the image orientations defined by the Tiff file-format. + /// + internal enum TiffOrientation + { + /// TIFF baseline Orientation values + + TopLeft = 1, + TopRight = 2, + BottomRight = 3, + BottomLeft = 4, + LeftTop = 5, + RightTop = 6, + RightBottom = 7, + LeftBottom = 8 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffPhotometricInterpretation.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffPhotometricInterpretation.cs new file mode 100644 index 0000000000..0894c2dad1 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffPhotometricInterpretation.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the photometric interpretation formats defined by the Tiff file-format. + /// + internal enum TiffPhotometricInterpretation + { + // TIFF baseline color spaces + + WhiteIsZero = 0, + BlackIsZero = 1, + Rgb = 2, + PaletteColor = 3, + TransparencyMask = 4, + + // TIFF Extension color spaces + + Separated = 5, + YCbCr = 6, + CieLab = 8, + + // TIFF TechNote 1 + + IccLab = 9, + + // TIFF-F/FX Specification + + ItuLab = 10, + + // DNG Specification + + ColorFilterArray = 32803, + LinearRaw = 34892 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffPlanarConfiguration.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffPlanarConfiguration.cs new file mode 100644 index 0000000000..0c9e08302a --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffPlanarConfiguration.cs @@ -0,0 +1,18 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the planar configuration types defined by the Tiff file-format. + /// + internal enum TiffPlanarConfiguration + { + // TIFF baseline PlanarConfiguration values + + Chunky = 1, + Planar = 2 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffResolutionUnit.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffResolutionUnit.cs new file mode 100644 index 0000000000..9275a79fb2 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffResolutionUnit.cs @@ -0,0 +1,19 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the resolution units defined by the Tiff file-format. + /// + internal enum TiffResolutionUnit + { + // TIFF baseline ResolutionUnit values + + None = 1, + Inch = 2, + Centimeter = 2 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffSubfileType.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffSubfileType.cs new file mode 100644 index 0000000000..0b256f0317 --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffSubfileType.cs @@ -0,0 +1,19 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the sub-file types defined by the Tiff file-format. + /// + internal enum TiffSubfileType + { + // TIFF baseline subfile types + + FullImage = 1, + Preview = 2, + SinglePage = 3 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/TiffTags.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffTags.cs similarity index 100% rename from src/ImageSharp.Formats.Tiff/TiffTags.cs rename to src/ImageSharp.Formats.Tiff/Constants/TiffTags.cs diff --git a/src/ImageSharp.Formats.Tiff/Constants/TiffThreshholding.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffThreshholding.cs new file mode 100644 index 0000000000..237b8419bd --- /dev/null +++ b/src/ImageSharp.Formats.Tiff/Constants/TiffThreshholding.cs @@ -0,0 +1,19 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp.Formats +{ + /// + /// Enumeration representing the threshholding types defined by the Tiff file-format. + /// + internal enum TiffThreshholding + { + /// TIFF baseline Threshholding values + + None = 1, + Ordered = 2, + Random = 3 + } +} \ No newline at end of file diff --git a/src/ImageSharp.Formats.Tiff/TiffType.cs b/src/ImageSharp.Formats.Tiff/Constants/TiffType.cs similarity index 100% rename from src/ImageSharp.Formats.Tiff/TiffType.cs rename to src/ImageSharp.Formats.Tiff/Constants/TiffType.cs