6#include <QtCore/QtGlobal>
7#if QT_VERSION >= 0x050000
8#include <QtCore/QtMath>
10#include <QtCore/qmath.h>
26#ifdef COLOR_COMPONENTS_COUNT
52 explicit CFastColor(
int componentsCount,
double value = 0);
62 CFastColor(std::initializer_list<double> values);
73 #if __cplusplus >= 202002L
74 template <
typename Iterator>
75 requires std::input_iterator<Iterator>
159#ifdef COLOR_COMPONENTS_COUNT
160 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
168#ifndef COLOR_COMPONENTS_COUNT
172#ifdef COLOR_COMPONENTS_COUNT
173 m_elementsCount = componentsCount;
175 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
176 m_elements[i] = value;
183#ifndef COLOR_COMPONENTS_COUNT
187#ifdef COLOR_COMPONENTS_COUNT
190 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
198#ifndef COLOR_COMPONENTS_COUNT
202#ifdef COLOR_COMPONENTS_COUNT
203 m_elementsCount = qMin(COLOR_COMPONENTS_COUNT,
static_cast<int>(values.size()));
204 Q_ASSERT(values.size() <= COLOR_COMPONENTS_COUNT);
206 for (
int i = 0; i < m_elementsCount; ++i){
207 m_elements[i] = *(values.begin() + i);
210 for (
int i = m_elementsCount; i < COLOR_COMPONENTS_COUNT; ++i){
217#if __cplusplus >= 202002L
218template <
typename Iterator>
219requires std::input_iterator<Iterator>
222 const size_t size = last - first;
224 for (
size_t i = 0; i < size; ++i, ++first) {
252 for (
int i = 0; i < elementsCount; ++i){
255 if ((component < 0) || (component > 1)){
266 int elementsCount = GetElementsCount();
270 for (
int i = 0; i < elementsCount; ++i){
271 retVal[i] = GetElement(i);
286 for (
int i = 0; i < elementsCount; ++i){
307 for (
int i = 0; i < commonSize; ++i){
323 for (
int i = 0; i < commonSize; ++i){
339 for (
int i = 0; i < commonSize; ++i){
355 for (
int i = 0; i < commonSize; ++i){
414#ifdef COLOR_COMPONENTS_COUNT
415 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
417 for (
int i = 0; i < elementsCount; ++i){
432#ifdef COLOR_COMPONENTS_COUNT
433 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
435 for (
int i = 0; i < elementsCount; ++i){
446#ifdef COLOR_COMPONENTS_COUNT
450 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
463#ifdef COLOR_COMPONENTS_COUNT
467 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
480#ifdef COLOR_COMPONENTS_COUNT
484 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
497#ifdef COLOR_COMPONENTS_COUNT
498 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
501 for (
int i = 0; i < elementsCount; ++i){
512#ifdef COLOR_COMPONENTS_COUNT
513 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
516 for (
int i = 0; i < elementsCount; ++i){
527#ifdef COLOR_COMPONENTS_COUNT
528 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
541#ifdef COLOR_COMPONENTS_COUNT
542 for (
int i = 0; i < COLOR_COMPONENTS_COUNT; ++i){
Color implementation with variable components number and fixed maximal number of components.
void SetAsLab(const icmm::CLab &lab)
void GetRounded(const imath::IDoubleManip &manipulator, CFastColor &result)
Get color after components value rounding with specified precision.
CFastColor(const icmm::CVarColor &color)
Constructor from iterator pair.
void GetNormalized(CFastColor &result) const
Get normalized color.
bool IsRoundedEqual(const CFastColor &color, const imath::IDoubleManip &manipulator) const
Check if two values are equal after rounding.
CFastColor operator*(const CFastColor &color) const
bool operator>(const CFastColor &vector) const
const CFastColor & operator*=(const CFastColor &color)
const CFastColor & operator/=(const CFastColor &color)
const CFastColor & operator+=(const CFastColor &color)
const CFastColor & operator-=(const CFastColor &color)
void Normalize()
Make this color to be normalized.
icmm::CLab GetAsLab() const
CFastColor operator/(const CFastColor &color) const
bool operator<(const CFastColor &vector) const
bool operator!=(const CFastColor &vector) const
bool Serialize(iser::IArchive &archive)
CFastColor()
Default constructor.
CFastColor & operator=(const CFastColor &color)
bool operator<=(const CFastColor &vector) const
bool IsSimilar(const CFastColor &color, double tolerance=I_BIG_EPSILON) const
Allows to compare two colors with tolerance.
CFastColor operator+(const CFastColor &color) const
bool IsNormalized() const
Check if this color value is normalized.
CFastColor(const imath::TVector< Size > &vector)
bool operator==(const CFastColor &vector) const
bool EnsureElementsCount(int count, double value=0)
imath::TFastVector< MAX_COLOR_COMPONENTS_COUNT > BaseClass
bool operator>=(const CFastColor &vector) const
Primitive for representation of CIE Lab color values.
Generic color implementation with variable number of color components.
Interface for all manipulation using values represent as double.
Optimized implementation of a variable-size vector with compile-time maximum capacity.
TFastVector< MaxSize, double > operator-() const
double GetDistance(const TFastVector< MaxSize, double > &vector) const
Return distance between two vectors.
TFastVector< MaxSize, double > & operator-=(const TFastVector< MaxSize, double > &vector)
TFastVector< MaxSize, double > & operator/=(double scalar)
bool SetElementsCount(int count, const double &value=double())
Set number of elements.
int GetElementsCount() const
Get number of elements.
TFastVector< MaxSize, double > & operator=(const TFastVector< MaxSize, double > &vector)
double m_elements[MaxSize]
TFastVector< MaxSize, double > & operator+=(const TFastVector< MaxSize, double > &vector)
const double & operator[](int i) const
TFastVector< MaxSize, double > & operator*=(double scalar)
Implementation of fixed-size mathematical vector with specified type of elements.
Represents an input/output persistence archive for object serialization.
static const double I_BIG_EPSILON
Contains color management classes.
uint qHash(const CFastColor &color, uint seed=0)
@ MAX_COLOR_COMPONENTS_COUNT