void ofxMuiColorPicker::generatePicker (int w, int h)
{
    // draw color.
    int cw = w - 0.2f*w; // the color width
    for( int i=0; i<cw; i++ ) 
    {
        float nColorPercent = i / (float)cw;
        float rad = (-360.0f * nColorPercent) * (PI / 180.0f);
        int nR = (int)(cos(rad) * 127.0f + 128);// << 16;
        int nG = (int)(cos(rad + 2.0f * PI / 3.0f) * 127.0f + 128.0f);// << 8;
        int nB = (int)(cos(rad + 4.0f * PI / 3.0f) * 127.0f + 128.0f);
        //int nColor = nR | nG | nB;
        
        ofColor nColor = ofColor(nR,nG,nB);
        
        setGradient( i, 0, 1, h/2, 0xFFFFFF, nColor );
        setGradient( i, (h/2), 1, h/2, nColor, 0x000000 );
    }
    
    // 
    int gsWidth = (w - cw) / 2;
    int bwWidth = gsWidth;
    
    // draw black/white.
    drawRect( cw, 0,   gsWidth, h/2, 0xFFFFFF );
    drawRect( cw, h/2, gsWidth, h/2, 0        );
    
    // draw grey scale.
    for( int j=0; j<h; j++ ) {
        int g = 255 - (int)(j/(float)(h-1) * 255 );

        drawRect( cw+gsWidth, j, gsWidth, 1, ofColor( g, g, g ) );
    }

}
Exemple #2
0
void MyFracWindow::readParameters()
{
	KConfig* config = kapp->config();
	config->setGroup("Parameters");

	_sliderIterations->setValue(config->readNumEntry("Iterations", 2));
	_sliderQuality->setValue(config->readNumEntry("Quality", 5));
	_sliderScale->setValue(config->readNumEntry("Scale", 15));
	_sliderOffset->setValue(config->readNumEntry("Offset", 0));
	_sliderScroll->setValue(config->readNumEntry("Scroll", 25));
	_sliderHeight->setValue(config->readNumEntry("Height", 20));
	
	_comboGrid->setCurrentItem(config->readNumEntry("Grid", 1));
	setGridSize(_comboGrid->currentItem());

	QColor black(0, 0, 0);
	_colorButton->setColor(config->readColorEntry("Background", &black));

	QStringList list = config->readListEntry("Gradient");
	if (list.size() == 4) {
		Gradient gradient(list[0] == "hsv");
		gradient.getSpline(0).fromString(list[1]);
		gradient.getSpline(1).fromString(list[2]);
		gradient.getSpline(2).fromString(list[3]);
		setGradient(gradient);
	} else
		setGradient(_presets.getDefault());

	QSize defSize(800, 600);
	_imageSize = config->readSizeEntry("ImageSize", &defSize);
	_imageMime = config->readEntry("ImageMime", "image/png");
	_imagePath = config->readEntry("ImagePath");
}
void AttitudeIndicator::keyPressEvent(QKeyEvent *e)
{
    switch(e->key())
    {
        case Qt::Key_Plus:
            setGradient(gradient() + 0.05);
            break;

        case Qt::Key_Minus:
            setGradient(gradient() - 0.05);
            break;

        default:
            QwtDial::keyPressEvent(e);
    }
}
ChromoConditions::ChromoConditions(double iColumnLength,
                                   double iColumnDiameter,
                                   double iColumnPoreSize,
                                   Gradient iGradient,
                                   double iSecondSolventConcentrationA,
                                   double iSecondSolventConcentrationB,
                                   double iDelayTime,
                                   double iFlowRate,
                                   double iDV,
                                   double iColumnRelativeStrength,
                                   double iColumnVpToVtot,
                                   double iColumnPorosity,
                                   double iTemperature)
                                   throw(ChromoConditionsException)
{
    // Set an empty gradient to prevent recalculation of SSConcentrations.
    mGradient = Gradient();
    setMixingCorrection(false);
    setColumnLength(iColumnLength);
    setColumnDiameter(iColumnDiameter);
    setColumnPoreSize(iColumnPoreSize);
    setColumnVpToVtot(iColumnVpToVtot);
    setColumnPorosity(iColumnPorosity);
    setTemperature(iTemperature);
    setColumnRelativeStrength(iColumnRelativeStrength);
    setFlowRate(iFlowRate);
    setDV(iDV);
    setDelayTime(iDelayTime);
    setSecondSolventConcentrationA(iSecondSolventConcentrationA);
    setSecondSolventConcentrationB(iSecondSolventConcentrationB);
    setGradient(iGradient);
}
Exemple #5
0
void MainWindow::on_actionLoad_palette_triggered()
{
    QString filepath = QFileDialog::getOpenFileName(this, QString("Select the palette to load"), lastDir, "Palettes (*.palette)");
    if (filepath == NULL) return;
    lastDir = filepath.left(filepath.lastIndexOf(QChar('/')));
    this->current = ORIGINAL;
    ui->actionAutoPalette->setChecked(false);
    setGradient(new Gradient(filepath));
}
void FillTab::initialize(QBrush *b) {
  setColor(b->color());
  setStyle(b->style());

  if (const QGradient *gradient = b->gradient()) {
    setGradient(*gradient);
  } else {
    setUseGradient(false);
  }
}
int AttitudeIndicator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtDial::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setGradient((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 1: setAngle((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
CImplicitGradient::CImplicitGradient()
{
    CImplicitModuleBase::registerDoubleInput("X1",[this] (double d) { this->setX1 (d); });
    CImplicitModuleBase::registerDoubleInput("X2",[this] (double d) { this->setX2 (d); });
    CImplicitModuleBase::registerDoubleInput("Y1",[this] (double d) { this->setY1 (d); });
    CImplicitModuleBase::registerDoubleInput("Y2",[this] (double d) { this->setY2 (d); });
    CImplicitModuleBase::registerDoubleInput("Z1",[this] (double d) { this->setZ1 (d); });
    CImplicitModuleBase::registerDoubleInput("Z2",[this] (double d) { this->setZ2 (d); });
    CImplicitModuleBase::registerDoubleInput("W1",[this] (double d) { this->setW1 (d); });
    CImplicitModuleBase::registerDoubleInput("W2",[this] (double d) { this->setW2 (d); });
    CImplicitModuleBase::registerDoubleInput("U1",[this] (double d) { this->setU1 (d); });
    CImplicitModuleBase::registerDoubleInput("U2",[this] (double d) { this->setU2 (d); });
    CImplicitModuleBase::registerDoubleInput("V1",[this] (double d) { this->setV1 (d); });
    CImplicitModuleBase::registerDoubleInput("V2",[this] (double d) { this->setV2 (d); });
    
    setGradient(0,1,0,1,0,0,0,0,0,0,0,0);
}
Exemple #9
0
void Palette::rollback()
{
    for (ColVector::iterator i = mColVector.begin(), iEnd = mColVector.end();
            i != iEnd; ++i)
    {
        if (i->grad != i->committedGrad)
            setGradient(i->type, i->committedGrad);

        setGradientDelay(i->type, i->committedDelay);
        setColor(i->type, i->committedColor.r, i->committedColor.g,
                 i->committedColor.b);
        if (i->grad == PULSE)
        {
            i->testColor.r = i->committedColor.r;
            i->testColor.g = i->committedColor.g;
            i->testColor.b = i->committedColor.b;
        }
    }
}
Exemple #10
0
void KPrBrushProperty::slotReset()
{
    if ( m_brush.gType == BCT_PLAIN )
        m_brush.gType = BCT_GHORZ;
    setQBrush( m_brush.brush );
    setGradient( m_brush.gColor1,
                 m_brush.gColor2,
                 m_brush.gType,
                 m_brush.unbalanced,
                 m_brush.xfactor,
                 m_brush.yfactor );

    int panelIndex;
    if( m_brush.fillType == FT_BRUSH && m_brush.brush.style() == QBrush::NoBrush )
        panelIndex = 2;
    else
        panelIndex = (int)m_brush.fillType;

    m_typeCombo->setCurrentItem( panelIndex );
    slotTypeChanged( panelIndex );
}
GradientRangeEditor::GradientRangeEditor( QWidget *parent ):QWidget( parent ),
	pointPen( QPen( QColor( 255, 255, 255, 191 ), 1 ) ),
	pointBrush( QBrush( QColor( 191, 191, 191, 127 ) ) ),
	movedPoint( nothingMoved )
{
	QPixmap pm( 20, 20 );

	QPainter pmp( &pm );
		pmp.fillRect( 0, 0, 10, 10, Qt::lightGray );
		pmp.fillRect( 10, 10, 10, 10, Qt::lightGray );
		pmp.fillRect( 0, 10, 10, 10, Qt::darkGray );
		pmp.fillRect( 10, 0, 10, 10, Qt::darkGray );
	pmp.end();

	QPalette pal = palette();
	pal.setBrush( backgroundRole(), QBrush( pm ) );
	setAutoFillBackground( true );
	setPalette( pal );

	setGradient( QLinearGradient( QPointF( 0.1, 0.1 ), QPointF( 0.9, 0.9 ) ) );
	setMinimumSize( QSize( 64, 64 ) );
}
Exemple #12
0
void UserPalette::rollback()
{
    for (Colors::iterator i = mColors.begin(), iEnd = mColors.end();
         i != iEnd; ++i)
    {
        if (i->grad != i->committedGrad)
            setGradient(i->type, i->committedGrad);

        const gcn::Color &committedColor = i->committedColor;
        setGradientDelay(i->type, i->committedDelay);
        setColor(i->type, committedColor.r,
                 committedColor.g, committedColor.b);

        if (i->grad == PULSE)
        {
            gcn::Color &testColor = i->testColor;
            testColor.r = committedColor.r;
            testColor.g = committedColor.g;
            testColor.b = committedColor.b;
        }
    }
}
Exemple #13
0
int main(void)
{
 setGradient(blue,yellow);
 fillRoundRect(50,50,70,70,20);
}
void QQuickRectangle::resetGradient()
{
    setGradient(0);
}