void SelectionTool::mousePressEvent(MouseState mouse, QImage *layer, QImage *hud, QImage *selection, bool *useSelection) { if(*useSelection && m_selectionMode == "only" && QColor(selection->pixel(mouse.getPos())) == Qt::white){ m_moving = true; m_movingSelection = QImage(layer->size(), layer->format()); m_movingSelection.fill(GREEN_SELECTION); QPainter painter(&m_movingSelection); painter.setCompositionMode(QPainter::CompositionMode_DestinationIn); painter.drawImage(0, 0, *selection); } else if(mouse.button() == Qt::LeftButton){ m_drawing = true; m_noKeyReleased = true; m_keysDown.remove(Qt::Key_Shift); m_keysDown.remove(Qt::Key_Alt); } }
void BrushTool::mouseReleaseEvent(MouseState mouse, QImage *layer, QImage *hud, QImage *selection, bool *useSelection) { if(mouse.button() == Qt::LeftButton){ hud->fill(Qt::transparent); QImage temp(layer->size(), layer->format()); temp.fill(Qt::transparent); QPainter *painter = this->getPainter(&temp); if(m_brushSize->value() == 1) Tool::drawPerfectLine(painter, mouse.getPos(), m_last); else painter->drawLine(mouse.getPos(), m_last); delete painter; this->drawInSelection(layer, &temp, selection, useSelection); } }
void BrushTool::mousePressEvent(MouseState mouse, QImage *layer, QImage *hud, QImage *selection, bool *useSelection) { if(mouse.button() == Qt::LeftButton){ m_last = mouse.getPos(); } }