File indexing completed on 2024-12-22 04:15:57
0001 /* 0002 * SPDX-FileCopyrightText: 2009 Boudewijn Rempt <boud@valdyas.org> 0003 * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #ifndef _KIS_TIFF_PSD_RESOURCE_RECORD_H 0008 #define _KIS_TIFF_PSD_RESOURCE_RECORD_H 0009 0010 #include <QMap> 0011 #include <QString> 0012 #include <psd.h> 0013 0014 #include "kritatiffpsd_export.h" 0015 0016 class QIODevice; 0017 0018 class PSDResourceBlock; 0019 0020 /** 0021 * This class hosts all resource blocks from a TIFF's TIFFTAG_PHOTOSHOP field. 0022 * Unlike its PSD counterpart (PSDResourceSection), TIFF's is only a 0023 * concatenation of blocks. 0024 * 0025 * WARNING: This record is always in big endian, irrespective of the 0026 * container's endianness. 0027 */ 0028 class KRITATIFFPSD_EXPORT KisTiffPsdResourceRecord 0029 { 0030 public: 0031 enum PSDResourceID { 0032 UNKNOWN = 0, 0033 0034 PS2_IMAGE_INFO = 1000, /* 0x03e8 - Obsolete - ps 2.0 image info */ 0035 MAC_PRINT_INFO = 1001, /* 0x03e9 - Optional - Mac print manager print info record */ 0036 PS2_COLOR_TAB = 1003, /* 0x03eb - Obsolete - ps 2.0 indexed color table */ 0037 RESN_INFO = 1005, /* 0x03ed - ResolutionInfo structure */ 0038 ALPHA_NAMES = 1006, /* 0x03ee - Alpha channel names */ 0039 DISPLAY_INFO = 1007, /* 0x03ef - DisplayInfo structure */ 0040 CAPTION = 1008, /* 0x03f0 - Optional - Caption string */ 0041 BORDER_INFO = 1009, /* 0x03f1 - Border info */ 0042 0043 BACKGROUND_COL = 1010, /* 0x03f2 - Background color */ 0044 PRINT_FLAGS = 1011, /* 0x03f3 - Print flags */ 0045 GREY_HALFTONE = 1012, /* 0x03f4 - Greyscale and multichannel halftoning info */ 0046 COLOR_HALFTONE = 1013, /* 0x03f5 - Color halftoning info */ 0047 DUOTONE_HALFTONE = 1014, /* 0x03f6 - Duotone halftoning info */ 0048 GREY_XFER = 1015, /* 0x03f7 - Greyscale and multichannel transfer functions */ 0049 COLOR_XFER = 1016, /* 0x03f8 - Color transfer functions */ 0050 DUOTONE_XFER = 1017, /* 0x03f9 - Duotone transfer functions */ 0051 DUOTONE_INFO = 1018, /* 0x03fa - Duotone image information */ 0052 EFFECTIVE_BW = 1019, /* 0x03fb - Effective black & white values for dot range */ 0053 0054 OBSOLETE_01 = 1020, /* 0x03fc - Obsolete */ 0055 EPS_OPT = 1021, /* 0x03fd - EPS options */ 0056 QUICK_MASK = 1022, /* 0x03fe - Quick mask info */ 0057 OBSOLETE_02 = 1023, /* 0x03ff - Obsolete */ 0058 LAYER_STATE = 1024, /* 0x0400 - Layer state info */ 0059 WORKING_PATH = 1025, /* 0x0401 - Working path (not saved) */ 0060 LAYER_GROUP = 1026, /* 0x0402 - Layers group info */ 0061 OBSOLETE_03 = 1027, /* 0x0403 - Obsolete */ 0062 IPTC_NAA_DATA = 1028, /* 0x0404 - IPTC-NAA record (IMV4.pdf) */ 0063 IMAGE_MODE_RAW = 1029, /* 0x0405 - Image mode for raw format files */ 0064 0065 JPEG_QUAL = 1030, /* 0x0406 - JPEG quality */ 0066 GRID_GUIDE = 1032, /* 0x0408 - Grid & guide info */ 0067 THUMB_RES = 1033, /* 0x0409 - Thumbnail resource */ 0068 COPYRIGHT_FLG = 1034, /* 0x040a - Copyright flag */ 0069 URL = 1035, /* 0x040b - URL string */ 0070 THUMB_RES2 = 1036, /* 0x040c - Thumbnail resource */ 0071 GLOBAL_ANGLE = 1037, /* 0x040d - Global angle */ 0072 COLOR_SAMPLER = 1038, /* 0x040e - Color samplers resource */ 0073 ICC_PROFILE = 1039, /* 0x040f - ICC Profile */ 0074 0075 WATERMARK = 1040, /* 0x0410 - Watermark */ 0076 ICC_UNTAGGED = 1041, /* 0x0411 - Do not use ICC profile flag */ 0077 EFFECTS_VISIBLE = 1042, /* 0x0412 - Show / hide all effects layers */ 0078 SPOT_HALFTONE = 1043, /* 0x0413 - Spot halftone */ 0079 DOC_IDS = 1044, /* 0x0414 - Document specific IDs */ 0080 ALPHA_NAMES_UNI = 1045, /* 0x0415 - Unicode alpha names */ 0081 IDX_COL_TAB_CNT = 1046, /* 0x0416 - Indexed color table count */ 0082 IDX_TRANSPARENT = 1047, /* 0x0417 - Index of transparent color (if any) */ 0083 GLOBAL_ALT = 1049, /* 0x0419 - Global altitude */ 0084 0085 SLICES = 1050, /* 0x041a - Slices */ 0086 WORKFLOW_URL_UNI = 1051, /* 0x041b - Workflow URL - Unicode string */ 0087 JUMP_TO_XPEP = 1052, /* 0x041c - Jump to XPEP (?) */ 0088 ALPHA_ID = 1053, /* 0x041d - Alpha IDs */ 0089 URL_LIST_UNI = 1054, /* 0x041e - URL list - unicode */ 0090 VERSION_INFO = 1057, /* 0x0421 - Version info */ 0091 EXIF_DATA = 1058, /* 0x0422 - (Photoshop 7.0) EXIF data 1. See http://www.kodak.com/global/plugins/acrobat/en/service/digCam/exifStandard2.pdf */ 0092 EXIF_DATA_3 = 1059, /* 0x0423 - (Photoshop 7.0) EXIF data 3. See http://www.kodak.com/global/plugins/acrobat/en/service/digCam/exifStandard2.pdf */ 0093 0094 XMP_DATA = 1060, /* 0x0424 - XMP data block */ 0095 CAPTION_DIGEST = 1061, /* 0x0425 - (Photoshop 7.0) Caption digest. 16 bytes: RSA Data Security, MD5 message-digest algorithm */ 0096 PRINT_SCALE = 1062, /* 0x0426 - (Photoshop 7.0) Print scale. 2 bytes style (0 = centered, 1 = size to fit, 2 = user defined). 4 bytes x location 0097 (floating point). 4 bytes y location (floating point). 4 bytes scale (floating point) */ 0098 PIXEL_ASPECT_RATION = 1064, /* 0x0428 - (Photoshop CS) Pixel Aspect Ratio. 4 bytes (version = 1 or 2), 8 bytes double, x / y of a pixel. Version 2, 0099 attempting to correct values for NTSC and PAL, previously off by a factor of approx. 5%. */ 0100 LAYER_COMPS = 1065, /* 0x0429 - (Photoshop CS) Layer Comps. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) */ 0101 ALTERNATE_DUOTONE = 1066, /* 0x042A - (Photoshop CS) Alternate Duotone Colors. 2 bytes (version = 1), 2 bytes count, following is repeated for each 0102 count: [ Color: 2 bytes for space followed by 4 * 2 byte color component ], following this is another 2 byte count, usually 0103 256, followed by Lab colors one byte each for L, a, b. This resource is not read or used by Photoshop. */ 0104 ALTERNATE_SPOT = 0105 1067, /* 0x042B - (Photoshop CS)Alternate Spot Colors. 2 bytes (version = 1), 2 bytes channel count, following is repeated for each count: 4 bytes 0106 channel ID, Color: 2 bytes for space followed by 4 * 2 byte color component. This resource is not read or used by Photoshop. */ 0107 LAYER_SELECTION_ID = 1069, /* 0x042D - (Photoshop CS2) Layer Selection ID(s). 2 bytes count, following is repeated for each count: 4 bytes layer ID */ 0108 0109 HDR_TONING = 1070, /* 0x042E - (Photoshop CS2) HDR Toning information */ 0110 CS2_PRINT_INFO = 1071, /* 0x042F - (Photoshop CS2) Print info */ 0111 LAYER_GROUP_ENABLED_ID = 1072, /* 0x0430 - (Photoshop CS2) Layer Group(s) Enabled ID. 1 byte for each layer in the document, repeated by length of the 0112 resource. NOTE: Layer groups have start and end markers */ 0113 COLOR_SAMPLERS = 1073, /* 0x0431 - (Photoshop CS3) Color samplers resource. Also see ID 1038 for old format. See Color samplers resource format. */ 0114 MEASUREMENT_SCALE = 1074, /* 0x0432 - (Photoshop CS3) Measurement Scale. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) */ 0115 TIMELINE_INFO = 1075, /* 0x0433 - (Photoshop CS3) Timeline Information. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) */ 0116 SHEET_DISCLOSURE = 1076, /* 0x0434 - (Photoshop CS3) Sheet Disclosure. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) */ 0117 CS3_DISPLAY_INFO = 1077, /* 0x0435 - (Photoshop CS3) DisplayInfo structure to support floating point colors. Also see ID 1007. See Appendix A in 0118 Photoshop API Guide.pdf . */ 0119 ONION_SKINS = 1078, /* 0x0436 - (Photoshop CS3) Onion Skins. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) */ 0120 0121 COUNT_INFO = 1080, /* 0x0438 - (Photoshop CS4) Count Information. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) 0122 Information about the count in the document. See the Count Tool. */ 0123 CS5_PRINT_INFO = 1082, /* 0x043A - (Photoshop CS5) Print Information. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) 0124 Information about the current print settings in the document. The color management options. */ 0125 CS5_PRINT_STYLE = 1083, /* 0x043B - (Photoshop CS5) Print Style. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) 0126 Information about the current print style in the document. The printing marks, labels, ornaments, etc. */ 0127 CS5_NSPrintInfo = 1084, /* 0x043C - (Photoshop CS5) Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo. It is recommended that 0128 you do not interpret or use this data. */ 0129 CS5_WIN_DEVMODE = 1085, /* 0x043D - (Photoshop CS5) Windows DEVMODE. Variable OS specific info for Windows. DEVMODE. It is recommended that you do not 0130 interpret or use this data. */ 0131 CS6_AUTOSAVE_FILE_PATH = 0132 1086, /* 0x043E - (Photoshop CS6) Auto Save File Path. Unicode string. It is recommended that you do not interpret or use this data. */ 0133 CS6_AUTOSAVE_FORMAT = 0134 1087, /* 0x043F - (Photoshop CS6) Auto Save Format. Unicode string. It is recommended that you do not interpret or use this data. */ 0135 CC_PATH_SELECTION_SATE = 1088, /* 0x0440 - (Photoshop CC) Path Selection State. 4 bytes (descriptor version = 16), Descriptor (see Descriptor 0136 structure) Information about the current path selection state. */ 0137 0138 PATH_INFO_FIRST = 2000, /* 0x07d0 - First path info block */ 0139 PATH_INFO_LAST = 2998, /* 0x0bb6 - Last path info block */ 0140 CLIPPING_PATH = 2999, /* 0x0bb7 - Name of clipping path */ 0141 0142 CC_ORIGIN_PATH_INFO = 3000, /* 0x0BB8 (Photoshop CC) Origin Path Info. 4 bytes (descriptor version = 16), Descriptor (see Descriptor structure) 0143 Information about the origin path data. */ 0144 0145 PLUGIN_RESOURCE_START = 4000, /* 0x0FA0-0x1387 Plug-In resource(s). Resources added by a plug-in. See the plug-in API found in the SDK documentation */ 0146 PLUGIN_RESOURCE_END = 4999, /* Last plug-in resource */ 0147 0148 IMAGE_READY_VARS = 7000, /* 0x1B58 Image Ready variables. XML representation of variables definition */ 0149 IMAGE_READY_DATA_SETS = 7001, /* 0x1B59 Image Ready data sets */ 0150 0151 LIGHTROOM_WORKFLOW = 8000, /* 0x1F40 (Photoshop CS3) Lightroom workflow, if present the document is in the middle of a Lightroom workflow. */ 0152 0153 PRINT_FLAGS_2 = 10000 /* 0x2710 - Print flags */ 0154 }; 0155 0156 KisTiffPsdResourceRecord(); 0157 ~KisTiffPsdResourceRecord(); 0158 0159 bool read(QIODevice &io); 0160 bool write(QIODevice &io); 0161 bool valid(); 0162 0163 static QString idToString(PSDResourceID id); 0164 0165 QMap<PSDResourceID, PSDResourceBlock *> resources; 0166 0167 QString error; 0168 }; 0169 0170 #endif // _KIS_TIFF_PSD_RESOURCE_RECORD_H