source: josm/trunk/src/com/drew/metadata/exif/makernotes/KodakMakernoteDescriptor.java@ 8132

Last change on this file since 8132 was 8132, checked in by Don-vip, 11 years ago

fix #11162 - update to metadata-extractor 2.7.2

File size: 4.6 KB
Line 
1/*
2 * Copyright 2002-2015 Drew Noakes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21package com.drew.metadata.exif.makernotes;
22
23import com.drew.lang.annotations.NotNull;
24import com.drew.lang.annotations.Nullable;
25import com.drew.metadata.TagDescriptor;
26
27import static com.drew.metadata.exif.makernotes.KodakMakernoteDirectory.*;
28
29/**
30 * Provides human-readable string representations of tag values stored in a {@link KodakMakernoteDirectory}.
31 *
32 * @author Drew Noakes https://drewnoakes.com
33 */
34public class KodakMakernoteDescriptor extends TagDescriptor<KodakMakernoteDirectory>
35{
36 public KodakMakernoteDescriptor(@NotNull KodakMakernoteDirectory directory)
37 {
38 super(directory);
39 }
40
41 @Override
42 @Nullable
43 public String getDescription(int tagType)
44 {
45 switch (tagType) {
46 case TAG_QUALITY:
47 return getQualityDescription();
48 case TAG_BURST_MODE:
49 return getBurstModeDescription();
50 case TAG_SHUTTER_MODE:
51 return getShutterModeDescription();
52 case TAG_FOCUS_MODE:
53 return getFocusModeDescription();
54 case TAG_WHITE_BALANCE:
55 return getWhiteBalanceDescription();
56 case TAG_FLASH_MODE:
57 return getFlashModeDescription();
58 case TAG_FLASH_FIRED:
59 return getFlashFiredDescription();
60 case TAG_COLOR_MODE:
61 return getColorModeDescription();
62 case TAG_SHARPNESS:
63 return getSharpnessDescription();
64 default:
65 return super.getDescription(tagType);
66 }
67 }
68
69 @Nullable
70 public String getSharpnessDescription()
71 {
72 return getIndexedDescription(TAG_SHARPNESS, "Normal");
73 }
74
75 @Nullable
76 public String getColorModeDescription()
77 {
78 Integer value = _directory.getInteger(TAG_COLOR_MODE);
79 if (value == null)
80 return null;
81 switch (value) {
82 case 0x001: case 0x2000: return "B&W";
83 case 0x002: case 0x4000: return "Sepia";
84 case 0x003: return "B&W Yellow Filter";
85 case 0x004: return "B&W Red Filter";
86 case 0x020: return "Saturated Color";
87 case 0x040: case 0x200: return "Neutral Color";
88 case 0x100: return "Saturated Color";
89 default: return "Unknown (" + value + ")";
90 }
91 }
92
93 @Nullable
94 public String getFlashFiredDescription()
95 {
96 return getIndexedDescription(TAG_FLASH_FIRED, "No", "Yes");
97 }
98
99 @Nullable
100 public String getFlashModeDescription()
101 {
102 Integer value = _directory.getInteger(TAG_FLASH_MODE);
103 if (value == null)
104 return null;
105 switch (value) {
106 case 0x00: return "Auto";
107 case 0x10: case 0x01: return "Fill Flash";
108 case 0x20: case 0x02: return "Off";
109 case 0x40: case 0x03: return "Red Eye";
110 default: return "Unknown (" + value + ")";
111 }
112 }
113
114 @Nullable
115 public String getWhiteBalanceDescription()
116 {
117 return getIndexedDescription(TAG_WHITE_BALANCE, "Auto", "Flash", "Tungsten", "Daylight");
118 }
119
120 @Nullable
121 public String getFocusModeDescription()
122 {
123 return getIndexedDescription(TAG_FOCUS_MODE, "Normal", null, "Macro");
124 }
125
126 @Nullable
127 public String getShutterModeDescription()
128 {
129 Integer value = _directory.getInteger(TAG_SHUTTER_MODE);
130 if (value == null)
131 return null;
132 switch (value) {
133 case 0: return "Auto";
134 case 8: return "Aperture Priority";
135 case 32: return "Manual";
136 default: return "Unknown (" + value + ")";
137 }
138 }
139
140 @Nullable
141 public String getBurstModeDescription()
142 {
143 return getIndexedDescription(TAG_BURST_MODE, "Off", "On");
144 }
145
146 @Nullable
147 public String getQualityDescription()
148 {
149 return getIndexedDescription(TAG_QUALITY, 1, "Fine", "Normal");
150 }
151}
Note: See TracBrowser for help on using the repository browser.