예제 #1
0
void TestController::onInputValueChanged() {
    //        FL_LOG("-----------------------");
    QColor from_color(Qt::white);
    QColor to_color(0, 200, 0);
    for (int i = 0; i < getModel().numberOfOutputLVars(); ++i) {
        getModel().outputLVar(i)->output().clear();
    }
    for (int i = 0; i < getModel().ruleBlock(0)->numberOfRules(); ++i) {
        fl::FuzzyRule& rule = *getModel().ruleBlock(0)->rule(i);
        fl::flScalar degree = rule.firingStrength();

        int red, green, blue, alpha;
        GuiCanvas::ColorGradient(from_color.red(), from_color.green(),
                                 from_color.blue(), from_color.alpha(), to_color.red(), to_color.green(),
                                 to_color.blue(), to_color.alpha(), (int) (degree * 255), red, green, blue, alpha);

        QColor color = QColor(red, green, blue, alpha);

        getView().getUi().lsw_test_rules->item(i)->setBackground(QBrush(color));
        getView().getUi().lsw_test_rules_activation->item(i)->setBackground(QBrush(
                    color));
        getView().getUi().lsw_test_rules_activation->item(i)->setText(
            QString::number(degree, 'f', 3));
        rule.fire(degree);
    }
    emit forceUpdate();
}
예제 #2
0
      static void clear( color c = white ){
         int d = from_color( c );
	      LCD_SetCursor( 0x00, 0x0000 );      
   	   Write_Cmd( 0x22 ); // write RAM prepare             
	      for( int index = 0; index < 76800; index++ ){
		      Write_Dat( d );    
   	   } 
      }
예제 #3
0
      static void pixel_write( vector p, color c ){
	      LCD_SetCursor( p.x_get(), p.y_get() );                                              
	      Write_Cmd( 0x22 ); // write RAM prepare                                          
	      Write_Dat( from_color( c )); 	         
      }