//! [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)); }
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)); } }
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; }