KisPaintInformation KisPaintingInformationBuilder::createPaintingInformation(KoPointerEvent *event,
                                                                             int timeElapsed)
{

    QPointF adjusted = adjustDocumentPoint(event->point);
    QPointF imagePoint = documentToImage(adjusted);
    qreal perspective = calculatePerspective(adjusted);

    return KisPaintInformation(imagePoint,
                               pressureToCurve(event->pressure()),
                               event->xTilt(), event->yTilt(),
                               event->rotation(),
                               event->tangentialPressure(),
                               perspective,
                               timeElapsed);
}
KisPaintInformation KisPaintingInformationBuilder::hover(const QPointF &imagePoint,
                                                         const KoPointerEvent *event)
{
    qreal perspective = calculatePerspective(imagePoint);
    qreal speed = m_speedSmoother->getNextSpeed(imageToView(imagePoint));

    if (event) {
        return KisPaintInformation::createHoveringModeInfo(imagePoint,
                                                           PRESSURE_DEFAULT,
                                                           event->xTilt(), event->yTilt(),
                                                           event->rotation(),
                                                           event->tangentialPressure(),
                                                           perspective,
                                                           speed);
    } else {
        return KisPaintInformation::createHoveringModeInfo(imagePoint);
    }
}
KisPaintInformation KisPaintingInformationBuilder::createPaintingInformation(KoPointerEvent *event,
                                                                             int timeElapsed)
{

    QPointF adjusted = adjustDocumentPoint(event->point, m_startPoint);
    QPointF imagePoint = documentToImage(adjusted);
    qreal perspective = calculatePerspective(adjusted);
    qreal speed = m_speedSmoother->getNextSpeed(imageToView(imagePoint));

    return KisPaintInformation(imagePoint,
                               !m_pressureDisabled ? 1.0 : pressureToCurve(event->pressure()),
                               event->xTilt(), event->yTilt(),
                               event->rotation(),
                               event->tangentialPressure(),
                               perspective,
                               timeElapsed,
                               speed);
}
Esempio n. 4
0
void Camera::calculatePerspective(float fieldOfView, float zNear, float zFar)
{
  calculatePerspective(fieldOfView, static_cast<float>(m_width) /
                       static_cast<float>(m_height), zNear, zFar);
}