Ejemplo n.º 1
0
void ColorWheel::mouseMoveEvent(QMouseEvent* e) {
    lastPos_ = e->pos();

    if (!mouseDown_) return;

    if (wheelRegion_.contains(lastPos_) && inWheel_) {
        QColor color = posColor(lastPos_);
        hueChanged(color.hue());
    } else if (squareRegion_.contains(lastPos_) && inSquare_) {
        QColor color = posColor(lastPos_);
        svChanged(color);
    } else {
        int length = qMin(width(), height());
        QPoint center(length/2, length/2);

        if (inWheel_) {
            int r =  length / 2;
            double x0 = lastPos_.x()-center.x();
            double y0 = lastPos_.y()-center.y();
            double vNorm = qSqrt(qPow(x0,2)+qPow(y0,2));
            double x1 = r*(x0/vNorm);
            double y1 = r*(y0/vNorm);
            x1 += center.x();
            y1 += center.y();
            QColor color = posColor(QPoint(x1, y1));
            hueChanged(color.hue());
        } else if (inSquare_) {
            int w = qMin(width(), height());
            // radius of outer circle
            qreal r = w/2-margin_;
            // radius of inner circle
            qreal ir = r-wheelWidth_;
            // left corner of square
            qreal m = w/2.0-ir/qSqrt(2);
            float x0 = 0.0f;
            float y0 = 0.0f;
            float w0 = squareRegion_.boundingRect().width();

            if (lastPos_.x() > m + w0)
                x0 = m + w0;
            else if (lastPos_.x() < m)
                x0 = m;
            else
                x0 = lastPos_.x();

            if (lastPos_.y() > m + w0)
                y0 = m + w0;
            else if (lastPos_.y() < m)
                y0 = m;
            else
                y0 = lastPos_.y();

            QColor color = posColor(QPoint(x0, y0));
            svChanged(color);
        }
    }
}
Ejemplo n.º 2
0
void ColorWheel::mouseMoveEvent(QMouseEvent *event)
{
    lastPos = event->pos();
    if( !mouseDown ) return;
    if(wheelRegion.contains(lastPos) && inWheel){
        QColor color = posColor(lastPos);
        hueChanged(color.hue());
    }else{
        // TODO: due with cursor out of region after press
        //        int length = qMin(width(), height());
        //        QPoint center(length/2, length/2);
        //        int R = qSqrt(qPow(qAbs(lastPos.x()), 2)
        //                      + qPow(qAbs(lastPos.y()), 2));
        //        if(inWheel){
        //            int r =  length / 2;
        //            r += qSqrt(qPow(center.x(), 2) + qPow(center.y(), 2));
        //            int x0 = r/R * qAbs(lastPos.x());
        //            int y0 = r/R * qAbs(lastPos.y());
        //            QColor color = posColor(QPoint(x0, y0));
        //            hueChanged(color.hue());
        //        }else if(inSquare){
        //            //
        //        }
    }
}
Ejemplo n.º 3
0
void NQColorWheel::mouseMoveEvent(QMouseEvent *event)
{
    lastPosition_ = event->pos();

    if (!mousePressed_) return;

    if (insideWheel_) {
        QColor color = colorFromPosition(lastPosition_);
        if (color.isValid()) hueChanged(color.hue());
    } else if (insideSquare_){
        QColor color = colorFromPosition(lastPosition_);
        if (color.isValid()) svChanged(color);
    } else {
        // TODO: due with cursor out of region after press
        //        int length = qMin(width(), height());
        //        QPoint center(length/2, length/2);
        //        int R = qSqrt(qPow(qAbs(lastPos.x()), 2)
        //                      + qPow(qAbs(lastPos.y()), 2));
        //        if(inWheel){
        //            int r =  length / 2;
        //            r += qSqrt(qPow(center.x(), 2) + qPow(center.y(), 2));
        //            int x0 = r/R * qAbs(lastPos.x());
        //            int y0 = r/R * qAbs(lastPos.y());
        //            QColor color = posColor(QPoint(x0, y0));
        //            hueChanged(color.hue());
        //        }else if(inSquare){
        //            //
        //        }
    }
}
Ejemplo n.º 4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QImage *ppm = new QImage(":/ico/egshuai.ico");
    ui->aboutlable->setPixmap(QPixmap::fromImage(*ppm));
    ui->aboutlable->resize(ppm->width(),ppm->height());
    /*IP工具相关*/
    findipport=new FindipPort();
    httpreply=new HttpReply();
    connect(findipport,SIGNAL(signalres(QString,QColor)),ui->textEdit_2,SLOT(addcolortext(QString,QColor)));
    connect(httpreply,SIGNAL(signalres(QString,QColor)),ui->textEdit_2,SLOT(addcolortext(QString,QColor)));
    /*颜色编辑器相关*/
    colorProcessor=new ColorProcessor(ui->hSelector, ui->colorselect);

    connect( ui->hSelector, SIGNAL(hueChanged(QColor)), ui->colorselect, SLOT(changeHue(QColor)));
    connect(ui->colorselect,SIGNAL(colorChanged(QColor)),ui->widget_2,SLOT(changeColor(QColor)));
    connect(ui->colorselect,SIGNAL(colorChanged(QColor)),this,SLOT(updateColorText(QColor)));

    connect(ui->screenimg,SIGNAL(colorchanged(QColor)),ui->widget_2,SLOT(changeColor(QColor)));
    connect(ui->screenimg,SIGNAL(colorchanged(QColor)),ui->colorselect, SLOT(changeHue(QColor)));
    connect(ui->screenimg,SIGNAL(colorchanged(QColor)),this,SLOT(updateColorText(QColor)));
    connect(ui->screenimg,SIGNAL(colorchanged(QColor)),ui->hSelector,SLOT(colorchanged(QColor)));

    connect( ui->HSV, SIGNAL(textEdited(QString)), this, SLOT(updateColorHSV(QString)) );
    connect( ui->RGB, SIGNAL(textEdited(QString)), this, SLOT(updateColorRGB(QString)) );
    connect( ui->CMYK, SIGNAL(textEdited(QString)), this, SLOT(updateColorCMYK(QString)) );
    connect( ui->Hex, SIGNAL(textEdited(QString)), this, SLOT(updateColorHex(QString)) );
}
Ejemplo n.º 5
0
void BbVideoWindowControl::setHue(int hue)
{
    if (m_hue != hue) {
        m_hue = hue;
        updateHue();
        emit hueChanged(m_hue);
    }
}
Ejemplo n.º 6
0
void HueControl::setHue(int newHue)
{
    if (m_color.hsvHue() == newHue)
        return;
    m_color.setHsv(newHue, m_color.hsvSaturation(), m_color.value());
    update();
    emit hueChanged(m_color.hsvHue());
}
Ejemplo n.º 7
0
void QGstreamerVideoWidgetControl::setHue(int hue)
{
    if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue")) {
        g_object_set(G_OBJECT(m_videoSink), "hue", hue * 10, NULL);

        emit hueChanged(hue);
    }
}
Ejemplo n.º 8
0
void HueControl::setCurrent(int y)
{
    y = clamp(y, 0, 120);
    int oldAlpha = m_color.alpha();
    m_color.setHsv((y * 359)/120, m_color.hsvSaturation(), m_color.value());
    m_color.setAlpha(oldAlpha);
    update(); // redraw pointer
    emit hueChanged(m_color.hsvHue());
}
void ColorEditor::setHue(int hue)
{
    Q_ASSERT(hue >= 0 && hue <= 359);

    if (d->hueSlider->value() != hue) {
        d->hueSlider->setValue(hue);

        emit hueChanged(hue);
    }
}
Ejemplo n.º 10
0
void Vmr9VideoWindowControl::setHue(int hue)
{
    m_hue = hue;

    m_dirtyValues |= ProcAmpControl9_Hue;

    setProcAmpValues();

    emit hueChanged(hue);
}
Ejemplo n.º 11
0
void ColorWheel::mousePressEvent(QMouseEvent *event)
{
    lastPos = event->pos();
    if(wheelRegion.contains(lastPos)){
        inWheel = true;
        QColor color = posColor(lastPos);
        hueChanged(color.hue());
    }

    mouseDown = true;
}
Ejemplo n.º 12
0
void ColorBox::setHue(int newHue)
{
    if (m_color.hsvHue() == newHue)
        return;

    int oldAlpha = m_color.alpha();
    m_color.setHsv(newHue,m_color.hsvSaturation(),m_color.value());
    m_color.setAlpha(oldAlpha);
    update();
    emit hueChanged();
    emit colorChanged();
}
void Evr9VideoWindowControl::setHue(int hue)
{
    if (m_hue == hue)
        return;

    m_hue = hue;

    m_dirtyValues |= DXVA2_ProcAmp_Hue;

    setProcAmpValues();

    emit hueChanged(hue);
}
Ejemplo n.º 14
0
bool VideoOutput::onSetHue(qreal hue)
{
    if (!isAvailable())
        return false;
    DPTR_D(VideoOutput);
    // not call onSetXXX here, otherwise states in impl will not change
    d.impl->setHue(hue);
    if (hue != d.impl->hue()) {
        return false;
    }
    emit hueChanged(hue);
    return true;
}
Ejemplo n.º 15
0
void ColorWheel::setColor(const QColor& color) {
    if (color == currentColor_) return;

    if (color.hue() != currentColor_.hue())
        hueChanged(color.hue());

    if (color.saturation() != currentColor_.saturation()
        || color.value() != currentColor_.value())
        svChanged(color);

    update();
    emit colorChange(color);
}
Ejemplo n.º 16
0
void ColorWheel::setColor(const QColor &color)
{
    if(color == current) return;
    if(color.hue() != current.hue()){
        hueChanged(color.hue());
    }

    if( color.saturation() != current.saturation()
            || color.value() != current.value() ){
        svChanged(color);
    }

    update();
    emit colorChange(color);
}
Ejemplo n.º 17
0
void ColorBox::setColor(const QColor &color)
{
    if (m_color == color)
        return;

    int oldsaturation = m_color.hsvSaturation();
    int oldvalue = m_color.value();
    int oldhue = m_color.hsvHue();
    int oldAlpha = m_color.alpha();
    m_color=color;
    update();
    if (oldhue != m_color.hsvHue()) emit hueChanged();
    if (oldsaturation != saturation()) emit saturationChanged();
    if (oldvalue != value()) emit valueChanged();
    if (oldAlpha != alpha()) emit alphaChanged();
}
Ejemplo n.º 18
0
void ColorWheel::mousePressEvent(QMouseEvent *event)
{
    QPoint lastPos = event->pos();
    if (m_squareRegion.contains(lastPos))
    {
        m_isInWheel = false;
        m_isInSquare = true;
        QColor color = pickColor(lastPos);
        svChanged(color);
    }
    else if (m_wheelRegion.contains(lastPos))
    {
        m_isInWheel = true;
        m_isInSquare = false;
        QColor color = pickColor(lastPos);
        hueChanged(color.hue());
    }
}
Ejemplo n.º 19
0
void NQColorWheel::mousePressEvent(QMouseEvent *event)
{
    lastPosition_ = event->pos();

    if (regionWheel_.contains(lastPosition_)) {
        insideWheel_ = true;
        insideSquare_ = false;
        QColor color = colorFromPosition(lastPosition_);
        hueChanged(color.hue());
    } else if (regionSquare_.contains(lastPosition_)) {
        insideWheel_ = false;
        insideSquare_ = true;
        QColor color = colorFromPosition(lastPosition_);
        svChanged(color);
    }

    mousePressed_ = true;
}
Ejemplo n.º 20
0
void ColorWheel::changeColor(const QColor &color)
{
    if (color == m_currentColor)
    {
        return;
    }
    if (color.hue() != m_currentColor.hue())
    {
        hueChanged(color.hue());
    }

    if (color.saturation() != m_currentColor.saturation() ||
        color.value() != m_currentColor.value() )
    {
        svChanged(color);
    }
    //emit colorChanged(color);
    update();
}
Ejemplo n.º 21
0
void ColorWheel::mousePressEvent(QMouseEvent* e) {
    lastPos_ = e->pos();

    if (wheelRegion_.contains(lastPos_)) {
        inWheel_ = true;
        inSquare_ = false;
        QColor color = posColor(lastPos_);

        if (e->button()==Qt::RightButton) hueChanged(color.hue());
        else setColor(color);
    } else if (squareRegion_.contains(lastPos_)) {
        inWheel_ = false;
        inSquare_ = true;
        QColor color = posColor(lastPos_);
        svChanged(color);
    }

    mouseDown_ = true;
}
Ejemplo n.º 22
0
void ColorWheel::mousePressEvent(QMouseEvent *event)
{
    QPoint lastPos = event->pos();
    if (mSquareRect.contains(lastPos))
    {
        mIsInWheel = false;
        mIsInSquare = true;
        QColor color = pickColor(lastPos);
        saturationChanged(color.saturation());
        valueChanged(color.value());

    }
    else if (mWheelRect.contains(lastPos))
    {
        mIsInWheel = true;
        mIsInSquare = false;
        QColor color = pickColor(lastPos);
        hueChanged(color.hue());
    }
}
Ejemplo n.º 23
0
void ColorWheel::setColor(const QColor &color)
{
    if (color == m_currentColor)
    {
        return;
    }
    if (color.hue() != m_currentColor.hue())
    {
        hueChanged(color.hue());
    }

    if (color.saturation() != m_currentColor.saturation() ||
        color.value() != m_currentColor.value() )
    {
        svChanged(color);
    }

    update();
    emit colorSelected(color);
}
Ejemplo n.º 24
0
void ColorWheel::mouseMoveEvent(QMouseEvent* event)
{
    QPoint lastPos = event->pos();
    if ( event->buttons() == Qt::NoButton )
    {
        return;
    }
    if (m_isInSquare)
    {
        QRect rect = m_squareRegion.boundingRect();

        if ( lastPos.x() < rect.topLeft().x() )
        {
            lastPos.setX( rect.topLeft().x() );
        }
        else if ( lastPos.x() > rect.bottomRight().x() )
        {
            lastPos.setX( rect.bottomRight().x() );
        }

        if ( lastPos.y() < rect.topLeft().y() )
        {
            lastPos.setY( rect.topLeft().y() );
        }
        else if ( lastPos.y() > rect.bottomRight().y() )
        {
            lastPos.setY( rect.bottomRight().y() );
        }

        QColor color = pickColor(lastPos);
        svChanged(color);
    }
    else if (m_wheelRegion.contains(lastPos) && m_isInWheel)
    {
        QColor color = pickColor(lastPos);
        hueChanged(color.hue());
    }
}
Ejemplo n.º 25
0
void ColorWheel::mouseMoveEvent(QMouseEvent* event)
{
    QPoint lastPos = event->pos();
    if (event->buttons() == Qt::NoButton)
    {
        return;
    }
    if (mIsInSquare)
    {
        if (lastPos.x() < mSquareRect.topLeft().x())
        {
            lastPos.setX(mSquareRect.topLeft().x());
        }
        else if (lastPos.x() > mSquareRect.bottomRight().x())
        {
            lastPos.setX(mSquareRect.bottomRight().x());
        }

        if (lastPos.y() < mSquareRect.topLeft().y())
        {
            lastPos.setY(mSquareRect.topLeft().y());
        }
        else if (lastPos.y() > mSquareRect.bottomRight().y())
        {
            lastPos.setY(mSquareRect.bottomRight().y());
        }

        QColor color = pickColor(lastPos);
        saturationChanged(color.saturation());
        valueChanged(color.value());
    }
    else if (mWheelRect.contains(lastPos) && mIsInWheel)
    {
        QColor color = pickColor(lastPos);
        hueChanged(color.hue());
    }
}
void QGstreamerVideoOverlay::setHue(int hue)
{
    m_surface->setHue(hue);

    emit hueChanged(m_surface->hue());
}
void SlidersController::changeHue(QColor color) {
  emit hueChanged(color);
}
Ejemplo n.º 28
0
void S60VideoOverlay::setHue(int hue)
{
    m_surface->setHue(hue);

    emit hueChanged(m_surface->hue());
}