Debian Codegraph @

src/com/drew/metadata/adobe/AdobeJpegDescriptor.java

raw symbols SCIP
1 /*
2 * Copyright 2002-2019 Drew Noakes and contributors
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
22 package com.drew.metadata.adobe;
23
24 import com.drew.lang.annotations.Nullable;
25 import com.drew.metadata.TagDescriptor;
26
27 import static com.drew.metadata.adobe.AdobeJpegDirectory.*;
28
29 /**
30 * Provides human-readable string versions of the tags stored in an AdobeJpegDirectory.
31 */
32 @SuppressWarnings("WeakerAccess")
33 public class AdobeJpegDescriptor extends TagDescriptor<AdobeJpegDirectory>
34 {
35 public AdobeJpegDescriptor(AdobeJpegDirectory directory)
36 {
37 super(directory);
38 }
39
40 @Override
41 public String getDescription(int tagType)
42 {
43 switch (tagType) {
44 case TAG_COLOR_TRANSFORM:
45 return getColorTransformDescription();
46 case TAG_DCT_ENCODE_VERSION:
47 return getDctEncodeVersionDescription();
48 default:
49 return super.getDescription(tagType);
50 }
51 }
52
53 @Nullable
54 private String getDctEncodeVersionDescription()
55 {
56 Integer value = _directory.getInteger(TAG_DCT_ENCODE_VERSION);
57 return value == null
58 ? null
59 : value == 0x64
60 ? "100"
61 : Integer.toString(value);
62 }
63
64 @Nullable
65 private String getColorTransformDescription()
66 {
67 return getIndexedDescription(TAG_COLOR_TRANSFORM,
68 "Unknown (RGB or CMYK)",
69 "YCbCr",
70 "YCCK");
71 }
72 }