Ejemplo n.º 1
0
void CurveLineInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        switch(mPointsCount)
        {
        //draw linear Bezier curve
        case 1:
            mEndPoint = event->pos();
            break;
        //draw square Bezier curve
        case 2:
            mFirstControlPoint = mSecondControlPoint = event->pos();
            break;
        //draw cubic Bezier curve
        case 0:
            mSecondControlPoint = event->pos();
            break;
        }

        imageArea.setImage(mImageCopy);
        if(event->buttons() & Qt::LeftButton)
            paint(imageArea, false);
        else if(event->buttons() & Qt::RightButton)
            paint(imageArea, true);
    }
}
Ejemplo n.º 2
0
void EraserInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        mEndPoint = event->pos();
        paint(imageArea);
        imageArea.setIsPaint(false);
    }
}
Ejemplo n.º 3
0
void EraserInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        mEndPoint = event->pos();
        paint(imageArea, false);
        mStartPoint = event->pos();
    }
}
Ejemplo n.º 4
0
void CurveLineInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        imageArea.setImage(mImageCopy);
        if(event->button() == Qt::LeftButton)
            paint(imageArea, false);
        else if(event->button() == Qt::RightButton)
            paint(imageArea, true);
        imageArea.setIsPaint(false);
    }
}
Ejemplo n.º 5
0
void FillInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        if(event->button() == Qt::LeftButton)
        {
            paint(imageArea, false);
        }
        else if(event->button() == Qt::RightButton)
        {
            paint(imageArea, true);
        }
        imageArea.setIsPaint(false);
    }
}
Ejemplo n.º 6
0
void LineInstrument::mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea)
{
    if(imageArea.isPaint())
    {
        mEndPoint = event->pos();
        imageArea.setImage(mImageCopy);
        if(event->buttons() & Qt::LeftButton)
        {
            paint(imageArea, false);
        }
        else if(event->buttons() & Qt::RightButton)
        {
            paint(imageArea, true);
        }
    }
}