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 13 of file virtual_channel_info.cpp.

◆ VirtualChannelInfo() [2/2]

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

Definition at line 20 of file virtual_channel_info.cpp.

24 : m_type(type),
26 m_realChannelInfo(realChannelInfo)
27{
28 if (m_type == HUE) {
29 m_nameOverride = i18n("Hue");
32 } else if (m_type == SATURATION) {
33 m_nameOverride = i18n("Saturation");
36 } else if (m_type == LIGHTNESS) {
37 m_nameOverride = i18nc("Lightness HSI", "Lightness");
40 } else if (m_type == ALL_COLORS) {
41 const QList<KoChannelInfo*> channels = cs->channels();
42
44 m_valueTypeOverride = channels.first()->channelValueType();
45 m_channelSizeOverride = channels.first()->size();
46 }
47}
@ 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, KoColorSpace::colorModelId(), KoChannelInfo::FLOAT32, HUE, KoID::id(), LIGHTNESS, m_channelSizeOverride, m_nameOverride, m_type, m_valueTypeOverride, and SATURATION.

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 53 of file virtual_channel_info.cpp.

53 {
54 return m_realChannelInfo;
55}

References m_realChannelInfo.

◆ channelSize()

int VirtualChannelInfo::channelSize ( ) const

◆ isAlpha()

bool VirtualChannelInfo::isAlpha ( ) const

Definition at line 73 of file virtual_channel_info.cpp.

74{
75 return m_type == REAL &&
77}
@ 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 57 of file virtual_channel_info.cpp.

57 {
59}
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 61 of file virtual_channel_info.cpp.

61 {
62 return m_pixelIndex;
63}

References m_pixelIndex.

◆ type()

VirtualChannelInfo::Type VirtualChannelInfo::type ( ) const

Definition at line 49 of file virtual_channel_info.cpp.

49 {
50 return m_type;
51}

References m_type.

◆ valueType()

KoChannelInfo::enumChannelValueType VirtualChannelInfo::valueType ( ) const

Definition at line 65 of file virtual_channel_info.cpp.

65 {
67}
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: