File indexing completed on 2024-06-16 04:16:37

0001 /*
0002  * This file is part of Krita
0003  *
0004  * SPDX-FileCopyrightText: 2004 Cyrille Berger <cberger@cberger.net>
0005  * SPDX-FileCopyrightText: 2021 Deif Lou <giniba@gmail.net>
0006  *
0007  *  SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef KIS_MULTICHANNEL_FILTER_UTILS
0011 #define KIS_MULTICHANNEL_FILTER_UTILS
0012 
0013 #include <QtGlobal>
0014 #include <QVector>
0015 #include <QList>
0016 
0017 #include "virtual_channel_info.h"
0018 
0019 class KoColorSpace;
0020 class KoColorTransformation;
0021 
0022 namespace KisMultiChannelUtils {
0023 
0024 /**
0025  * Get a list of adjustable channels for the color space.
0026  * If maxChannels is non-negative, the number of channels is capped to the number. This is useful configurations
0027  * from older documents (created in versions which supported fewer channels).
0028  */
0029 QVector<VirtualChannelInfo> getVirtualChannels(const KoColorSpace *cs,
0030                                                int maxChannels = -1,
0031                                                bool supportsLightness = true,
0032                                                bool supportsHue = true,
0033                                                bool supportSaturation = true);
0034 
0035 int findChannel(const QVector<VirtualChannelInfo> &virtualChannels, const VirtualChannelInfo::Type &channelType);
0036 
0037 /**
0038  * @brief Create a composed per channel transformation object from the set of given transfers
0039  * @param cs a colorspace
0040  * @param transfers A collection of transfer luts
0041  * @param transferIsIdentity A collection of bools that indicate if the
0042  *        corresponding transfer has no effect (maps the input to itself)
0043  */
0044 KoColorTransformation* createPerChannelTransformationFromTransfers(const KoColorSpace *cs,
0045                                                                    const QVector<QVector<quint16>> &transfers,
0046                                                                    const QList<bool> &transferIsIdentity);
0047 
0048 }
0049 
0050 #endif