]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/jpeg/drew/TiffDataFormat.java
Version 19, May 2018
[GpsPrune.git] / tim / prune / jpeg / drew / TiffDataFormat.java
1 /*
2  * Copyright 2002-2015 Drew Noakes
3  *
4  * More information about this project is available at:
5  *
6  *    https://drewnoakes.com/code/exif/
7  *    https://github.com/drewnoakes/metadata-extractor
8  */
9 package tim.prune.jpeg.drew;
10
11 /**
12  * An enumeration of data formats used by the TIFF specification.
13  *
14  * @author Drew Noakes https://drewnoakes.com
15  */
16 public class TiffDataFormat
17 {
18         public static final int CODE_INT8_U = 1;
19         public static final int CODE_STRING = 2;
20         public static final int CODE_INT16_U = 3;
21         public static final int CODE_INT32_U = 4;
22         public static final int CODE_RATIONAL_U = 5;
23         public static final int CODE_INT8_S = 6;
24         public static final int CODE_UNDEFINED = 7;
25         public static final int CODE_INT16_S = 8;
26         public static final int CODE_INT32_S = 9;
27         public static final int CODE_RATIONAL_S = 10;
28         public static final int CODE_SINGLE = 11;
29         public static final int CODE_DOUBLE = 12;
30
31         public static int getComponentSize(int tiffFormatCode)
32         {
33                 switch (tiffFormatCode)
34                 {
35                         case CODE_INT8_U:
36                         case CODE_STRING:
37                         case CODE_INT8_S:
38                         case CODE_UNDEFINED:
39                                 return 1;
40                         case CODE_INT16_U:
41                         case CODE_INT16_S:
42                         case CODE_INT32_U:
43                         case CODE_INT32_S:
44                         case CODE_SINGLE:
45                                 return 4;
46                         case CODE_RATIONAL_U:
47                         case CODE_RATIONAL_S:
48                         case CODE_DOUBLE:
49                                 return 8;
50                         default:
51                                 return 0;
52                 }
53         }
54 }