17 #ifndef GEPETTO_GUI_COLORMAP_HH
18 #define GEPETTO_GUI_COLORMAP_HH
29 static QColor
interpolate (std::size_t nbColors, std::size_t index)
32 qDebug() <<
"Nb colors:" << nbColors <<
"and index" << index;
33 return QColor::fromHslF((qreal)index / (qreal)nbColors, 1, 0.5);
42 std::size_t val = (nbColors > 0)?nbColors:1;
43 for (log2up_ = 0; val; ++log2up_, val >>= 1) mask_ = 2*mask_ + 1;
52 color[0] = (float)c.redF();
53 color[1] = (float)c.greenF();
54 color[2] = (float)c.blueF();
55 color[3] = (float)c.alphaF();
59 QColor color =
getColor (currentIndex_);
65 currentIndex_ = index % nbColors_;
70 std::size_t
remap (
const std::size_t& index)
const {
72 std::size_t input = index;
73 for (std::size_t i = 0; i < log2up_; ++i) {
82 std::size_t nbColors_;
85 std::size_t currentIndex_;
90 #endif // GEPETTO_GUI_COLORMAP_HH