| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 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 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
@SuppressWarnings("WeakerAccess") |
| 38 |
public 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 |
|
| 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 |
} |