コード例 #1
0
ファイル: renderthread.cpp プロジェクト: mvdnes/mandelbrotQt
//! [0]
RenderThread::RenderThread(QObject *parent)
    : QThread(parent)
{
    restart = false;
    abort = false;

    for (int i = 0; i < ColormapSize; ++i)
        colormap[i] = rgbFromWaveLength(380.0 + (i * 400.0 / ColormapSize));
}
コード例 #2
0
SimpleRGB::SimpleRGB(const char* identifier, const char* name)
   : ColorSchemeInterface(identifier, name)
{
   ColorMapSize = INITAL_COLORMAP_SIZE;
   ColorMap     = new unsigned int[ColorMapSize];
   Q_CHECK_PTR(ColorMap);
   for(unsigned int i = 0;i < ColorMapSize;i++) {
      ColorMap[i] = rgbFromWaveLength(380.0 + (i * 400.0 / ColorMapSize));
   }
}
コード例 #3
0
ファイル: util.cpp プロジェクト: ctredaktion/mikromosaik
QScriptValue rgbFromWaveLength(QScriptContext* context, QScriptEngine* engine)
{
    if (context->argumentCount() != 1)
        return QScriptValue::UndefinedValue;
    QRgb rgb = rgbFromWaveLength(context->argument(0).toNumber());
    QScriptValue result = engine->newArray(3);
    result.setProperty(0, qRed(rgb));
    result.setProperty(1, qGreen(rgb));
    result.setProperty(2, qBlue(rgb));
    return result;
}