You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.2 KiB
C++
76 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <QColor>
|
|
#include <QPixmap>
|
|
#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<ZxColorItem> m_vecColorItems;
|
|
};
|
|
|
|
|
|
|
|
|