Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColor.h File Reference
#include <QColor>
#include <QMetaType>
#include <QtGlobal>
#include "kritapigment_export.h"
#include "KoColorConversionTransformation.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorSpaceTraits.h"
#include <boost/operators.hpp>

Go to the source code of this file.

Classes

class  KoColor
 

Functions

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

Function Documentation

◆ operator<<()

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

Definition at line 692 of file KoColor.cpp.

693{
694 dbg.nospace() << "KoColor (" << color.colorSpace()->id();
695
696 const QList<KoChannelInfo*> channels = color.colorSpace()->channels();
697 for (auto it = channels.constBegin(); it != channels.constEnd(); ++it) {
698
699 KoChannelInfo *ch = (*it);
700
701 dbg.nospace() << ", " << ch->name() << ":";
702
703 switch (ch->channelValueType()) {
705 const quint8 *ptr = reinterpret_cast<const quint8*>(color.data() + ch->pos());
706 dbg.nospace() << *ptr;
707 break;
708 } case KoChannelInfo::UINT16: {
709 const quint16 *ptr = reinterpret_cast<const quint16*>(color.data() + ch->pos());
710 dbg.nospace() << *ptr;
711 break;
712 } case KoChannelInfo::UINT32: {
713 const quint32 *ptr = reinterpret_cast<const quint32*>(color.data() + ch->pos());
714 dbg.nospace() << *ptr;
715 break;
716 } case KoChannelInfo::FLOAT16: {
717
718#ifdef HAVE_OPENEXR
719 const half *ptr = reinterpret_cast<const half*>(color.data() + ch->pos());
720 dbg.nospace() << *ptr;
721#else
722 const quint16 *ptr = reinterpret_cast<const quint16*>(color.data() + ch->pos());
723 dbg.nospace() << "UNSUPPORTED_F16(" << *ptr << ")";
724#endif
725 break;
726 } case KoChannelInfo::FLOAT32: {
727 const float *ptr = reinterpret_cast<const float*>(color.data() + ch->pos());
728 dbg.nospace() << *ptr;
729 break;
730 } case KoChannelInfo::FLOAT64: {
731 const double *ptr = reinterpret_cast<const double*>(color.data() + ch->pos());
732 dbg.nospace() << *ptr;
733 break;
734 } case KoChannelInfo::INT8: {
735 const qint8 *ptr = reinterpret_cast<const qint8*>(color.data() + ch->pos());
736 dbg.nospace() << *ptr;
737 break;
738 } case KoChannelInfo::INT16: {
739 const qint16 *ptr = reinterpret_cast<const qint16*>(color.data() + ch->pos());
740 dbg.nospace() << *ptr;
741 break;
742 } case KoChannelInfo::OTHER: {
743 const quint8 *ptr = reinterpret_cast<const quint8*>(color.data() + ch->pos());
744 dbg.nospace() << "undef(" << *ptr << ")";
745 break;
746 }
747 }
748 }
749 dbg.nospace() << ")";
750 return dbg.space();
751}
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.