18 #include "stroketool.h"
20 #include "scribblearea.h"
21 #include "strokemanager.h"
26 void detectWhichOSX();
27 void disableCoalescing();
28 void enableCoalescing();
32 void detectWhichOSX() {}
33 void disableCoalescing() {}
34 void enableCoalescing() {}
38 StrokeTool::StrokeTool( QObject *parent ) :
44 void StrokeTool::startStroke()
47 mLastPixel = getCurrentPixel();
49 mStrokePoints.clear();
52 QPointF startStrokes = m_pStrokeManager->interpolateStart(mLastPixel);
53 mStrokePoints << mEditor->view()->mapScreenToCanvas( startStrokes );
55 mStrokePressures.clear();
56 mStrokePressures << m_pStrokeManager->getPressure();
61 bool StrokeTool::keyPressEvent(QKeyEvent *event)
63 switch ( event->key() ) {
65 mScribbleArea->setTemporaryTool( EYEDROPPER );
68 mScribbleArea->setTemporaryTool( HAND );
74 bool StrokeTool::keyReleaseEvent(QKeyEvent *event)
80 void StrokeTool::endStroke()
82 m_pStrokeManager->interpolateEnd();
83 mStrokePressures << m_pStrokeManager->getPressure();
84 mStrokePoints.clear();
85 mStrokePressures.clear();
90 void StrokeTool::drawStroke()
92 QPointF pixel = getCurrentPixel();
93 if ( pixel != mLastPixel || !mFirstDraw )
97 QPointF startStrokes = m_pStrokeManager->interpolateStart(getLastPixel());
98 mStrokePoints << mEditor->view()->mapScreenToCanvas( startStrokes );
99 mStrokePressures << m_pStrokeManager->getPressure();