chalk

kis_channelinfo.h
1/*
2 * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18#ifndef KIS_CHANNELINFO_H_
19#define KIS_CHANNELINFO_H_
20
21#include <tqcolor.h>
22#include "tqstring.h"
23#include "ksharedptr.h"
24
30class KisChannelInfo : public TDEShared {
31public:
32 enum enumChannelType {
33 COLOR, // The channel represents a color
34 ALPHA, // The channel represents the opacity of a pixel
35 SUBSTANCE, // The channel represents a real-world substance like pigments or medium
36 SUBSTRATE // The channel represents a real-world painting substrate like a canvas
37 };
38
39 enum enumChannelValueType {
40 UINT8,
41 UINT16,
42 FLOAT16,
43 FLOAT32,
44 INT8,
45 INT16,
46 OTHER // Use this if the channel is neither an integer or a float
47 };
48 enum enumChannelFlags {
49 FLAG_COLOR = 1,
50 FLAG_ALPHA = (1 << 1),
51 FLAG_SUBSTANCE = (1 << 2),
52 FLAG_SUBSTRATE = (1 << 3),
53 FLAG_COLOR_AND_ALPHA = FLAG_ALPHA | FLAG_COLOR // HACK to be able to use convolution of color and alpha at the same time
54 };
55
56public:
57 KisChannelInfo() { };
67 KisChannelInfo( const TQString & name, const TQString & abbrev, TQ_INT32 npos, enumChannelType channelType, enumChannelValueType channelValueType, TQ_INT32 size = 1, TQColor color = TQColor(0,0,0))
68 : m_name (name), m_abbrev(abbrev), m_pos (npos), m_channelType(channelType), m_channelValueType(channelValueType), m_size(size), m_color(color) { };
69public:
73 inline TQString name() const { return m_name; };
74
78 inline TQString abbrev() const { return m_abbrev; };
82 inline TQ_INT32 pos() const { return m_pos; };
83
87 inline TQ_INT32 size() const { return m_size; };
88
92 inline enumChannelType channelType() const { return m_channelType; };
96 inline enumChannelValueType channelValueType() const { return m_channelValueType; };
101 inline TQColor color() const { return m_color; }
102
103private:
104
105 TQString m_name;
106 TQString m_abbrev;
107 TQ_INT32 m_pos;
108 enumChannelType m_channelType;
109 enumChannelValueType m_channelValueType;
110 TQ_INT32 m_size;
111 TQColor m_color;
112
113};
114
115#endif // KIS_CHANNELINFO_H_
TQString name() const
User-friendly name for this channel for presentation purposes in the gui.
TQ_INT32 size() const
returns the number of bytes this channel takes
enumChannelValueType channelValueType() const
return the type of the value of the channel (float, uint8 or uint16)
TQString abbrev() const
Return the single-letter abbreviation for this channel.
KisChannelInfo(const TQString &name, const TQString &abbrev, TQ_INT32 npos, enumChannelType channelType, enumChannelValueType channelValueType, TQ_INT32 size=1, TQColor color=TQColor(0, 0, 0))
enumChannelType channelType() const
returns the type of the channel
TQColor color() const
This is a color that can be used to represent this channel in histograms and so.
TQ_INT32 pos() const
returns the position of the first byte of the channel in the pixel