]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/jpeg/drew/TiffDataFormat.java
Version 19, May 2018
[GpsPrune.git] / tim / prune / jpeg / drew / TiffDataFormat.java
diff --git a/tim/prune/jpeg/drew/TiffDataFormat.java b/tim/prune/jpeg/drew/TiffDataFormat.java
new file mode 100644 (file)
index 0000000..6c89fc3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2002-2015 Drew Noakes
+ *
+ * More information about this project is available at:
+ *
+ *    https://drewnoakes.com/code/exif/
+ *    https://github.com/drewnoakes/metadata-extractor
+ */
+package tim.prune.jpeg.drew;
+
+/**
+ * An enumeration of data formats used by the TIFF specification.
+ *
+ * @author Drew Noakes https://drewnoakes.com
+ */
+public class TiffDataFormat
+{
+       public static final int CODE_INT8_U = 1;
+       public static final int CODE_STRING = 2;
+       public static final int CODE_INT16_U = 3;
+       public static final int CODE_INT32_U = 4;
+       public static final int CODE_RATIONAL_U = 5;
+       public static final int CODE_INT8_S = 6;
+       public static final int CODE_UNDEFINED = 7;
+       public static final int CODE_INT16_S = 8;
+       public static final int CODE_INT32_S = 9;
+       public static final int CODE_RATIONAL_S = 10;
+       public static final int CODE_SINGLE = 11;
+       public static final int CODE_DOUBLE = 12;
+
+       public static int getComponentSize(int tiffFormatCode)
+       {
+               switch (tiffFormatCode)
+               {
+                       case CODE_INT8_U:
+                       case CODE_STRING:
+                       case CODE_INT8_S:
+                       case CODE_UNDEFINED:
+                               return 1;
+                       case CODE_INT16_U:
+                       case CODE_INT16_S:
+                       case CODE_INT32_U:
+                       case CODE_INT32_S:
+                       case CODE_SINGLE:
+                               return 4;
+                       case CODE_RATIONAL_U:
+                       case CODE_RATIONAL_S:
+                       case CODE_DOUBLE:
+                               return 8;
+                       default:
+                               return 0;
+               }
+       }
+}