File indexing completed on 2024-05-12 15:59:39
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 PSD_HEADER_H 0008 #define PSD_HEADER_H 0009 0010 #include "kritapsd_export.h" 0011 0012 #include <QtGlobal> 0013 #include <kis_debug.h> 0014 #include <psd.h> 0015 0016 class QIODevice; 0017 0018 class KRITAPSD_EXPORT PSDHeader 0019 { 0020 public: 0021 PSDHeader(); 0022 0023 /** 0024 * Reads a psd header from the given device. 0025 * 0026 * @return false if: 0027 * <li>reading failed 0028 * <li>if the 8BPS signature is not found 0029 * <li>if the version is not 1 or 2 0030 */ 0031 bool read(QIODevice &device); 0032 0033 /** 0034 * write the header data to the given device 0035 * 0036 * @return false if writing failed or if this is not a valid header 0037 */ 0038 bool write(QIODevice &device); 0039 0040 bool valid(); 0041 0042 QString signature; // 8PBS 0043 quint16 version; // 1 or 2 0044 quint16 nChannels; // 1 - 56 0045 quint32 height; // 1-30,000 or 1 - 300,000 0046 quint32 width; // 1-30,000 or 1 - 300,000 0047 quint16 channelDepth; // 1, 8, 16. XXX: check whether 32 is used! 0048 psd_color_mode colormode; 0049 psd_byte_order byteOrder; 0050 bool tiffStyleLayerBlock; // if true, treat layer section as 4-byte aligned blocks 0051 0052 QString error; 0053 }; 0054 0055 KRITAPSD_EXPORT QDebug operator<<(QDebug dbg, const PSDHeader &header); 0056 0057 #endif // PSD_HEADER_H