Esempio n. 1
0
void QDeclarativeCameraFocus::setCustomFocusPoint(const QPointF &point)
{
    if (point != customFocusPoint()) {
        m_focus->setCustomFocusPoint(point);
        emit customFocusPointChanged(customFocusPoint());
    }
}
void BbCameraFocusControl::setCustomFocusPoint(const QPointF &point)
{
    if (m_customFocusPoint == point)
        return;

    m_customFocusPoint = point;
    emit customFocusPointChanged(m_customFocusPoint);

    updateCustomFocusRegion();
}
void QAndroidCameraFocusControl::setCustomFocusPoint(const QPointF &point)
{
    if (m_customFocusPoint != point) {
        m_customFocusPoint = point;
        emit customFocusPointChanged(m_customFocusPoint);
    }

    if (m_session->camera() && m_focusPointMode == QCameraFocus::FocusPointCustom) {
        m_actualFocusPoint = m_customFocusPoint;
        updateFocusZones();
        setCameraFocusArea();
    }
}
Esempio n. 4
0
void CameraBinFocus::resetFocusPoint()
{
    const QRectF focusRect = m_focusRect;
    m_focusPoint = QPointF(0.5, 0.5);
    m_focusRect.moveCenter(m_focusPoint);

    updateRegionOfInterest(QVector<QRect>());

    if (focusRect != m_focusRect) {
        emit customFocusPointChanged(m_focusPoint);
        emit focusZonesChanged();
    }
}
Esempio n. 5
0
void QAndroidCameraFocusControl::onCameraOpened()
{
    connect(m_session->camera(), SIGNAL(previewSizeChanged()),
            this, SLOT(onViewportSizeChanged()));
    connect(m_session->camera(), SIGNAL(autoFocusStarted()),
            this, SLOT(onAutoFocusStarted()));
    connect(m_session->camera(), SIGNAL(autoFocusComplete(bool)),
            this, SLOT(onAutoFocusComplete(bool)));

    m_supportedFocusModes.clear();
    m_continuousPictureFocusSupported = false;
    m_continuousVideoFocusSupported = false;

    m_focusPointMode = QCameraFocus::FocusPointAuto;
    m_actualFocusPoint = QPointF(0.5, 0.5);
    m_customFocusPoint = QPointF();
    m_supportedFocusPointModes.clear();
    m_focusZones.clear();

    QStringList focusModes = m_session->camera()->getSupportedFocusModes();
    for (int i = 0; i < focusModes.size(); ++i) {
        const QString &focusMode = focusModes.at(i);
        if (focusMode == QLatin1String("auto")) {
            m_supportedFocusModes << QCameraFocus::AutoFocus;
        } else if (focusMode == QLatin1String("continuous-picture")) {
            m_supportedFocusModes << QCameraFocus::ContinuousFocus;
            m_continuousPictureFocusSupported = true;
        } else if (focusMode == QLatin1String("continuous-video")) {
            m_supportedFocusModes << QCameraFocus::ContinuousFocus;
            m_continuousVideoFocusSupported = true;
        } else if (focusMode == QLatin1String("edof")) {
            m_supportedFocusModes << QCameraFocus::HyperfocalFocus;
        } else if (focusMode == QLatin1String("fixed")) {
            m_supportedFocusModes << QCameraFocus::ManualFocus;
        } else if (focusMode == QLatin1String("infinity")) {
            m_supportedFocusModes << QCameraFocus::InfinityFocus;
        } else if (focusMode == QLatin1String("macro")) {
            m_supportedFocusModes << QCameraFocus::MacroFocus;
        }
    }

    m_supportedFocusPointModes << QCameraFocus::FocusPointAuto;
    if (m_session->camera()->getMaxNumFocusAreas() > 0)
        m_supportedFocusPointModes << QCameraFocus::FocusPointCenter << QCameraFocus::FocusPointCustom;

    emit focusModeChanged(focusMode());
    emit focusPointModeChanged(m_focusPointMode);
    emit customFocusPointChanged(m_customFocusPoint);
    emit focusZonesChanged();
}
Esempio n. 6
0
void CameraBinFocus::setCustomFocusPoint(const QPointF &point)
{
    if (m_focusPoint != point) {
        m_focusPoint = point;

        // Bound the focus point so the focus rect remains entirely within the unit square.
        m_focusPoint.setX(qBound(m_focusRect.width() / 2, m_focusPoint.x(), 1 - m_focusRect.width() / 2));
        m_focusPoint.setY(qBound(m_focusRect.height() / 2, m_focusPoint.y(), 1 - m_focusRect.height() / 2));

        if (m_focusPointMode == QCameraFocus::FocusPointCustom) {
            const QRectF focusRect = m_focusRect;
            m_focusRect.moveCenter(m_focusPoint);

            updateRegionOfInterest(m_focusRect);

            if (focusRect != m_focusRect) {
                emit focusZonesChanged();
            }
        }

        emit customFocusPointChanged(m_focusPoint);
    }
}