Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColor.cpp File Reference
#include "KoColor.h"
#include <QColor>
#include <QDomDocument>
#include <QRegularExpression>
#include "DebugPigment.h"
#include "KoColorModelStandardIds.h"
#include "KoColorProfile.h"
#include "KoColorSpace.h"
#include "KoColorSpaceRegistry.h"
#include "KoChannelInfo.h"
#include "kis_assert.h"
#include "kis_dom_utils.h"
#include <QGlobalStatic>
#include <KoConfig.h>

Go to the source code of this file.

Functions

QDebug operator<< (QDebug dbg, const KoColor &color)
 

Function Documentation

◆ operator<<()

QDebug operator<< ( QDebug dbg,
const KoColor & color )

Definition at line 693 of file KoColor.cpp.

694{
695 dbg.nospace() << "KoColor (" << color.colorSpace()->id();
696
697 const QList<KoChannelInfo*> channels = color.colorSpace()->channels();
698 for (auto it = channels.constBegin(); it != channels.constEnd(); ++it) {
699
700 KoChannelInfo *ch = (*it);
701
702 dbg.nospace() << ", " << ch->name() << ":";
703
704 switch (ch->channelValueType()) {
706 const quint8 *ptr = reinterpret_cast<const quint8*>(color.data() + ch->pos());
707 dbg.nospace() << *ptr;
708 break;
709 } case KoChannelInfo::UINT16: {
710 const quint16 *ptr = reinterpret_cast<const quint16*>(color.data() + ch->pos());
711 dbg.nospace() << *ptr;
712 break;
713 } case KoChannelInfo::UINT32: {
714 const quint32 *ptr = reinterpret_cast<const quint32*>(color.data() + ch->pos());
715 dbg.nospace() << *ptr;
716 break;
717 } case KoChannelInfo::FLOAT16: {
718
719#ifdef HAVE_OPENEXR
720 const half *ptr = reinterpret_cast<const half*>(color.data() + ch->pos());
721 dbg.nospace() << *ptr;
722#else
723 const quint16 *ptr = reinterpret_cast<const quint16*>(color.data() + ch->pos());
724 dbg.nospace() << "UNSUPPORTED_F16(" << *ptr << ")";
725#endif
726 break;
727 } case KoChannelInfo::FLOAT32: {
728 const float *ptr = reinterpret_cast<const float*>(color.data() + ch->pos());
729 dbg.nospace() << *ptr;
730 break;
731 } case KoChannelInfo::FLOAT64: {
732 const double *ptr = reinterpret_cast<const double*>(color.data() + ch->pos());
733 dbg.nospace() << *ptr;
734 break;
735 } case KoChannelInfo::INT8: {
736 const qint8 *ptr = reinterpret_cast<const qint8*>(color.data() + ch->pos());
737 dbg.nospace() << *ptr;
738 break;
739 } case KoChannelInfo::INT16: {
740 const qint16 *ptr = reinterpret_cast<const qint16*>(color.data() + ch->pos());
741 dbg.nospace() << *ptr;
742 break;
743 } case KoChannelInfo::OTHER: {
744 const quint8 *ptr = reinterpret_cast<const quint8*>(color.data() + ch->pos());
745 dbg.nospace() << "undef(" << *ptr << ")";
746 break;
747 }
748 }
749 }
750 dbg.nospace() << ")";
751 return dbg.space();
752}
qint32 pos() const
@ UINT8
use this for an unsigned integer 8bits channel
@ UINT16
use this for an integer 16bits channel
@ OTHER
Use this if the channel is neither an integer or a float.
@ INT16
use this for an integer 16bits channel
@ INT8
use this for an integer 8bits channel
@ FLOAT32
use this for a float 32bits channel
@ FLOAT16
use this for a float 16bits channel
@ UINT32
use this for an unsigned integer 21bits channel
@ FLOAT64
use this for a float 64bits channel
enumChannelValueType channelValueType() const
QString name() const
QList< KoChannelInfo * > channels
quint8 * data()
Definition KoColor.h:144
const KoColorSpace * colorSpace() const
return the current colorSpace
Definition KoColor.h:82

References KoColorSpace::channels, KoChannelInfo::channelValueType(), KoColor::colorSpace(), KoColor::data(), KoChannelInfo::FLOAT16, KoChannelInfo::FLOAT32, KoChannelInfo::FLOAT64, KoColorSpace::id, KoChannelInfo::INT16, KoChannelInfo::INT8, KoChannelInfo::name(), KoChannelInfo::OTHER, KoChannelInfo::pos(), KoChannelInfo::UINT16, KoChannelInfo::UINT32, and KoChannelInfo::UINT8.