void Blink1Pattern::play(QColor currentVirtualBlinkColor) { if(mplaying) return; mplaycount=0; mplaypos=0; mplaying=true; emit updatePlayIconOnUi(); t=new QTimer(this); count=activeTime()*1000/50; currentColor=0; startR=currentVirtualBlinkColor.red(); startG=currentVirtualBlinkColor.green(); startB=currentVirtualBlinkColor.blue(); if(count==0){ deltaR=(activeColor().red()-currentVirtualBlinkColor.red())*1.0; deltaG=(activeColor().green()-currentVirtualBlinkColor.green())*1.0; deltaB=(activeColor().blue()-currentVirtualBlinkColor.blue())*1.0; }else{ deltaR=(activeColor().red()-currentVirtualBlinkColor.red())*1.0/count; deltaG=(activeColor().green()-currentVirtualBlinkColor.green())*1.0/count; deltaB=(activeColor().blue()-currentVirtualBlinkColor.blue())*1.0/count; } t->setInterval(50); t->setSingleShot(true); connect(t,SIGNAL(timeout()),this,SLOT(update())); t->start(); emit changeColorOnVirtualBlink(QColor(startR,startG,startB),activeTime()); emit setColor(activeColor(),mname,activeTime()*1000); // convert to millis }
void Blink1Pattern::update() { if(!mplaying) return; t->stop(); delete t; t=NULL; currentColor++; if(currentColor<count){ startR+=deltaR; startG+=deltaG; startB+=deltaB; t=new QTimer(this); t->setInterval(50); t->setSingleShot(true); connect(t,SIGNAL(timeout()),this,SLOT(update())); t->start(); emit changeColorOnVirtualBlink(QColor(startR,startG,startB),activeTime()); }else{ currentColor=0; mplaypos++; if(mplaypos==colors.count()){ mplaypos=0; mplaycount++; } count=activeTime()*1000/50; currentColor=0; startR+=deltaR; startG+=deltaG; startB+=deltaB; if(count==0){ deltaR=(activeColor().red()-startR)*1.0; deltaG=(activeColor().green()-startG)*1.0; deltaB=(activeColor().blue()-startB)*1.0; }else{ deltaR=(activeColor().red()-startR)*1.0/count; deltaG=(activeColor().green()-startG)*1.0/count; deltaB=(activeColor().blue()-startB)*1.0/count; } t=new QTimer(this); t->setInterval(50); t->setSingleShot(true); connect(t,SIGNAL(timeout()),this,SLOT(update())); t->start(); emit changeColorOnVirtualBlink(QColor(startR,startG,startB),activeTime()); if(mplaycount==mrepeats+(mrepeats!=-1)?1:0){ stop(); return; } emit setColor(activeColor(),mname,activeTime()*1000); // convert to millis } }
void SubWindow::paintEvent( QPaintEvent * ) { QPainter p( this ); QRect rect( 0, 0, width(), m_titleBarHeight ); bool isActive = SubWindow::mdiArea()->activeSubWindow() == this; p.fillRect( rect, isActive ? activeColor() : p.pen().brush() ); // window border p.setPen( borderColor() ); // bottom, left, and right lines p.drawLine( 0, height() - 1, width(), height() - 1 ); p.drawLine( 0, m_titleBarHeight, 0, height() - 1 ); p.drawLine( width() - 1, m_titleBarHeight, width() - 1, height() - 1 ); // window icon QPixmap winicon( widget()->windowIcon().pixmap( m_buttonSize ) ); p.drawPixmap( 3, 3, m_buttonSize.width(), m_buttonSize.height(), winicon ); }
void C2DRenderUtils::RenderTest( float fTime ) { if(!s_debugTestLevel) { return; } const static float ktimeout = 5.0f; static float time = ktimeout; static int which = 0; const static int maxwhich = 2; time -= fTime; if( time < 0 ) { time=ktimeout; which++; if( which>maxwhich ) { which=0; } switch(which) { case 0: CryLogAlways("Full screen drawing"); break; case 1: CryLogAlways("Safe area drawing only (no scaling)"); break; case 2: CryLogAlways("Safe area drawing only & adapt to Y"); break; } } ScreenLayoutStates prev_state = m_pLayoutManager->GetState(); ColorF activeColor( 1.0f, 0.0f, 0.0f, 0.3f ); m_pRenderer->SetState(GS_BLSRC_SRCALPHA|GS_BLDST_ONEMINUSSRCALPHA|GS_NODEPTHTEST); switch(which) { case 0: //------------------ // Full screen drawing m_pLayoutManager->SetState(eSLO_DoNotAdaptToSafeArea|eSLO_ScaleMethod_None); RenderTest_CTRL(fTime, activeColor); break; case 1: //------------------ // Safe area drawing only (no scaling) m_pLayoutManager->SetState(eSLO_AdaptToSafeArea); activeColor = ColorF( 0.0f, 1.0f, 0.0f, 0.3f ); RenderTest_CTRL(fTime, activeColor); break; case 2 : //------------------ // Scale with Y m_pLayoutManager->SetState(eSLO_AdaptToSafeArea|eSLO_ScaleMethod_WithY); activeColor = ColorF( 0.0f, 0.0f, 1.0f, 0.3f ); RenderTest_CTRL(fTime, activeColor); break; } m_pLayoutManager->SetState(prev_state); }