void PulsingColorAnimation::sinusSignal(double time) { double fac = std::sin(pulsation() * (time - delay())); /* QColor meanHSV = meanColor().toHsv(); QColor varHSV = varColor().toHsv(); int h = meanHSV.hue() + int(fac * varHSV.hue()); if (h>255) h=255; if (h<0) h=0; int s = meanHSV.saturation() + int(fac * varHSV.saturation()); if (s>255) s=255; if (s<0) s=0; int v = meanHSV.value() + int(fac * varHSV.value()); if (v>255) v=255; if (v<0) v=0; m_color.setHsv(h, s, v) ; */ int r = meanColor().red() + int(fac * varColor().red()); if (r>255) r-=255; if (r<0) r+=255; int g = meanColor().green() + int(fac * varColor().green()); if (g>255) g-=255; if (g<0) g+=255; int b = meanColor().blue() + int(fac * varColor().blue()); if (b>255) b-=255; if (b<0) b+=255; m_color.setRgb(r, g, b); }
void PulsingColorAnimation::saveToJSON(QJsonObject & obj) { obj["fromStart"] = fromStart(); obj["duration"] = duration(); QColor lowerColor(meanColor().red() - varColor().red(), meanColor().green() - varColor().green(), meanColor().blue() - varColor().blue()); obj["lowerColor"] = lowerColor.name(); QColor upperColor(meanColor().red() + varColor().red(), meanColor().green() + varColor().green(), meanColor().blue() + varColor().blue()); obj["upperColor"] = upperColor.name(); obj["frequency"] = pulsation() / (2 * M_PI); obj["delay"] = delay(); obj["pulseSignal"] = pulseSignalName(); obj["priority"] = priority(); }
void EtaKeyboard::closeEvent(QCloseEvent *event) { preferences = new QSettings(configpath,QSettings::IniFormat); preferences->beginGroup("etak"); QVariant varlanguage(Settings::getLanguage()); preferences->setValue("Language",varlanguage); QVariant varColor(color); preferences->setValue("Color",varColor); QVariant varAutoShow(Settings::getAutoShowBool()); preferences->setValue("AutoShow",varAutoShow); preferences->endGroup(); event->accept(); }
void CompressInterface::iterate() { map<size_t, vector<size_t> >::iterator mapIter; _varClusterCountOld = _varClustering.size(); _facClusterCountOld = _facClustering.size(); // determine new colors of variables _varClustering.clear(); for (size_t i=0; i<_cfg.nrVars(); i++) { size_t hashVal = varColor(i); mapIter = _varClustering.find(hashVal); if (mapIter == _varClustering.end()) { _varClustering[hashVal] = vector<size_t>(1, i); } else { mapIter->second.push_back(i); } _varSigs[i] = hashVal; } if( _verbose >= 4 ) { dai::operator <<(cout, _varInbox); cout << endl; } // determine new colors of factors _facClustering.clear(); for (size_t i=0; i<_cfg.nrFactors(); i++) { size_t hashVal = facColor(i); mapIter = _facClustering.find(hashVal); if (mapIter == _facClustering.end()) { _facClustering[hashVal] = vector<size_t>(1, i); } else { mapIter->second.push_back(i); } _facSigs[i] = hashVal; } if( _verbose >= 4 ) { dai::operator <<(cout, _facInbox); cout << endl; } }