File indexing completed on 2024-06-23 04:26:53
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __VIRTUAL_CHANNEL_INFO_H 0008 #define __VIRTUAL_CHANNEL_INFO_H 0009 0010 #include <KoChannelInfo.h> 0011 class KoColorSpace; 0012 0013 0014 /** 0015 * This class represents a virtual channel that can have a curve in 0016 * curves filter. Virtual channel can be of various types: 0017 * 0018 * - REAL --- represents a real color channel of the image, 0019 * like R, G, B or A 0020 * 0021 * - LIGHTNESS --- lightness virtual channel: represents L channel 0022 * of the image separation into Lab. 0023 * 0024 * - ALL_COLORS --- represents a grouped channel, combining all the 0025 * color channels of the image. E.g. R+G+B of an RGB 0026 * image 0027 */ 0028 0029 class VirtualChannelInfo 0030 { 0031 public: 0032 enum Type { 0033 REAL, 0034 HUE, 0035 SATURATION, 0036 LIGHTNESS, 0037 ALL_COLORS 0038 }; 0039 0040 VirtualChannelInfo(); 0041 0042 VirtualChannelInfo(Type type, int pixelIndex, KoChannelInfo *realChannelInfo, const KoColorSpace *cs); 0043 0044 /** 0045 * \return a pointer to a KoChannelInfo structure *iff* the 0046 * channel type is 'REAL'. Returns null of all the 0047 * other types. 0048 */ 0049 KoChannelInfo* channelInfo() const; 0050 0051 /** 0052 * Index of this channel in a pixel. 0053 * 0054 * \return -1 for all virtual channels. 0055 */ 0056 int pixelIndex() const; 0057 0058 Type type() const; 0059 QString name() const; 0060 0061 KoChannelInfo::enumChannelValueType valueType() const; 0062 int channelSize() const; 0063 0064 bool isAlpha() const; 0065 0066 private: 0067 Type m_type {REAL}; 0068 int m_pixelIndex {0}; 0069 KoChannelInfo *m_realChannelInfo {nullptr}; 0070 0071 QString m_nameOverride; 0072 KoChannelInfo::enumChannelValueType m_valueTypeOverride {KoChannelInfo::FLOAT32}; 0073 int m_channelSizeOverride {4}; 0074 }; 0075 0076 #endif /* __VIRTUAL_CHANNEL_INFO_H */