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

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

fix #15505 - update to metadata-extractor 2.10.1

File size: 4.7 KB
Line 
1/*
2 * Copyright 2002-2017 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 */
34@SuppressWarnings("WeakerAccess")
35public class KodakMakernoteDescriptor extends TagDescriptor<KodakMakernoteDirectory>
36{
37 public KodakMakernoteDescriptor(@NotNull KodakMakernoteDirectory directory)
38 {
39 super(directory);
40 }
41
42 @Override
43 @Nullable
44 public String getDescription(int tagType)
45 {
46 switch (tagType) {
47 case TAG_QUALITY:
48 return getQualityDescription();
49 case TAG_BURST_MODE:
50 return getBurstModeDescription();
51 case TAG_SHUTTER_MODE:
52 return getShutterModeDescription();
53 case TAG_FOCUS_MODE:
54 return getFocusModeDescription();
55 case TAG_WHITE_BALANCE:
56 return getWhiteBalanceDescription();
57 case TAG_FLASH_MODE:
58 return getFlashModeDescription();
59 case TAG_FLASH_FIRED:
60 return getFlashFiredDescription();
61 case TAG_COLOR_MODE:
62 return getColorModeDescription();
63 case TAG_SHARPNESS:
64 return getSharpnessDescription();
65 default:
66 return super.getDescription(tagType);
67 }
68 }
69
70 @Nullable
71 public String getSharpnessDescription()
72 {
73 return getIndexedDescription(TAG_SHARPNESS, "Normal");
74 }
75
76 @Nullable
77 public String getColorModeDescription()
78 {
79 Integer value = _directory.getInteger(TAG_COLOR_MODE);
80 if (value == null)
81 return null;
82 switch (value) {
83 case 0x001: case 0x2000: return "B&W";
84 case 0x002: case 0x4000: return "Sepia";
85 case 0x003: return "B&W Yellow Filter";
86 case 0x004: return "B&W Red Filter";
87 case 0x020: return "Saturated Color";
88 case 0x040: case 0x200: return "Neutral Color";
89 case 0x100: return "Saturated Color";
90 default: return "Unknown (" + value + ")";
91 }
92 }
93
94 @Nullable
95 public String getFlashFiredDescription()
96 {
97 return getIndexedDescription(TAG_FLASH_FIRED, "No", "Yes");
98 }
99
100 @Nullable
101 public String getFlashModeDescription()
102 {
103 Integer value = _directory.getInteger(TAG_FLASH_MODE);
104 if (value == null)
105 return null;
106 switch (value) {
107 case 0x00: return "Auto";
108 case 0x10: case 0x01: return "Fill Flash";
109 case 0x20: case 0x02: return "Off";
110 case 0x40: case 0x03: return "Red Eye";
111 default: return "Unknown (" + value + ")";
112 }
113 }
114
115 @Nullable
116 public String getWhiteBalanceDescription()
117 {
118 return getIndexedDescription(TAG_WHITE_BALANCE, "Auto", "Flash", "Tungsten", "Daylight");
119 }
120
121 @Nullable
122 public String getFocusModeDescription()
123 {
124 return getIndexedDescription(TAG_FOCUS_MODE, "Normal", null, "Macro");
125 }
126
127 @Nullable
128 public String getShutterModeDescription()
129 {
130 Integer value = _directory.getInteger(TAG_SHUTTER_MODE);
131 if (value == null)
132 return null;
133 switch (value) {
134 case 0: return "Auto";
135 case 8: return "Aperture Priority";
136 case 32: return "Manual";
137 default: return "Unknown (" + value + ")";
138 }
139 }
140
141 @Nullable
142 public String getBurstModeDescription()
143 {
144 return getIndexedDescription(TAG_BURST_MODE, "Off", "On");
145 }
146
147 @Nullable
148 public String getQualityDescription()
149 {
150 return getIndexedDescription(TAG_QUALITY, 1, "Fine", "Normal");
151 }
152}
Note: See TracBrowser for help on using the repository browser.