コード例 #1
0
KisDistanceInformation KisCurvePaintOp::paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, const KisDistanceInformation& savedDist)
{
    Q_UNUSED(savedDist);
    if (!painter()) return KisDistanceInformation();
    m_dev = painter()->device();
    if (!m_dev) return KisDistanceInformation();

    if (!m_dab) {
        m_dab = new KisPaintDevice(painter()->device()->colorSpace());
    } else {
        m_dab->clear();
    }
    //write device, read device, position
    m_curveBrush.paintLine(m_dab, m_dev, pi1, pi2);

    QRect rc = m_dab->extent();

    painter()->bitBlt(rc.topLeft(), m_dab, rc);

    KisVector2D end = toKisVector2D(pi2.pos());
    KisVector2D start = toKisVector2D(pi1.pos());
    KisVector2D dragVec = end - start;
    return KisDistanceInformation(0, dragVec.norm());

}
コード例 #2
0
 qreal distance(const QPointF &pt) const {
     return m_lineEquation.absDistance(toKisVector2D(pt));
 }
コード例 #3
0
 LineWrapper(const QPointF &p0, const QPointF &p1) {
     init(toKisVector2D(p0), toKisVector2D(p1));
 }