Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_experiment_paintop.cpp File Reference
#include "kis_experiment_paintop.h"
#include "kis_experiment_paintop_settings.h"
#include <cmath>
#include <QPainterPath>
#include <KoCompositeOpRegistry.h>
#include <kis_debug.h>
#include <kis_paint_device.h>
#include <kis_painter.h>
#include <kis_image.h>
#include <kis_spacing_information.h>
#include <krita_utils.h>

Go to the source code of this file.

Functions

bool tryMergePoints (QPainterPath &path, const QPointF &startPoint, const QPointF &endPoint, qreal &distance, qreal distanceThreshold, bool lastSegment)
 

Function Documentation

◆ tryMergePoints()

bool tryMergePoints ( QPainterPath & path,
const QPointF & startPoint,
const QPointF & endPoint,
qreal & distance,
qreal distanceThreshold,
bool lastSegment )

Definition at line 261 of file kis_experiment_paintop.cpp.

267{
268 qreal length = (endPoint - startPoint).manhattanLength();
269
270 if (lastSegment || length > distanceThreshold) {
271 if (distance != 0) {
272 path.lineTo(startPoint);
273 }
274 distance = 0;
275 return false;
276 }
277
278 distance += length;
279
280 if (distance > distanceThreshold) {
281 path.lineTo(endPoint);
282 distance = 0;
283 }
284
285 return true;
286}
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
qreal distance(const QPointF &p1, const QPointF &p2)

References distance(), and length().