Krita Source Code Documentation
Loading...
Searching...
No Matches
psd_layer_section.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7#ifndef PSD_LAYER_SECTION_H
8#define PSD_LAYER_SECTION_H
9
10#include "kritapsd_export.h"
11
12#include <QString>
13
14class QIODevice;
15
16#include <kis_types.h>
17#include <psd.h>
18
19#include "psd_header.h"
20#include "psd_layer_record.h"
21
22class KRITAPSD_EXPORT PSDLayerMaskSection
23{
24public:
25 PSDLayerMaskSection(const PSDHeader &header);
27
28 bool read(QIODevice &io);
29 bool write(QIODevice &io, KisNodeSP rootLayer, psd_compression_type compressionType);
30
31 QString error;
32
33 // layer info: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_16000
34 bool hasTransparency{false};
35
36 qint16 nLayers{0}; // If layer count is a negative number, its absolute value is the number of layers and the first alpha channel contains the transparency
37 // data for the merged result.
39
40 // mask info: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_17115
42 quint16 overlayColorSpace{0}; // Overlay color space (undocumented).
43 quint16 colorComponents[4]{0, 0, 0, 0}; // 4 * 2 byte color components
44 quint16 opacity{0}; // Opacity. 0 = transparent, 100 = opaque.
45 quint8 kind{0}; // Kind. 0 = Color selected--i.e. inverted; 1 = Color protected;128 = use value stored per layer. This value is preferred. The others
46 // are for backward compatibility with beta versions.
47 };
50
51private:
52 template<psd_byte_order byteOrder = psd_byte_order::psdBigEndian>
53 bool readLayerInfoImpl(QIODevice &io);
54 bool readPsdImpl(QIODevice &io);
55 template<psd_byte_order byteOrder = psd_byte_order::psdBigEndian>
56 bool readTiffImpl(QIODevice &io);
57 template<psd_byte_order byteOrder = psd_byte_order::psdBigEndian>
58 bool readGlobalMask(QIODevice &io);
59 void writePsdImpl(QIODevice &io, KisNodeSP rootLayer, psd_compression_type compressionType);
60 template<psd_byte_order byteOrder = psd_byte_order::psdBigEndian>
61 void writeTiffImpl(QIODevice &io, KisNodeSP rootLayer, psd_compression_type compressionType);
62private:
64};
65
66#endif // PSD_LAYER_SECTION_H
const PSDHeader m_header
PsdAdditionalLayerInfoBlock globalInfoSection
QVector< PSDLayerRecord * > layers
GlobalLayerMaskInfo globalLayerMaskInfo
The PsdAdditionalLayerInfoBlock class implements the Additional Layer Information block.
psd_compression_type
Definition psd.h:39