stroke style and fill rendered immediately while drawing

presentation
morrolinux 7 years ago
parent fc944037f4
commit 3683218d54
  1. 33
      src/control/tools/StrokeHandler.cpp

@ -74,24 +74,31 @@ bool StrokeHandler::onMotionNotifyEvent(const PositionInputData& pos)
stroke->setLastPressure(pos.pressure * stroke->getWidth());
}
if (pointCount > 0)
stroke->addPoint(currentPoint);
if (stroke->getFill() != -1 || stroke->getLineStyle().hasDashes())
{
view.drawStroke(crMask, stroke, 0, 1, true, true);
}
else
{
Point prevPoint(stroke->getPoint(pointCount - 1));
if (pointCount > 0)
{
Point prevPoint(stroke->getPoint(pointCount - 1));
Stroke lastSegment;
Stroke lastSegment;
lastSegment.addPoint(prevPoint);
lastSegment.addPoint(currentPoint);
lastSegment.setWidth(stroke->getWidth());
lastSegment.addPoint(prevPoint);
lastSegment.addPoint(currentPoint);
lastSegment.setWidth(stroke->getWidth());
cairo_set_operator(crMask, CAIRO_OPERATOR_OVER);
cairo_set_source_rgba(crMask, 1, 1, 1, 1);
cairo_set_operator(crMask, CAIRO_OPERATOR_OVER);
cairo_set_source_rgba(crMask, 1, 1, 1, 1);
view.drawStroke(crMask, &lastSegment, 0, 1, false);
view.drawStroke(crMask, &lastSegment, 0, 1, false);
}
}
stroke->addPoint(currentPoint);
const double w = stroke->getWidth();
this->redrawable->repaintRect(stroke->getX() - w,
@ -158,7 +165,7 @@ void StrokeHandler::onButtonReleaseEvent(const PositionInputData& pos)
return;
}
}
/*
if (stroke->getFill() != -1 || stroke->getLineStyle().hasDashes())
{
// The stroke is not filled on drawing time
@ -168,7 +175,7 @@ void StrokeHandler::onButtonReleaseEvent(const PositionInputData& pos)
view.drawStroke(crMask, stroke, 0, 1, true, true);
}
*/
layer->addElement(stroke);
page->fireElementChanged(stroke);

Loading…
Cancel
Save