File: EpsDescriptor.java

package info (click to toggle)
libmetadata-extractor-java 2.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 6,416 kB
  • sloc: java: 35,343; xml: 200; sh: 11; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.drew.metadata.eps;

import com.drew.lang.annotations.NotNull;
import com.drew.lang.annotations.Nullable;
import com.drew.metadata.TagDescriptor;

import static com.drew.metadata.eps.EpsDirectory.*;

/**
 * @author Payton Garland
 */
public class EpsDescriptor extends TagDescriptor<EpsDirectory>
{

    public EpsDescriptor(@NotNull EpsDirectory directory)
    {
        super(directory);
    }

    @Override
    public String getDescription(int tagType)
    {
        switch (tagType) {
            case TAG_IMAGE_WIDTH:
            case TAG_IMAGE_HEIGHT:
                return getPixelDescription(tagType);
            case TAG_TIFF_PREVIEW_SIZE:
            case TAG_TIFF_PREVIEW_OFFSET:
                return getByteSizeDescription(tagType);
            case TAG_COLOR_TYPE:
                return getColorTypeDescription();
            default:
                return _directory.getString(tagType);
        }
    }

    public String getPixelDescription(int tagType)
    {
        return _directory.getString(tagType) + " pixels";
    }

    public String getByteSizeDescription(int tagType)
    {
        return _directory.getString(tagType) + " bytes";
    }

    @Nullable
    public String getColorTypeDescription()
    {
        return getIndexedDescription(TAG_COLOR_TYPE, 1,
            "Grayscale", "Lab", "RGB", "CMYK");
    }
}