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

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

fix #15505 - update to metadata-extractor 2.10.1

File size: 4.9 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.PentaxMakernoteDirectory.*;
28
29/**
30 * Provides human-readable string representations of tag values stored in a {@link PentaxMakernoteDirectory}.
31 * <p>
32 * Some information about this makernote taken from here:
33 * http://www.ozhiker.com/electronics/pjmt/jpeg_info/pentax_mn.html
34 *
35 * @author Drew Noakes https://drewnoakes.com
36 */
37@SuppressWarnings("WeakerAccess")
38public class PentaxMakernoteDescriptor extends TagDescriptor<PentaxMakernoteDirectory>
39{
40 public PentaxMakernoteDescriptor(@NotNull PentaxMakernoteDirectory directory)
41 {
42 super(directory);
43 }
44
45 @Override
46 @Nullable
47 public String getDescription(int tagType)
48 {
49 switch (tagType) {
50 case TAG_CAPTURE_MODE:
51 return getCaptureModeDescription();
52 case TAG_QUALITY_LEVEL:
53 return getQualityLevelDescription();
54 case TAG_FOCUS_MODE:
55 return getFocusModeDescription();
56 case TAG_FLASH_MODE:
57 return getFlashModeDescription();
58 case TAG_WHITE_BALANCE:
59 return getWhiteBalanceDescription();
60 case TAG_DIGITAL_ZOOM:
61 return getDigitalZoomDescription();
62 case TAG_SHARPNESS:
63 return getSharpnessDescription();
64 case TAG_CONTRAST:
65 return getContrastDescription();
66 case TAG_SATURATION:
67 return getSaturationDescription();
68 case TAG_ISO_SPEED:
69 return getIsoSpeedDescription();
70 case TAG_COLOUR:
71 return getColourDescription();
72 default:
73 return super.getDescription(tagType);
74 }
75 }
76
77 @Nullable
78 public String getColourDescription()
79 {
80 return getIndexedDescription(TAG_COLOUR, 1, "Normal", "Black & White", "Sepia");
81 }
82
83 @Nullable
84 public String getIsoSpeedDescription()
85 {
86 Integer value = _directory.getInteger(TAG_ISO_SPEED);
87 if (value == null)
88 return null;
89 switch (value) {
90 // TODO there must be other values which aren't catered for here
91 case 10: return "ISO 100";
92 case 16: return "ISO 200";
93 case 100: return "ISO 100";
94 case 200: return "ISO 200";
95 default: return "Unknown (" + value + ")";
96 }
97 }
98
99 @Nullable
100 public String getSaturationDescription()
101 {
102 return getIndexedDescription(TAG_SATURATION, "Normal", "Low", "High");
103 }
104
105 @Nullable
106 public String getContrastDescription()
107 {
108 return getIndexedDescription(TAG_CONTRAST, "Normal", "Low", "High");
109 }
110
111 @Nullable
112 public String getSharpnessDescription()
113 {
114 return getIndexedDescription(TAG_SHARPNESS, "Normal", "Soft", "Hard");
115 }
116
117 @Nullable
118 public String getDigitalZoomDescription()
119 {
120 Float value = _directory.getFloatObject(TAG_DIGITAL_ZOOM);
121 if (value == null)
122 return null;
123 if (value == 0)
124 return "Off";
125 return Float.toString(value);
126 }
127
128 @Nullable
129 public String getWhiteBalanceDescription()
130 {
131 return getIndexedDescription(TAG_WHITE_BALANCE,
132 "Auto", "Daylight", "Shade", "Tungsten", "Fluorescent", "Manual");
133 }
134
135 @Nullable
136 public String getFlashModeDescription()
137 {
138 return getIndexedDescription(TAG_FLASH_MODE,
139 1, "Auto", "Flash On", null, "Flash Off", null, "Red-eye Reduction");
140 }
141
142 @Nullable
143 public String getFocusModeDescription()
144 {
145 return getIndexedDescription(TAG_FOCUS_MODE, 2, "Custom", "Auto");
146 }
147
148 @Nullable
149 public String getQualityLevelDescription()
150 {
151 return getIndexedDescription(TAG_QUALITY_LEVEL, "Good", "Better", "Best");
152 }
153
154 @Nullable
155 public String getCaptureModeDescription()
156 {
157 return getIndexedDescription(TAG_CAPTURE_MODE,
158 "Auto", "Night-scene", "Manual", null, "Multiple");
159 }
160}
Note: See TracBrowser for help on using the repository browser.