| 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 | package com.drew.metadata.icc;
|
|---|
| 22 |
|
|---|
| 23 | import com.drew.lang.annotations.NotNull;
|
|---|
| 24 | import com.drew.metadata.Directory;
|
|---|
| 25 |
|
|---|
| 26 | import java.util.HashMap;
|
|---|
| 27 |
|
|---|
| 28 | /**
|
|---|
| 29 | * @author Yuri Binev
|
|---|
| 30 | * @author Drew Noakes https://drewnoakes.com
|
|---|
| 31 | */
|
|---|
| 32 | @SuppressWarnings("WeakerAccess")
|
|---|
| 33 | public class IccDirectory extends Directory
|
|---|
| 34 | {
|
|---|
| 35 | // These (smaller valued) tags have an integer value that's equal to their offset within the ICC data buffer.
|
|---|
| 36 |
|
|---|
| 37 | public static final int TAG_PROFILE_BYTE_COUNT = 0;
|
|---|
| 38 | public static final int TAG_CMM_TYPE = 4;
|
|---|
| 39 | public static final int TAG_PROFILE_VERSION = 8;
|
|---|
| 40 | public static final int TAG_PROFILE_CLASS = 12;
|
|---|
| 41 | public static final int TAG_COLOR_SPACE = 16;
|
|---|
| 42 | public static final int TAG_PROFILE_CONNECTION_SPACE = 20;
|
|---|
| 43 | public static final int TAG_PROFILE_DATETIME = 24;
|
|---|
| 44 | public static final int TAG_SIGNATURE = 36;
|
|---|
| 45 | public static final int TAG_PLATFORM = 40;
|
|---|
| 46 | public static final int TAG_CMM_FLAGS = 44;
|
|---|
| 47 | public static final int TAG_DEVICE_MAKE = 48;
|
|---|
| 48 | public static final int TAG_DEVICE_MODEL = 52;
|
|---|
| 49 | public static final int TAG_DEVICE_ATTR = 56;
|
|---|
| 50 | public static final int TAG_RENDERING_INTENT = 64;
|
|---|
| 51 | public static final int TAG_XYZ_VALUES = 68;
|
|---|
| 52 | public static final int TAG_PROFILE_CREATOR = 80;
|
|---|
| 53 | public static final int TAG_TAG_COUNT = 128;
|
|---|
| 54 |
|
|---|
| 55 | // These tag values
|
|---|
| 56 |
|
|---|
| 57 | public static final int TAG_TAG_A2B0 = 0x41324230;
|
|---|
| 58 | public static final int TAG_TAG_A2B1 = 0x41324231;
|
|---|
| 59 | public static final int TAG_TAG_A2B2 = 0x41324232;
|
|---|
| 60 | public static final int TAG_TAG_bXYZ = 0x6258595A;
|
|---|
| 61 | public static final int TAG_TAG_bTRC = 0x62545243;
|
|---|
| 62 | public static final int TAG_TAG_B2A0 = 0x42324130;
|
|---|
| 63 | public static final int TAG_TAG_B2A1 = 0x42324131;
|
|---|
| 64 | public static final int TAG_TAG_B2A2 = 0x42324132;
|
|---|
| 65 | public static final int TAG_TAG_calt = 0x63616C74;
|
|---|
| 66 | public static final int TAG_TAG_targ = 0x74617267;
|
|---|
| 67 | public static final int TAG_TAG_chad = 0x63686164;
|
|---|
| 68 | public static final int TAG_TAG_chrm = 0x6368726D;
|
|---|
| 69 | public static final int TAG_TAG_cprt = 0x63707274;
|
|---|
| 70 | public static final int TAG_TAG_crdi = 0x63726469;
|
|---|
| 71 | public static final int TAG_TAG_dmnd = 0x646D6E64;
|
|---|
| 72 | public static final int TAG_TAG_dmdd = 0x646D6464;
|
|---|
| 73 | public static final int TAG_TAG_devs = 0x64657673;
|
|---|
| 74 | public static final int TAG_TAG_gamt = 0x67616D74;
|
|---|
| 75 | public static final int TAG_TAG_kTRC = 0x6B545243;
|
|---|
| 76 | public static final int TAG_TAG_gXYZ = 0x6758595A;
|
|---|
| 77 | public static final int TAG_TAG_gTRC = 0x67545243;
|
|---|
| 78 | public static final int TAG_TAG_lumi = 0x6C756D69;
|
|---|
| 79 | public static final int TAG_TAG_meas = 0x6D656173;
|
|---|
| 80 | public static final int TAG_TAG_bkpt = 0x626B7074;
|
|---|
| 81 | public static final int TAG_TAG_wtpt = 0x77747074;
|
|---|
| 82 | public static final int TAG_TAG_ncol = 0x6E636F6C;
|
|---|
| 83 | public static final int TAG_TAG_ncl2 = 0x6E636C32;
|
|---|
| 84 | public static final int TAG_TAG_resp = 0x72657370;
|
|---|
| 85 | public static final int TAG_TAG_pre0 = 0x70726530;
|
|---|
| 86 | public static final int TAG_TAG_pre1 = 0x70726531;
|
|---|
| 87 | public static final int TAG_TAG_pre2 = 0x70726532;
|
|---|
| 88 | public static final int TAG_TAG_desc = 0x64657363;
|
|---|
| 89 | public static final int TAG_TAG_pseq = 0x70736571;
|
|---|
| 90 | public static final int TAG_TAG_psd0 = 0x70736430;
|
|---|
| 91 | public static final int TAG_TAG_psd1 = 0x70736431;
|
|---|
| 92 | public static final int TAG_TAG_psd2 = 0x70736432;
|
|---|
| 93 | public static final int TAG_TAG_psd3 = 0x70736433;
|
|---|
| 94 | public static final int TAG_TAG_ps2s = 0x70733273;
|
|---|
| 95 | public static final int TAG_TAG_ps2i = 0x70733269;
|
|---|
| 96 | public static final int TAG_TAG_rXYZ = 0x7258595A;
|
|---|
| 97 | public static final int TAG_TAG_rTRC = 0x72545243;
|
|---|
| 98 | public static final int TAG_TAG_scrd = 0x73637264;
|
|---|
| 99 | public static final int TAG_TAG_scrn = 0x7363726E;
|
|---|
| 100 | public static final int TAG_TAG_tech = 0x74656368;
|
|---|
| 101 | public static final int TAG_TAG_bfd = 0x62666420;
|
|---|
| 102 | public static final int TAG_TAG_vued = 0x76756564;
|
|---|
| 103 | public static final int TAG_TAG_view = 0x76696577;
|
|---|
| 104 |
|
|---|
| 105 | public static final int TAG_TAG_aabg = 0x61616267;
|
|---|
| 106 | public static final int TAG_TAG_aagg = 0x61616767;
|
|---|
| 107 | public static final int TAG_TAG_aarg = 0x61617267;
|
|---|
| 108 | public static final int TAG_TAG_mmod = 0x6D6D6F64;
|
|---|
| 109 | public static final int TAG_TAG_ndin = 0x6E64696E;
|
|---|
| 110 | public static final int TAG_TAG_vcgt = 0x76636774;
|
|---|
| 111 | public static final int TAG_APPLE_MULTI_LANGUAGE_PROFILE_NAME = 0x6473636d;
|
|---|
| 112 |
|
|---|
| 113 | @NotNull
|
|---|
| 114 | protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>();
|
|---|
| 115 |
|
|---|
| 116 | static {
|
|---|
| 117 | _tagNameMap.put(TAG_PROFILE_BYTE_COUNT, "Profile Size");
|
|---|
| 118 | _tagNameMap.put(TAG_CMM_TYPE, "CMM Type");
|
|---|
| 119 | _tagNameMap.put(TAG_PROFILE_VERSION, "Version");
|
|---|
| 120 | _tagNameMap.put(TAG_PROFILE_CLASS, "Class");
|
|---|
| 121 | _tagNameMap.put(TAG_COLOR_SPACE, "Color space");
|
|---|
| 122 | _tagNameMap.put(TAG_PROFILE_CONNECTION_SPACE, "Profile Connection Space");
|
|---|
| 123 | _tagNameMap.put(TAG_PROFILE_DATETIME, "Profile Date/Time");
|
|---|
| 124 | _tagNameMap.put(TAG_SIGNATURE, "Signature");
|
|---|
| 125 | _tagNameMap.put(TAG_PLATFORM, "Primary Platform");
|
|---|
| 126 | _tagNameMap.put(TAG_CMM_FLAGS, "CMM Flags");
|
|---|
| 127 | _tagNameMap.put(TAG_DEVICE_MAKE, "Device manufacturer");
|
|---|
| 128 | _tagNameMap.put(TAG_DEVICE_MODEL, "Device model");
|
|---|
| 129 | _tagNameMap.put(TAG_DEVICE_ATTR, "Device attributes");
|
|---|
| 130 | _tagNameMap.put(TAG_RENDERING_INTENT, "Rendering Intent");
|
|---|
| 131 | _tagNameMap.put(TAG_XYZ_VALUES, "XYZ values");
|
|---|
| 132 | _tagNameMap.put(TAG_PROFILE_CREATOR, "Profile Creator");
|
|---|
| 133 | _tagNameMap.put(TAG_TAG_COUNT, "Tag Count");
|
|---|
| 134 | _tagNameMap.put(TAG_TAG_A2B0, "AToB 0");
|
|---|
| 135 | _tagNameMap.put(TAG_TAG_A2B1, "AToB 1");
|
|---|
| 136 | _tagNameMap.put(TAG_TAG_A2B2, "AToB 2");
|
|---|
| 137 | _tagNameMap.put(TAG_TAG_bXYZ, "Blue Colorant");
|
|---|
| 138 | _tagNameMap.put(TAG_TAG_bTRC, "Blue TRC");
|
|---|
| 139 | _tagNameMap.put(TAG_TAG_B2A0, "BToA 0");
|
|---|
| 140 | _tagNameMap.put(TAG_TAG_B2A1, "BToA 1");
|
|---|
| 141 | _tagNameMap.put(TAG_TAG_B2A2, "BToA 2");
|
|---|
| 142 | _tagNameMap.put(TAG_TAG_calt, "Calibration Date/Time");
|
|---|
| 143 | _tagNameMap.put(TAG_TAG_targ, "Char Target");
|
|---|
| 144 | _tagNameMap.put(TAG_TAG_chad, "Chromatic Adaptation");
|
|---|
| 145 | _tagNameMap.put(TAG_TAG_chrm, "Chromaticity");
|
|---|
| 146 | _tagNameMap.put(TAG_TAG_cprt, "Copyright");
|
|---|
| 147 | _tagNameMap.put(TAG_TAG_crdi, "CrdInfo");
|
|---|
| 148 | _tagNameMap.put(TAG_TAG_dmnd, "Device Mfg Description");
|
|---|
| 149 | _tagNameMap.put(TAG_TAG_dmdd, "Device Model Description");
|
|---|
| 150 | _tagNameMap.put(TAG_TAG_devs, "Device Settings");
|
|---|
| 151 | _tagNameMap.put(TAG_TAG_gamt, "Gamut");
|
|---|
| 152 | _tagNameMap.put(TAG_TAG_kTRC, "Gray TRC");
|
|---|
| 153 | _tagNameMap.put(TAG_TAG_gXYZ, "Green Colorant");
|
|---|
| 154 | _tagNameMap.put(TAG_TAG_gTRC, "Green TRC");
|
|---|
| 155 | _tagNameMap.put(TAG_TAG_lumi, "Luminance");
|
|---|
| 156 | _tagNameMap.put(TAG_TAG_meas, "Measurement");
|
|---|
| 157 | _tagNameMap.put(TAG_TAG_bkpt, "Media Black Point");
|
|---|
| 158 | _tagNameMap.put(TAG_TAG_wtpt, "Media White Point");
|
|---|
| 159 | _tagNameMap.put(TAG_TAG_ncol, "Named Color");
|
|---|
| 160 | _tagNameMap.put(TAG_TAG_ncl2, "Named Color 2");
|
|---|
| 161 | _tagNameMap.put(TAG_TAG_resp, "Output Response");
|
|---|
| 162 | _tagNameMap.put(TAG_TAG_pre0, "Preview 0");
|
|---|
| 163 | _tagNameMap.put(TAG_TAG_pre1, "Preview 1");
|
|---|
| 164 | _tagNameMap.put(TAG_TAG_pre2, "Preview 2");
|
|---|
| 165 | _tagNameMap.put(TAG_TAG_desc, "Profile Description");
|
|---|
| 166 | _tagNameMap.put(TAG_TAG_pseq, "Profile Sequence Description");
|
|---|
| 167 | _tagNameMap.put(TAG_TAG_psd0, "Ps2 CRD 0");
|
|---|
| 168 | _tagNameMap.put(TAG_TAG_psd1, "Ps2 CRD 1");
|
|---|
| 169 | _tagNameMap.put(TAG_TAG_psd2, "Ps2 CRD 2");
|
|---|
| 170 | _tagNameMap.put(TAG_TAG_psd3, "Ps2 CRD 3");
|
|---|
| 171 | _tagNameMap.put(TAG_TAG_ps2s, "Ps2 CSA");
|
|---|
| 172 | _tagNameMap.put(TAG_TAG_ps2i, "Ps2 Rendering Intent");
|
|---|
| 173 | _tagNameMap.put(TAG_TAG_rXYZ, "Red Colorant");
|
|---|
| 174 | _tagNameMap.put(TAG_TAG_rTRC, "Red TRC");
|
|---|
| 175 | _tagNameMap.put(TAG_TAG_scrd, "Screening Desc");
|
|---|
| 176 | _tagNameMap.put(TAG_TAG_scrn, "Screening");
|
|---|
| 177 | _tagNameMap.put(TAG_TAG_tech, "Technology");
|
|---|
| 178 | _tagNameMap.put(TAG_TAG_bfd, "Ucrbg");
|
|---|
| 179 | _tagNameMap.put(TAG_TAG_vued, "Viewing Conditions Description");
|
|---|
| 180 | _tagNameMap.put(TAG_TAG_view, "Viewing Conditions");
|
|---|
| 181 | _tagNameMap.put(TAG_TAG_aabg, "Blue Parametric TRC");
|
|---|
| 182 | _tagNameMap.put(TAG_TAG_aagg, "Green Parametric TRC");
|
|---|
| 183 | _tagNameMap.put(TAG_TAG_aarg, "Red Parametric TRC");
|
|---|
| 184 | _tagNameMap.put(TAG_TAG_mmod, "Make And Model");
|
|---|
| 185 | _tagNameMap.put(TAG_TAG_ndin, "Native Display Information");
|
|---|
| 186 | _tagNameMap.put(TAG_TAG_vcgt, "Video Card Gamma");
|
|---|
| 187 | _tagNameMap.put(TAG_APPLE_MULTI_LANGUAGE_PROFILE_NAME, "Apple Multi-language Profile Name");
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | public IccDirectory()
|
|---|
| 191 | {
|
|---|
| 192 | this.setDescriptor(new IccDescriptor(this));
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | @Override
|
|---|
| 196 | @NotNull
|
|---|
| 197 | public String getName()
|
|---|
| 198 | {
|
|---|
| 199 | return "ICC Profile";
|
|---|
| 200 | }
|
|---|
| 201 |
|
|---|
| 202 | @Override
|
|---|
| 203 | @NotNull
|
|---|
| 204 | protected HashMap<Integer, String> getTagNameMap()
|
|---|
| 205 | {
|
|---|
| 206 | return _tagNameMap;
|
|---|
| 207 | }
|
|---|
| 208 | }
|
|---|