Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tiff_converter.cc
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2005-2006 Cyrille Berger <cberger@cberger.net>
3 * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
9
10#include <tiffio.h>
11
13#include <psd.h>
14
16{
17 QHash<int, int> compToIndex;
18 compToIndex[COMPRESSION_NONE] = 0;
19 compToIndex[COMPRESSION_JPEG] = 1;
20 compToIndex[COMPRESSION_ADOBE_DEFLATE] = 2;
21 compToIndex[COMPRESSION_LZW] = 3;
22 compToIndex[COMPRESSION_PIXARLOG] = 8;
23
24 const QHash<quint16, int> psdCompToIndex = {
27 };
28
30
31 cfg->setProperty("compressiontype", compToIndex.value(compressionType, 0));
32 cfg->setProperty("predictor", predictor - 1);
33 cfg->setProperty("alpha", alpha);
34 cfg->setProperty("psdCompressionType",
35 psdCompToIndex.value(psdCompressionType, 0));
36 cfg->setProperty("saveAsPhotoshop", saveAsPhotoshop);
37 cfg->setProperty("flatten", flatten);
38 cfg->setProperty("quality", jpegQuality);
39 cfg->setProperty("deflate", deflateCompress);
40 cfg->setProperty("pixarlog", pixarLogCompress);
41 cfg->setProperty("saveProfile", saveProfile);
42
43 return cfg;
44}
45
47{
48 QHash<int, int> indexToComp;
49 indexToComp[0] = COMPRESSION_NONE;
50 indexToComp[1] = COMPRESSION_JPEG;
51 indexToComp[2] = COMPRESSION_ADOBE_DEFLATE;
52 indexToComp[3] = COMPRESSION_LZW;
53 indexToComp[4] = COMPRESSION_PIXARLOG;
54
55 // old value that might be still stored in a config (remove after Krita 5.0
56 // :) )
57 indexToComp[8] = COMPRESSION_PIXARLOG;
58
59 const QHash<int, quint16> psdIndexToComp = {
62 };
63
64 compressionType = static_cast<quint16>(
65 indexToComp.value(cfg->getInt("compressiontype", 0), COMPRESSION_NONE));
66
67 predictor = static_cast<quint16>(cfg->getInt("predictor", 0)) + 1;
68 alpha = cfg->getBool("alpha", false);
69 saveAsPhotoshop = cfg->getBool("saveAsPhotoshop", false);
71 psdIndexToComp.value(cfg->getInt("psdCompressionType", 0),
73 flatten = cfg->getBool("flatten", true);
74 jpegQuality = static_cast<quint16>(cfg->getInt("quality", 80));
75 deflateCompress = static_cast<quint16>(cfg->getInt("deflate", 6));
76 pixarLogCompress = static_cast<quint16>(cfg->getInt("pixarlog", 6));
77 saveProfile = cfg->getBool("saveProfile", true);
78}
@ RLE
Definition psd.h:41
@ ZIP
Definition psd.h:42
void fromProperties(KisPropertiesConfigurationSP cfg)
KisPropertiesConfigurationSP toProperties() const