#pragma once #include #include #include "iProperty_global.h" class I_PROPERTY_EXPORT ZxGradient { public: class ZxColorItem { public: ZxColorItem(int i = -1, QColor color = QColor()) { index = i; c = color; } bool operator<(const ZxColorItem& ci)const { return index < ci.index; } bool operator==(const ZxColorItem& ci)const { return index == ci.index; } public: int index; QColor c; }; enum ColorCount { CC_16 = 16, CC_32 = 32, CC_64 = 64, CC_128 = 128, CC_256 = 256 }; enum InterpolationMethod { IM_LINEAR }; public: ZxGradient(); QString toString(); void fromString( const QString& str ); public: static QColor getColor(int index, const ZxGradient& colorGradient); static QPixmap getColorGradientPixmap(const QRect& r, bool vertical, const ZxGradient& colorGradient); public: ColorCount m_eColorCount; InterpolationMethod m_eMethod; QVector m_vecColorItems; };