View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.imaging.formats.psd;
18  
19  /**
20   * TODO Turn into an enum
21   *
22   * @see <a href="http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727">Photoshop File Formats Specification - Image Resource IDs</a>
23   */
24  class ImageResourceType {
25  
26      private static final ImageResourceType[] TYPES = new ImageResourceType[]{
27              new ImageResourceType(1000, "Number of channels, rows, columns, depth, and mode."),
28              new ImageResourceType(1001, "Optional. Macintosh print manager print info record"),
29              new ImageResourceType(1003, "Indexed color table."),
30              new ImageResourceType(1005, "ResolutionInfo structure"),
31              new ImageResourceType(1006, "Names of the alpha channels as a series of Pascal strings."),
32              new ImageResourceType(1007, "DisplayInfo structure"),
33              new ImageResourceType(1008, "Optional. The caption as a Pascal string."),
34              new ImageResourceType(1009, "Border information"),
35              new ImageResourceType(1010, "Background color"),
36              new ImageResourceType(1011, "Print flags (labels, crop marks, color bars, registration marks, negative, flip, interpolate, caption)"),
37              new ImageResourceType(1012, "Grayscale and multichannel halftoning information."),
38              new ImageResourceType(1013, "Color halftoning information"),
39              new ImageResourceType(1014, "Duotone halftoning information"),
40              new ImageResourceType(1015, "Grayscale and multichannel transfer function"),
41              new ImageResourceType(1016, "Color transfer functions"),
42              new ImageResourceType(1017, "Duotone transfer functions"),
43              new ImageResourceType(1018, "Duotone image information"),
44              new ImageResourceType(1019, "Effective black and white values for the dot range."),
45              new ImageResourceType(1020, "Obsolete"),
46              new ImageResourceType(1021, "EPS options"),
47              new ImageResourceType(1022, "Quick Mask information"),
48              new ImageResourceType(1023, "Obsolete"),
49              new ImageResourceType(1024, "Layer state information"),
50              new ImageResourceType(1025, "Working path (not saved)"),
51              new ImageResourceType(1026, "Layers group information"),
52              new ImageResourceType(1027, "Obsolete"),
53              new ImageResourceType(1028, "IPTC-NAA record"),
54              new ImageResourceType(1029, "Image mode for raw format files"),
55              new ImageResourceType(1030, "JPEG quality"),
56              new ImageResourceType(1032, "Grid and guides information"),
57              new ImageResourceType(1033, "Thumbnail resource"),
58              new ImageResourceType(1034, "Copyright flag"),
59              new ImageResourceType(1035, "URL"),
60              new ImageResourceType(1036, "Thumbnail resource"),
61              new ImageResourceType(1037, "Global lighting angle for effects layer"),
62              new ImageResourceType(1038, "Color samplers resource"),
63              new ImageResourceType(1039, "ICC Profile"),
64              new ImageResourceType(1040, "Watermark"),
65              new ImageResourceType(1041, "ICC Untagged. Disables any assumed profile handling when opening the file"),
66              new ImageResourceType(1042, "Effects visible. global flag to show/hide all the effects layer. Only present when they are hidden."),
67              new ImageResourceType(1043, "Spot Halftone"),
68              new ImageResourceType(1044, "Document specific IDs"),
69              new ImageResourceType(1045, "Unicode Alpha Names"),
70              new ImageResourceType(1046, "Indexed Color Table Count. Number of colors in table that are actually defined"),
71              new ImageResourceType(1047, "Transparency Index. Index of transparent color, if any"),
72              new ImageResourceType(1049, "Global Altitude"),
73              new ImageResourceType(1050, "Slices"),
74              new ImageResourceType(1051, "Workflow URL"),
75              new ImageResourceType(1052, "Jump To XPEP"),
76              new ImageResourceType(1053, "Alpha Identifiers"),
77              new ImageResourceType(1054, "URL List"),
78              new ImageResourceType(1057, "Version Info"),
79              new ImageResourceType(1058, "EXIF data 1"),
80              new ImageResourceType(1059, "EXIF data 3"),
81              new ImageResourceType(1060, "XMP metadata"),
82              new ImageResourceType(1061, "Caption digest"),
83              new ImageResourceType(1062, "Print scale"),
84              new ImageResourceType(1064, "Pixel Aspect Ratio"),
85              new ImageResourceType(1065, "Layer Comps"),
86              new ImageResourceType(1066, "Alternate Duotone Colors"),
87              new ImageResourceType(1067, "Alternate Spot Colors"),
88              new ImageResourceType(1069, "Layer Selection ID(s)"),
89              new ImageResourceType(1070, "HDR Toning information"),
90              new ImageResourceType(1071, "Print info"),
91              new ImageResourceType(1072, "Layer Group(s) Enabled ID"),
92              new ImageResourceType(1073, "Color samplers resource"),
93              new ImageResourceType(1074, "Measurement Scale"),
94              new ImageResourceType(1075, "Timeline Information"),
95              new ImageResourceType(1076, "Sheet Disclosure"),
96              new ImageResourceType(1077, "DisplayInfo structure to support floating point colors"),
97              new ImageResourceType(1078, "Onion Skins"),
98              new ImageResourceType(1080, "Count Information. Information about the count in the document."),
99              new ImageResourceType(1082, "Print Information. Information about the current print settings in the document. The color management options."),
100             new ImageResourceType(1083, "Print Style. Information about the current print style in the document. The printing marks, labels, ornaments, etc."),
101             new ImageResourceType(1084, "Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo."),
102             new ImageResourceType(1085, "Windows DEVMODE. Variable OS specific info for Windows. DEVMODE."),
103             new ImageResourceType(1086, "Auto Save File Path"),
104             new ImageResourceType(1087, "Auto Save Format"),
105             new ImageResourceType(1088, "Path Selection State. Information about the current path selection state"),
106             new ImageResourceType(2000, 2998, "Path Information (saved paths)."),
107             new ImageResourceType(2999, "Name of clipping path"),
108             new ImageResourceType(3000, "Origin Path Info"),
109             new ImageResourceType(4000, 4999, "Plug-In resource(s). Resources added by a plug-in"),
110             new ImageResourceType(7000, "Image Ready variables. XML representation of variables definition"),
111             new ImageResourceType(7001, "Image Ready data sets"),
112             new ImageResourceType(8000, "Lightroom workflow, if present the document is in the middle of a Lightroom workflow"),
113             new ImageResourceType(10000, "Print flags information (center crop marks, bleed width value, bleed width scale)")
114     };
115 
116     public static String getDescription(final int id) {
117         for (final ImageResourceType type : TYPES) {
118             if (type.from <= id && id <= type.to) {
119                 return type.description;
120             }
121         }
122         return "Unknown";
123     }
124 
125     public final int from;
126     public final int to;
127 
128     public final String description;
129 
130     public ImageResourceType(final int id, final String description) {
131         this.from = id;
132         this.to = id;
133         this.description = description;
134     }
135 
136     public ImageResourceType(final int id, final int id2, final String description) {
137         this.from = id;
138         this.to = id2;
139         this.description = description;
140     }
141 }