| 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.jfif; |
| 22 |
|
| 23 |
import com.drew.lang.annotations.NotNull; |
| 24 |
import com.drew.metadata.Directory; |
| 25 |
import com.drew.metadata.MetadataException; |
| 26 |
|
| 27 |
import java.util.HashMap; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
@SuppressWarnings("WeakerAccess") |
| 35 |
public class JfifDirectory extends Directory |
| 36 |
{ |
| 37 |
public static final int TAG_VERSION = 5; |
| 38 |
|
| 39 |
public static final int TAG_UNITS = 7; |
| 40 |
public static final int TAG_RESX = 8; |
| 41 |
public static final int TAG_RESY = 10; |
| 42 |
public static final int TAG_THUMB_WIDTH = 12; |
| 43 |
public static final int TAG_THUMB_HEIGHT = 13; |
| 44 |
|
| 45 |
@NotNull |
| 46 |
private static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>(); |
| 47 |
|
| 48 |
static |
| 49 |
{ |
| 50 |
_tagNameMap.put(TAG_VERSION, "Version"); |
| 51 |
_tagNameMap.put(TAG_UNITS, "Resolution Units"); |
| 52 |
_tagNameMap.put(TAG_RESY, "Y Resolution"); |
| 53 |
_tagNameMap.put(TAG_RESX, "X Resolution"); |
| 54 |
_tagNameMap.put(TAG_THUMB_WIDTH, "Thumbnail Width Pixels"); |
| 55 |
_tagNameMap.put(TAG_THUMB_HEIGHT, "Thumbnail Height Pixels"); |
| 56 |
} |
| 57 |
|
| 58 |
public JfifDirectory() |
| 59 |
{ |
| 60 |
this.setDescriptor(new JfifDescriptor(this)); |
| 61 |
} |
| 62 |
|
| 63 |
@Override |
| 64 |
@NotNull |
| 65 |
public String getName() |
| 66 |
{ |
| 67 |
return "JFIF"; |
| 68 |
} |
| 69 |
|
| 70 |
@Override |
| 71 |
@NotNull |
| 72 |
protected HashMap<Integer, String> getTagNameMap() |
| 73 |
{ |
| 74 |
return _tagNameMap; |
| 75 |
} |
| 76 |
|
| 77 |
public int getVersion() throws MetadataException |
| 78 |
{ |
| 79 |
return getInt(JfifDirectory.TAG_VERSION); |
| 80 |
} |
| 81 |
|
| 82 |
public int getResUnits() throws MetadataException |
| 83 |
{ |
| 84 |
return getInt(JfifDirectory.TAG_UNITS); |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
@Deprecated |
| 91 |
public int getImageWidth() throws MetadataException |
| 92 |
{ |
| 93 |
return getInt(JfifDirectory.TAG_RESY); |
| 94 |
} |
| 95 |
|
| 96 |
public int getResY() throws MetadataException |
| 97 |
{ |
| 98 |
return getInt(JfifDirectory.TAG_RESY); |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
@Deprecated |
| 105 |
public int getImageHeight() throws MetadataException |
| 106 |
{ |
| 107 |
return getInt(JfifDirectory.TAG_RESX); |
| 108 |
} |
| 109 |
|
| 110 |
public int getResX() throws MetadataException |
| 111 |
{ |
| 112 |
return getInt(JfifDirectory.TAG_RESX); |
| 113 |
} |
| 114 |
} |