void KisToolFreehandHelper::endPaint() { if (!m_d->hasPaintAtLeastOnce) { paintAt(m_d->previousPaintInformation); } else if (m_d->smoothingOptions->smoothingType() != KisSmoothingOptions::NO_SMOOTHING) { finishStroke(); } m_d->strokeTimeoutTimer.stop(); if(m_d->airbrushingTimer.isActive()) { m_d->airbrushingTimer.stop(); } if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::STABILIZER) { stabilizerEnd(); } /** * There might be some timer events still pending, so * we should cancel them. Use this flag for the purpose. * Please note that we are not in MT here, so no mutex * is needed */ m_d->painterInfos.clear(); m_d->strokesFacade->endStroke(m_d->strokeId); m_d->strokeId.clear(); if(m_d->recordingAdapter) { m_d->recordingAdapter->endStroke(); } }
void KisToolDyna::timeoutPaint() { Q_ASSERT(currentPaintOpPreset()->settings()->isAirbrushing()); if (currentImage() && m_painter) { paintAt(m_previousPaintInformation); QRegion r = m_painter->takeDirtyRegion(); dbgPlugins << "Timeout paint dirty region:" << r; currentNode()->setDirty(r); } }
void BrushTool::mouseReleaseEvent( QMouseEvent *event ) { Layer* layer = mEditor->layers()->currentLayer(); if ( event->button() == Qt::LeftButton ) { if ( mScribbleArea->isLayerPaintable() ) { if (getCurrentPoint()==mMouseDownPoint) { paintAt(mMouseDownPoint); } else { drawStroke(); } } if ( layer->type() == Layer::BITMAP ) { mScribbleArea->paintBitmapBuffer(); mScribbleArea->setAllDirty(); mScribbleArea->clearBitmapBuffer(); } else if ( layer->type() == Layer::VECTOR && mStrokePoints.size() > -1 ) { // Clear the temporary pixel path mScribbleArea->clearBitmapBuffer(); qreal tol = mScribbleArea->getCurveSmoothing() / mEditor->view()->scaling(); BezierCurve curve( mStrokePoints, mStrokePressures, tol ); curve.setWidth( properties.width ); curve.setFeather( properties.feather ); curve.setInvisibility( false ); curve.setVariableWidth( properties.pressure ); curve.setColourNumber( mEditor->color()->frontColorNumber() ); auto pLayerVector = static_cast< LayerVector* >( layer ); VectorImage* vectorImage = pLayerVector->getLastVectorImageAtFrame( mEditor->currentFrame(), 0 ); vectorImage->insertCurve( 0, curve, mEditor->view()->scaling(), false ); mScribbleArea->setModified( mEditor->layers()->currentLayerIndex(), mEditor->currentFrame() ); mScribbleArea->setAllDirty(); } } endStroke(); }
void PencilTool::pointerReleaseEvent(PointerEvent*) { mEditor->backup(typeName()); qreal distance = QLineF(getCurrentPoint(), mMouseDownPoint).length(); if (distance < 1) { paintAt(mMouseDownPoint); } else { drawStroke(); } Layer* layer = mEditor->layers()->currentLayer(); if (layer->type() == Layer::BITMAP) paintBitmapStroke(); else if (layer->type() == Layer::VECTOR) paintVectorStroke(layer); endStroke(); }
void KisToolFreehandHelper::paintAt(const KisPaintInformation &pi) { paintAt(0, pi); }
void KisToolFreehandHelper::doAirbrushing() { if(!m_d->painterInfos.isEmpty()) { paintAt(m_d->previousPaintInformation); } }
void TMenuItem::paint(Graphics* g) { paintAt(g, 0, 0); }