|
Krita Source Code Documentation
|
The KisVisualColorModel class allows manipulating a KoColor using various color models. More...
#include <KisVisualColorModel.h>
Inheritance diagram for KisVisualColorModel:Classes | |
| struct | Private |
Public Types | |
| enum | ColorModel { None , Channel , HSV , HSL , HSI , HSY , YUV } |
Public Slots | |
| void | slotLoadACSConfig () |
| slotLoadACSConfig loads supported settings from Advanced Color Selector | |
| void | slotSetChannelValues (const QVector4D &values) |
| void | slotSetColor (const KoColor &c) |
| void | slotSetColorSpace (const KoColorSpace *cs) |
Signals | |
| void | sigChannelValuesChanged (const QVector4D &values, quint32 channelFlags) |
| void | sigColorModelChanged () |
| sigColorModelChanged is emitted whenever the color model changes. | |
| void | sigColorSpaceChanged () |
| sigColorSpaceChanged notifies that the color space from which the channel values are derived changed, and thus invalidating the current ones. | |
| void | sigNewColor (const KoColor &c) |
Public Member Functions | |
| QVector4D | channelValues () const |
| int | colorChannelCount () const |
| ColorModel | colorModel () const |
| const KoColorSpace * | colorSpace () const |
| KoColor | convertChannelValuesToKoColor (const QVector4D &values) const |
| QVector4D | convertKoColorToChannelValues (KoColor c) const |
| void | copyState (const KisVisualColorModel &other) |
| Copy the internal state of another KisVisualColorModel. | |
| KoColor | currentColor () const |
| bool | isHSXModel () const |
| KisVisualColorModel () | |
| QVector4D | maxChannelValues () const |
| void | setMaxChannelValues (const QVector4D &maxValues) |
| void | setRGBColorModel (ColorModel model) |
| Set the HSX color model used for RGB color spaces. | |
| bool | supportsExposure () const |
| ~KisVisualColorModel () override | |
Private Member Functions | |
| void | emitChannelValues () |
| void | loadColorSpace (const KoColorSpace *cs) |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
The KisVisualColorModel class allows manipulating a KoColor using various color models.
This enables different widgets to easily manipulate the same color representation (like HSV channels of an RGB color etc.) in a synchronized way without having to know the details of the underlying color space. NOTE: This class is meant to be shared between GUI classes using KisVisualColorModelSP, so DO NOT SET a QObject parent in this case.
Definition at line 31 of file KisVisualColorModel.h.
| KisVisualColorModel::KisVisualColorModel | ( | ) |
Definition at line 48 of file KisVisualColorModel.cpp.
References KisColorSelectorConfiguration::fromString(), and m_d.
|
override |
Definition at line 57 of file KisVisualColorModel.cpp.
| QVector4D KisVisualColorModel::channelValues | ( | ) | const |
Definition at line 129 of file KisVisualColorModel.cpp.
References m_d.
| int KisVisualColorModel::colorChannelCount | ( | ) | const |
Definition at line 134 of file KisVisualColorModel.cpp.
References m_d.
| KisVisualColorModel::ColorModel KisVisualColorModel::colorModel | ( | ) | const |
Definition at line 139 of file KisVisualColorModel.cpp.
References m_d.
| const KoColorSpace * KisVisualColorModel::colorSpace | ( | ) | const |
Definition at line 189 of file KisVisualColorModel.cpp.
References m_d.
| KoColor KisVisualColorModel::convertChannelValuesToKoColor | ( | const QVector4D & | values | ) | const |
Definition at line 204 of file KisVisualColorModel.cpp.
References Channel, KoColorSpace::channelCount(), KoColor::colorSpace(), KoColor::data(), KoColorSpace::fromNormalisedChannelsValue(), HSI, HSIToRGB(), HSL, HSLToRGB(), HSV, HSVToRGB(), HSYToRGB(), and m_d.
| QVector4D KisVisualColorModel::convertKoColorToChannelValues | ( | KoColor | c | ) | const |
Definition at line 271 of file KisVisualColorModel.cpp.
References Channel, KoColorSpace::channelCount(), KoColor::colorSpace(), KoColor::convertTo(), KoColor::data(), HSI, HSL, HSV, HSY, m_d, RGBToHSI(), RGBToHSL(), RGBToHSV(), and RGBToHSY().
| void KisVisualColorModel::copyState | ( | const KisVisualColorModel & | other | ) |
Copy the internal state of another KisVisualColorModel.
This will Q_EMIT all necessary signals to update widgets so they can reflect the new state correctly.
| other | the model to copy |
Definition at line 162 of file KisVisualColorModel.cpp.
References channelValues(), colorSpace(), m_d, setRGBColorModel(), slotSetChannelValues(), and slotSetColorSpace().
| KoColor KisVisualColorModel::currentColor | ( | ) | const |
Definition at line 124 of file KisVisualColorModel.cpp.
References m_d.
|
private |
Definition at line 440 of file KisVisualColorModel.cpp.
References m_d, and sigChannelValuesChanged().
| bool KisVisualColorModel::isHSXModel | ( | ) | const |
Definition at line 194 of file KisVisualColorModel.cpp.
|
private |
Definition at line 386 of file KisVisualColorModel.cpp.
References KoChannelInfo::ALPHA, KoColorSpace::alphaPos(), Channel, KoColorSpace::channels, KoChannelInfo::channelType(), CMYKAColorModelID, KoColorSpace::colorDepthId(), KoColorSpace::colorModelId(), KoChannelInfo::displayPosition(), Float16BitsColorDepthID, Float32BitsColorDepthID, Float64BitsColorDepthID, KoChannelInfo::getUIMax(), HSY, KoColorProfile::isLinear(), KIS_ASSERT_X, LABAColorModelID, KoColorSpace::lumaCoefficients, m_d, KoColorSpace::profile(), RGBAColorModelID, and sigColorModelChanged().
| QVector4D KisVisualColorModel::maxChannelValues | ( | ) | const |
Definition at line 144 of file KisVisualColorModel.cpp.
References m_d.
| void KisVisualColorModel::setMaxChannelValues | ( | const QVector4D & | maxValues | ) |
Definition at line 149 of file KisVisualColorModel.cpp.
References convertKoColorToChannelValues(), emitChannelValues(), and m_d.
| void KisVisualColorModel::setRGBColorModel | ( | KisVisualColorModel::ColorModel | model | ) |
Set the HSX color model used for RGB color spaces.
Definition at line 172 of file KisVisualColorModel.cpp.
References convertKoColorToChannelValues(), emitChannelValues(), HSV, HSY, m_d, and sigColorModelChanged().
|
signal |
|
signal |
sigColorModelChanged is emitted whenever the color model changes.
This can either be due to a change in color space that uses a different channel model, or when the same color space gets represented in a different way, for example RGB representation switches from HSV to HSL etc. so the values of sigChannelValuesChanged() change meaning. Note: This will be followed by sigChannelValuesChanged() unless caused by a color space change, new channel values are not available yet when this signal occurs.
|
signal |
sigColorSpaceChanged notifies that the color space from which the channel values are derived changed, and thus invalidating the current ones.
|
slot |
slotLoadACSConfig loads supported settings from Advanced Color Selector
Definition at line 339 of file KisVisualColorModel.cpp.
References KisColorSelectorConfiguration::fromString(), HSI, KisColorSelectorConfiguration::hsiSH, HSL, KisColorSelectorConfiguration::hslSH, HSV, KisColorSelectorConfiguration::hsvSH, HSY, KisColorSelectorConfiguration::hsySH, KisColorSelectorConfiguration::IH, KIS_SAFE_ASSERT_RECOVER_NOOP, KisColorSelectorConfiguration::LH, m_d, setRGBColorModel(), KisColorSelectorConfiguration::SI, KisColorSelectorConfiguration::SL, KisColorSelectorConfiguration::SV, KisColorSelectorConfiguration::SV2, KisColorSelectorConfiguration::SY, KisColorSelectorConfiguration::Triangle, KisColorSelectorConfiguration::VH, and KisColorSelectorConfiguration::YH.
|
slot |
Definition at line 102 of file KisVisualColorModel.cpp.
References convertChannelValuesToKoColor(), m_d, sigChannelValuesChanged(), and sigNewColor().
Definition at line 61 of file KisVisualColorModel.cpp.
References KoColor::colorSpace(), KoColor::convertedTo(), convertKoColorToChannelValues(), emitChannelValues(), m_d, and slotSetColorSpace().
|
slot |
Definition at line 78 of file KisVisualColorModel.cpp.
References KoColorSpace::colorModelId(), colorSpace(), convertKoColorToChannelValues(), Float32BitsColorDepthID, KoID::id(), KoColorSpaceRegistry::instance(), loadColorSpace(), m_d, KoColorSpaceRegistry::p2020G10Profile(), KoColorSpaceRegistry::p2020PQProfile(), KoColorSpace::profile(), RGBAColorModelID, sigColorSpaceChanged(), and KoColorProfile::uniqueId().
| bool KisVisualColorModel::supportsExposure | ( | ) | const |
Definition at line 199 of file KisVisualColorModel.cpp.
References m_d.
|
private |
Definition at line 103 of file KisVisualColorModel.h.