1 | /*
|
---|
2 | * Copyright 2002-2016 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 | */
|
---|
21 | package com.drew.metadata.exif.makernotes;
|
---|
22 |
|
---|
23 | import com.drew.lang.annotations.NotNull;
|
---|
24 | import com.drew.lang.annotations.Nullable;
|
---|
25 | import com.drew.metadata.TagDescriptor;
|
---|
26 |
|
---|
27 | import 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 | public class PentaxMakernoteDescriptor extends TagDescriptor<PentaxMakernoteDirectory>
|
---|
38 | {
|
---|
39 | public PentaxMakernoteDescriptor(@NotNull PentaxMakernoteDirectory directory)
|
---|
40 | {
|
---|
41 | super(directory);
|
---|
42 | }
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | @Nullable
|
---|
46 | public String getDescription(int tagType)
|
---|
47 | {
|
---|
48 | switch (tagType) {
|
---|
49 | case TAG_CAPTURE_MODE:
|
---|
50 | return getCaptureModeDescription();
|
---|
51 | case TAG_QUALITY_LEVEL:
|
---|
52 | return getQualityLevelDescription();
|
---|
53 | case TAG_FOCUS_MODE:
|
---|
54 | return getFocusModeDescription();
|
---|
55 | case TAG_FLASH_MODE:
|
---|
56 | return getFlashModeDescription();
|
---|
57 | case TAG_WHITE_BALANCE:
|
---|
58 | return getWhiteBalanceDescription();
|
---|
59 | case TAG_DIGITAL_ZOOM:
|
---|
60 | return getDigitalZoomDescription();
|
---|
61 | case TAG_SHARPNESS:
|
---|
62 | return getSharpnessDescription();
|
---|
63 | case TAG_CONTRAST:
|
---|
64 | return getContrastDescription();
|
---|
65 | case TAG_SATURATION:
|
---|
66 | return getSaturationDescription();
|
---|
67 | case TAG_ISO_SPEED:
|
---|
68 | return getIsoSpeedDescription();
|
---|
69 | case TAG_COLOUR:
|
---|
70 | return getColourDescription();
|
---|
71 | default:
|
---|
72 | return super.getDescription(tagType);
|
---|
73 | }
|
---|
74 | }
|
---|
75 |
|
---|
76 | @Nullable
|
---|
77 | public String getColourDescription()
|
---|
78 | {
|
---|
79 | return getIndexedDescription(TAG_COLOUR, 1, "Normal", "Black & White", "Sepia");
|
---|
80 | }
|
---|
81 |
|
---|
82 | @Nullable
|
---|
83 | public String getIsoSpeedDescription()
|
---|
84 | {
|
---|
85 | Integer value = _directory.getInteger(TAG_ISO_SPEED);
|
---|
86 | if (value == null)
|
---|
87 | return null;
|
---|
88 | switch (value) {
|
---|
89 | // TODO there must be other values which aren't catered for here
|
---|
90 | case 10: return "ISO 100";
|
---|
91 | case 16: return "ISO 200";
|
---|
92 | case 100: return "ISO 100";
|
---|
93 | case 200: return "ISO 200";
|
---|
94 | default: return "Unknown (" + value + ")";
|
---|
95 | }
|
---|
96 | }
|
---|
97 |
|
---|
98 | @Nullable
|
---|
99 | public String getSaturationDescription()
|
---|
100 | {
|
---|
101 | return getIndexedDescription(TAG_SATURATION, "Normal", "Low", "High");
|
---|
102 | }
|
---|
103 |
|
---|
104 | @Nullable
|
---|
105 | public String getContrastDescription()
|
---|
106 | {
|
---|
107 | return getIndexedDescription(TAG_CONTRAST, "Normal", "Low", "High");
|
---|
108 | }
|
---|
109 |
|
---|
110 | @Nullable
|
---|
111 | public String getSharpnessDescription()
|
---|
112 | {
|
---|
113 | return getIndexedDescription(TAG_SHARPNESS, "Normal", "Soft", "Hard");
|
---|
114 | }
|
---|
115 |
|
---|
116 | @Nullable
|
---|
117 | public String getDigitalZoomDescription()
|
---|
118 | {
|
---|
119 | Float value = _directory.getFloatObject(TAG_DIGITAL_ZOOM);
|
---|
120 | if (value == null)
|
---|
121 | return null;
|
---|
122 | if (value == 0)
|
---|
123 | return "Off";
|
---|
124 | return Float.toString(value);
|
---|
125 | }
|
---|
126 |
|
---|
127 | @Nullable
|
---|
128 | public String getWhiteBalanceDescription()
|
---|
129 | {
|
---|
130 | return getIndexedDescription(TAG_WHITE_BALANCE,
|
---|
131 | "Auto", "Daylight", "Shade", "Tungsten", "Fluorescent", "Manual");
|
---|
132 | }
|
---|
133 |
|
---|
134 | @Nullable
|
---|
135 | public String getFlashModeDescription()
|
---|
136 | {
|
---|
137 | return getIndexedDescription(TAG_FLASH_MODE,
|
---|
138 | 1, "Auto", "Flash On", null, "Flash Off", null, "Red-eye Reduction");
|
---|
139 | }
|
---|
140 |
|
---|
141 | @Nullable
|
---|
142 | public String getFocusModeDescription()
|
---|
143 | {
|
---|
144 | return getIndexedDescription(TAG_FOCUS_MODE, 2, "Custom", "Auto");
|
---|
145 | }
|
---|
146 |
|
---|
147 | @Nullable
|
---|
148 | public String getQualityLevelDescription()
|
---|
149 | {
|
---|
150 | return getIndexedDescription(TAG_QUALITY_LEVEL, "Good", "Better", "Best");
|
---|
151 | }
|
---|
152 |
|
---|
153 | @Nullable
|
---|
154 | public String getCaptureModeDescription()
|
---|
155 | {
|
---|
156 | return getIndexedDescription(TAG_CAPTURE_MODE,
|
---|
157 | "Auto", "Night-scene", "Manual", null, "Multiple");
|
---|
158 | }
|
---|
159 | }
|
---|