| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
package com.drew.metadata.exif; |
| 23 |
|
| 24 |
import com.drew.lang.Rational; |
| 25 |
import com.drew.lang.annotations.NotNull; |
| 26 |
import com.drew.lang.annotations.Nullable; |
| 27 |
import com.drew.metadata.TagDescriptor; |
| 28 |
|
| 29 |
import static com.drew.metadata.exif.PanasonicRawDistortionDirectory.*; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
@SuppressWarnings("WeakerAccess") |
| 38 |
public class PanasonicRawDistortionDescriptor extends TagDescriptor<PanasonicRawDistortionDirectory> |
| 39 |
{ |
| 40 |
public PanasonicRawDistortionDescriptor(@NotNull PanasonicRawDistortionDirectory directory) |
| 41 |
{ |
| 42 |
super(directory); |
| 43 |
} |
| 44 |
|
| 45 |
@Override |
| 46 |
@Nullable |
| 47 |
public String getDescription(int tagType) |
| 48 |
{ |
| 49 |
switch (tagType) { |
| 50 |
case TagDistortionParam02: |
| 51 |
return getDistortionParam02Description(); |
| 52 |
case TagDistortionParam04: |
| 53 |
return getDistortionParam04Description(); |
| 54 |
case TagDistortionScale: |
| 55 |
return getDistortionScaleDescription(); |
| 56 |
case TagDistortionCorrection: |
| 57 |
return getDistortionCorrectionDescription(); |
| 58 |
case TagDistortionParam08: |
| 59 |
return getDistortionParam08Description(); |
| 60 |
case TagDistortionParam09: |
| 61 |
return getDistortionParam09Description(); |
| 62 |
case TagDistortionParam11: |
| 63 |
return getDistortionParam11Description(); |
| 64 |
default: |
| 65 |
return super.getDescription(tagType); |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
@Nullable |
| 70 |
public String getDistortionParam02Description() |
| 71 |
{ |
| 72 |
Integer value = _directory.getInteger(TagDistortionParam02); |
| 73 |
if (value == null) |
| 74 |
return null; |
| 75 |
|
| 76 |
return new Rational(value, 32678).toString(); |
| 77 |
} |
| 78 |
|
| 79 |
@Nullable |
| 80 |
public String getDistortionParam04Description() |
| 81 |
{ |
| 82 |
Integer value = _directory.getInteger(TagDistortionParam04); |
| 83 |
if (value == null) |
| 84 |
return null; |
| 85 |
|
| 86 |
return new Rational(value, 32678).toString(); |
| 87 |
} |
| 88 |
|
| 89 |
@Nullable |
| 90 |
public String getDistortionScaleDescription() |
| 91 |
{ |
| 92 |
Integer value = _directory.getInteger(TagDistortionScale); |
| 93 |
if (value == null) |
| 94 |
return null; |
| 95 |
|
| 96 |
|
| 97 |
return Integer.toString(1 / (1 + value / 32768)); |
| 98 |
} |
| 99 |
|
| 100 |
@Nullable |
| 101 |
public String getDistortionCorrectionDescription() |
| 102 |
{ |
| 103 |
Integer value = _directory.getInteger(TagDistortionCorrection); |
| 104 |
if (value == null) |
| 105 |
return null; |
| 106 |
|
| 107 |
|
| 108 |
int mask = 0x000f; |
| 109 |
switch (value & mask) |
| 110 |
{ |
| 111 |
case 0: |
| 112 |
return "Off"; |
| 113 |
case 1: |
| 114 |
return "On"; |
| 115 |
default: |
| 116 |
return "Unknown (" + value + ")"; |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
@Nullable |
| 121 |
public String getDistortionParam08Description() |
| 122 |
{ |
| 123 |
Integer value = _directory.getInteger(TagDistortionParam08); |
| 124 |
if (value == null) |
| 125 |
return null; |
| 126 |
|
| 127 |
return new Rational(value, 32678).toString(); |
| 128 |
} |
| 129 |
|
| 130 |
@Nullable |
| 131 |
public String getDistortionParam09Description() |
| 132 |
{ |
| 133 |
Integer value = _directory.getInteger(TagDistortionParam09); |
| 134 |
if (value == null) |
| 135 |
return null; |
| 136 |
|
| 137 |
return new Rational(value, 32678).toString(); |
| 138 |
} |
| 139 |
|
| 140 |
@Nullable |
| 141 |
public String getDistortionParam11Description() |
| 142 |
{ |
| 143 |
Integer value = _directory.getInteger(TagDistortionParam11); |
| 144 |
if (value == null) |
| 145 |
return null; |
| 146 |
|
| 147 |
return new Rational(value, 32678).toString(); |
| 148 |
} |
| 149 |
} |