Krita Source Code Documentation
Loading...
Searching...
No Matches
VirtualChannelInfo Class Reference

#include <virtual_channel_info.h>

Public Types

enum  Type {
  REAL , HUE , SATURATION , LIGHTNESS ,
  ALL_COLORS
}
 

Public Member Functions

KoChannelInfochannelInfo () const
 
int channelSize () const
 
bool isAlpha () const
 
QString name () const
 
int pixelIndex () const
 
Type type () const
 
KoChannelInfo::enumChannelValueType valueType () const
 
 VirtualChannelInfo ()
 
 VirtualChannelInfo (Type type, int pixelIndex, KoChannelInfo *realChannelInfo, const KoColorSpace *cs)
 

Private Attributes

int m_channelSizeOverride {4}
 
QString m_nameOverride
 
int m_pixelIndex {0}
 
KoChannelInfom_realChannelInfo {nullptr}
 
Type m_type {REAL}
 
KoChannelInfo::enumChannelValueType m_valueTypeOverride {KoChannelInfo::FLOAT32}
 

Detailed Description

This class represents a virtual channel that can have a curve in curves filter. Virtual channel can be of various types:

  • REAL — represents a real color channel of the image, like R, G, B or A
  • LIGHTNESS — lightness virtual channel: represents L channel of the image separation into Lab.
  • ALL_COLORS — represents a grouped channel, combining all the color channels of the image. E.g. R+G+B of an RGB image

Definition at line 29 of file virtual_channel_info.h.

Member Enumeration Documentation

◆ Type

Enumerator
REAL 
HUE 
SATURATION 
LIGHTNESS 
ALL_COLORS 

Definition at line 32 of file virtual_channel_info.h.

Constructor & Destructor Documentation

◆ VirtualChannelInfo() [1/2]

VirtualChannelInfo::VirtualChannelInfo ( )

Definition at line 14 of file virtual_channel_info.cpp.

◆ VirtualChannelInfo() [2/2]

VirtualChannelInfo::VirtualChannelInfo ( Type type,
int pixelIndex,
KoChannelInfo * realChannelInfo,
const KoColorSpace * cs )

Definition at line 21 of file virtual_channel_info.cpp.

25 : m_type(type),
27 m_realChannelInfo(realChannelInfo)
28{
29 if (m_type == HUE) {
30 m_nameOverride = i18n("Hue");
33 } else if (m_type == SATURATION) {
34 m_nameOverride = i18n("Saturation");
37 } else if (m_type == LIGHTNESS) {
38 m_nameOverride = i18nc("Lightness L*a*b*", "Lightness");
41 } else if (m_type == ALL_COLORS) {
42 const QList<KoChannelInfo*> channels = cs->channels();
43
44 if (cs->colorModelId() == RGBAColorModelID) {
45 m_nameOverride = "RGB";
46 } else if (cs->colorModelId() == CMYKAColorModelID) {
47 m_nameOverride = "CMYK";
48 } else if (cs->colorModelId() == XYZAColorModelID) {
49 m_nameOverride = "XYZ";
50 } else if (cs->colorModelId() == LABAColorModelID) {
51 m_nameOverride = "L*a*b*";
52 } else if (cs->colorModelId() == YCbCrAColorModelID) {
53 m_nameOverride = "YCbCr";
54 } else {
56 }
57 m_valueTypeOverride = channels.first()->channelValueType();
58 m_channelSizeOverride = channels.first()->size();
59 }
60}
const KoID YCbCrAColorModelID("YCbCrA", ki18n("YCbCr/Alpha"))
const KoID XYZAColorModelID("XYZA", ki18n("XYZ/Alpha"))
const KoID CMYKAColorModelID("CMYKA", ki18n("CMYK/Alpha"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
@ FLOAT32
use this for a float 32bits channel
QList< KoChannelInfo * > channels
virtual KoID colorModelId() const =0
QString id() const
Definition KoID.cpp:63
KoChannelInfo::enumChannelValueType m_valueTypeOverride

References ALL_COLORS, KoColorSpace::channels, CMYKAColorModelID, KoColorSpace::colorModelId(), KoChannelInfo::FLOAT32, HUE, KoID::id(), LABAColorModelID, LIGHTNESS, m_channelSizeOverride, m_nameOverride, m_type, m_valueTypeOverride, RGBAColorModelID, SATURATION, XYZAColorModelID, and YCbCrAColorModelID.

Member Function Documentation

◆ channelInfo()

KoChannelInfo * VirtualChannelInfo::channelInfo ( ) const
Returns
a pointer to a KoChannelInfo structure iff the channel type is 'REAL'. Returns null of all the other types.

Definition at line 66 of file virtual_channel_info.cpp.

66 {
67 return m_realChannelInfo;
68}

References m_realChannelInfo.

◆ channelSize()

int VirtualChannelInfo::channelSize ( ) const

◆ isAlpha()

bool VirtualChannelInfo::isAlpha ( ) const

Definition at line 86 of file virtual_channel_info.cpp.

87{
88 return m_type == REAL &&
90}
@ ALPHA
The channel represents the opacity of a pixel.
enumChannelType channelType() const

References KoChannelInfo::ALPHA, KoChannelInfo::channelType(), m_realChannelInfo, m_type, and REAL.

◆ name()

QString VirtualChannelInfo::name ( ) const

Definition at line 70 of file virtual_channel_info.cpp.

70 {
72}
QString name() const

References m_nameOverride, m_realChannelInfo, m_type, KoChannelInfo::name(), and REAL.

◆ pixelIndex()

int VirtualChannelInfo::pixelIndex ( ) const

Index of this channel in a pixel.

Returns
-1 for all virtual channels.

Definition at line 74 of file virtual_channel_info.cpp.

74 {
75 return m_pixelIndex;
76}

References m_pixelIndex.

◆ type()

VirtualChannelInfo::Type VirtualChannelInfo::type ( ) const

Definition at line 62 of file virtual_channel_info.cpp.

62 {
63 return m_type;
64}

References m_type.

◆ valueType()

KoChannelInfo::enumChannelValueType VirtualChannelInfo::valueType ( ) const

Definition at line 78 of file virtual_channel_info.cpp.

78 {
80}
enumChannelValueType channelValueType() const

References KoChannelInfo::channelValueType(), m_realChannelInfo, m_type, m_valueTypeOverride, and REAL.

Member Data Documentation

◆ m_channelSizeOverride

int VirtualChannelInfo::m_channelSizeOverride {4}
private

Definition at line 73 of file virtual_channel_info.h.

73{4};

◆ m_nameOverride

QString VirtualChannelInfo::m_nameOverride
private

Definition at line 71 of file virtual_channel_info.h.

◆ m_pixelIndex

int VirtualChannelInfo::m_pixelIndex {0}
private

Definition at line 68 of file virtual_channel_info.h.

68{0};

◆ m_realChannelInfo

KoChannelInfo* VirtualChannelInfo::m_realChannelInfo {nullptr}
private

Definition at line 69 of file virtual_channel_info.h.

69{nullptr};

◆ m_type

Type VirtualChannelInfo::m_type {REAL}
private

Definition at line 67 of file virtual_channel_info.h.

67{REAL};

◆ m_valueTypeOverride

KoChannelInfo::enumChannelValueType VirtualChannelInfo::m_valueTypeOverride {KoChannelInfo::FLOAT32}
private

Definition at line 72 of file virtual_channel_info.h.


The documentation for this class was generated from the following files: