void CurveLineInstrument::mousePressEvent(QMouseEvent *event, ImageArea &imageArea) { if(event->button() == Qt::LeftButton || event->button() == Qt::RightButton) { if(DataSingleton::Instance()->isResetCurve()) { mPointsCount = 0; DataSingleton::Instance()->setResetCurve(false); } switch(mPointsCount) { //draw linear Bezier curve case 0: mImageCopy = *imageArea.getImage(); mStartPoint = mEndPoint = mFirstControlPoint = mSecondControlPoint = event->pos(); ++mPointsCount; break; //draw square Bezier curve case 1: mFirstControlPoint = mSecondControlPoint = event->pos(); ++mPointsCount; break; //draw cubic Bezier curve case 2: mSecondControlPoint = event->pos(); mPointsCount = 0; break; } imageArea.setIsPaint(true); makeUndoCommand(imageArea); } }
void FillInstrument::mousePressEvent(QMouseEvent *event, ImageArea &imageArea) { if(event->button() == Qt::LeftButton || event->button() == Qt::RightButton) { mStartPoint = mEndPoint = event->pos(); imageArea.setIsPaint(true); makeUndoCommand(imageArea); } }
void LineInstrument::mousePressEvent(QMouseEvent *event, ImageArea &imageArea) { if(event->button() == Qt::LeftButton || event->button() == Qt::RightButton) { mStartPoint = mEndPoint = event->pos(); imageArea.setIsPaint(true); mImageCopy = *imageArea.getImage(); } }
void EraserInstrument::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea) { if(imageArea.isPaint()) { mEndPoint = event->pos(); paint(imageArea); imageArea.setIsPaint(false); } }
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); } }
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); } }