204 Q_ASSERT_X(colors && base >= 0 && (base + count) <=
d->
cells->
size(),
"QGLColormap::setEntries",
205 "preconditions not met");
206 for (
int i = 0; i < count; ++i)
289 int idx =
find(color);
292 int mapSize =
size();
293 int mindist = 200000;
296 int b =
qBlue(color);
297 int rx, gx, bx, dist;
298 for (
int i = 0; i < mapSize; ++i) {
303 dist = rx * rx + gx * gx + bx * bx;
304 if (dist < mindist) {
QColor entryColor(int idx) const
Returns the QRgb value in the colorcell with index idx.
The QColor class provides colors based on RGB, HSV or CMYK values.
#define QT_END_NAMESPACE
This macro expands to.
void replace(int i, const T &t)
Replaces the item at index position i with value.
bool isEmpty() const
Returns true if the colormap is empty or it is not in use by a QGLWidget; otherwise returns false...
int size() const
Returns the number of colorcells in the colormap.
static struct QGLColormapData shared_null
void setEntry(int idx, QRgb color)
Set cell at index idx in the colormap to color color.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
QGLColormap()
Construct a QGLColormap.
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void setEntries(int count, const QRgb *colors, int base=0)
Set an array of cells in this colormap.
void detach()
Detaches this QGLColormap from the shared block.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the vector, searching forward from ind...
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
The QGLColormap class is used for installing custom colormaps into a QGLWidget.
const T & at(int i) const
Returns the item at index position i in the vector.
QRgb entryRgb(int idx) const
Returns the QRgb value in the colorcell with index idx.
int findNearest(QRgb color) const
Returns the index of the color that is the closest match to color color.
#define Q_ASSERT_X(cond, where, what)
QGLColormap & operator=(const QGLColormap &)
Assign a shallow copy of map to this QGLColormap.
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
int find(QRgb color) const
Returns the index of the color color.
~QGLColormap()
Dereferences the QGLColormap and deletes it if this was the last reference to it. ...
int size() const
Returns the number of items in the vector.
QRgb rgb() const
Returns the RGB value of the color.
static void cleanup(QGLColormapData *x)