mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 14:50:24 +00:00
QtLottie: Completely detach from upstream.
This commit is contained in:
parent
12a4a849ca
commit
ab82ff0fb7
@ -55,7 +55,7 @@ Animation::Animation(const QByteArray &content)
|
||||
const auto document = QJsonDocument::fromJson(content, &error);
|
||||
const auto parsed = crl::now();
|
||||
if (error.error != QJsonParseError::NoError) {
|
||||
qCWarning(lcLottieQtBodymovinParser)
|
||||
qWarning()
|
||||
<< "Lottie Error: Parse failed with code "
|
||||
<< error.error
|
||||
<< "( " << error.errorString() << ")";
|
||||
|
@ -9,15 +9,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "base/basic_types.h"
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
#include "lottie/lottie_common.h"
|
||||
#include "bmscene.h"
|
||||
|
||||
#include <QtBodymovin/private/bmscene_p.h>
|
||||
#include <QImage>
|
||||
|
||||
#include <crl/crl_time.h>
|
||||
#include <crl/crl_object_on_queue.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
class BMBase;
|
||||
|
@ -6,4 +6,3 @@ For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "lottie/lottie_pch.h"
|
||||
|
||||
|
@ -7,4 +7,5 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define qAsConst(X) std::as_const(X)
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
|
2
Telegram/ThirdParty/qtlottie
vendored
2
Telegram/ThirdParty/qtlottie
vendored
@ -1 +1 @@
|
||||
Subproject commit f95d9f5260af2dcf1e724d1d0814bd9176149b76
|
||||
Subproject commit 15be485c6914a48b0031ceaa15a5ff53f5214985
|
@ -1,44 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMGLOBAL_H
|
||||
#define BMGLOBAL_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if defined(BODYMOVIN_LIBRARY)
|
||||
# define BODYMOVIN_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define BODYMOVIN_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMGLOBAL_H
|
@ -1,61 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BEZIEREASING_P_H
|
||||
#define BEZIEREASING_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <private/qbezier_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BezierEasing
|
||||
{
|
||||
public:
|
||||
void addCubicBezierSegment(const QPointF &c1, const QPointF &c2, const QPointF &endPoint);
|
||||
qreal valueForProgress(qreal progress) const;
|
||||
|
||||
private:
|
||||
qreal tForX(qreal x) const;
|
||||
QBezier mBezier;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BEZIEREASING_P_H
|
@ -1,75 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMASSET_P_H
|
||||
#define BMASSET_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmbase_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class LottieRenderer;
|
||||
|
||||
class BODYMOVIN_EXPORT BMAsset : public BMBase
|
||||
{
|
||||
public:
|
||||
BMAsset(BMBase *parent);
|
||||
BMAsset(BMBase *parent, const BMAsset &other);
|
||||
~BMAsset() = default;
|
||||
|
||||
BMAsset *clone(BMBase *parent) const override;
|
||||
|
||||
static BMAsset *construct(BMBase *parent, QJsonObject definition);
|
||||
|
||||
void parse(const QJsonObject &definition) override;
|
||||
|
||||
void resolveAssets(const std::function<BMAsset*(BMBase*, QString)> &resolver) override;
|
||||
|
||||
QString id() const;
|
||||
|
||||
private:
|
||||
QString m_id;
|
||||
bool m_resolved = false;
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMASSET_P_H
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMBASE_P_H
|
||||
#define BMBASE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
#include <QtBodymovin/private/bmconstants_p.h>
|
||||
|
||||
#include <QtBodymovin/private/lottierenderer_p.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BMAsset;
|
||||
class BMScene;
|
||||
|
||||
class BODYMOVIN_EXPORT BMBase
|
||||
{
|
||||
public:
|
||||
BMBase(BMBase *parent);
|
||||
BMBase(BMBase *parent, const BMBase &other);
|
||||
BMBase(const BMBase &other) = delete;
|
||||
virtual ~BMBase();
|
||||
|
||||
virtual BMBase *clone(BMBase *parent) const;
|
||||
|
||||
QString name() const;
|
||||
|
||||
int type() const;
|
||||
void setType(int type);
|
||||
virtual void parse(const QJsonObject &definition);
|
||||
|
||||
virtual bool active(int frame) const;
|
||||
bool hidden() const;
|
||||
|
||||
inline BMBase *parent() const { return m_parent; }
|
||||
|
||||
const QList<BMBase *> &children() const { return m_children; }
|
||||
void prependChild(BMBase *child);
|
||||
void appendChild(BMBase *child);
|
||||
|
||||
virtual BMBase *findChild(const QString &childName);
|
||||
|
||||
virtual void updateProperties(int frame);
|
||||
virtual void render(LottieRenderer &renderer, int frame) const;
|
||||
|
||||
virtual void resolveAssets(const std::function<BMAsset*(BMBase*, QString)> &resolver);
|
||||
|
||||
protected:
|
||||
virtual BMScene *resolveTopRoot() const;
|
||||
BMScene *topRoot() const;
|
||||
|
||||
protected:
|
||||
int m_type = 0;
|
||||
bool m_hidden = false;
|
||||
QString m_name;
|
||||
QString m_matchName;
|
||||
bool m_autoOrient = false;
|
||||
|
||||
friend class BMRasterRenderer;
|
||||
friend class BMRenderer;
|
||||
|
||||
private:
|
||||
BMBase * const m_parent = nullptr;
|
||||
QList<BMBase *> m_children;
|
||||
|
||||
// Handle to the topmost element on which this element resides
|
||||
// Will be resolved when traversing effects
|
||||
mutable BMScene *m_topRoot = nullptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMBASE_P_H
|
@ -1,89 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMBASICTRANSFORM_P_H
|
||||
#define BMBASICTRANSFORM_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPointF>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmspatialproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMBasicTransform : public BMShape
|
||||
{
|
||||
public:
|
||||
BMBasicTransform(BMBase *parent);
|
||||
BMBasicTransform(BMBase *parent, const BMBasicTransform &other);
|
||||
BMBasicTransform(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
void clearOpacity();
|
||||
|
||||
QPointF anchorPoint() const;
|
||||
virtual QPointF position() const;
|
||||
QPointF scale() const;
|
||||
qreal rotation() const;
|
||||
qreal opacity() const;
|
||||
|
||||
protected:
|
||||
BMSpatialProperty m_anchorPoint;
|
||||
bool m_splitPosition = false;
|
||||
BMSpatialProperty m_position;
|
||||
BMProperty<qreal> m_xPos;
|
||||
BMProperty<qreal> m_yPos;
|
||||
BMProperty2D<QPointF> m_scale;
|
||||
BMProperty<qreal> m_rotation;
|
||||
BMProperty<qreal> m_opacity;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMBASICTRANSFORM_P_H
|
@ -1,67 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMCONSTANTS_P_H
|
||||
#define BMCONSTANTS_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QObject>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
|
||||
#define BM_LAYER_PRECOMP_IX 0x10000
|
||||
#define BM_LAYER_SOLID_IX 0x10001
|
||||
#define BM_LAYER_IMAGE_IX 0x10002
|
||||
#define BM_LAYER_NULL_IX 0x10004
|
||||
#define BM_LAYER_SHAPE_IX 0x10008
|
||||
#define BM_LAYER_TEXT_IX 0x1000f
|
||||
|
||||
#define BM_EFFECT_FILL 0x20000
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcLottieQtBodymovinParser);
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcLottieQtBodymovinUpdate);
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcLottieQtBodymovinRender);
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcLottieQtBodymovinRenderThread);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMCONSTANTS_P_H
|
@ -1,86 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMELLIPSE_P_H
|
||||
#define BMELLIPSE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QRect>
|
||||
#include <QPointF>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
#include <QPainterPath>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmspatialproperty_p.h>
|
||||
#include <QtBodymovin/private/bmfill_p.h>
|
||||
#include <QtBodymovin/private/bmstroke_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMEllipse : public BMShape
|
||||
{
|
||||
public:
|
||||
BMEllipse(BMBase *parent);
|
||||
BMEllipse(BMBase *parent, const BMEllipse &other);
|
||||
BMEllipse(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
bool acceptsTrim() const override;
|
||||
|
||||
QPointF position() const;
|
||||
QSizeF size() const;
|
||||
|
||||
protected:
|
||||
BMSpatialProperty m_position;
|
||||
BMProperty2D<QSizeF> m_size;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMELLIPSE_P_H
|
@ -1,75 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMFILL_P_H
|
||||
#define BMFILL_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QColor>
|
||||
#include <QVector4D>
|
||||
|
||||
#include <QtBodymovin/private/bmgroup_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BODYMOVIN_EXPORT BMFill : public BMShape
|
||||
{
|
||||
public:
|
||||
BMFill(BMBase *parent);
|
||||
BMFill(BMBase *parent, const BMFill &other);
|
||||
BMFill(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
QColor color() const;
|
||||
qreal opacity() const;
|
||||
|
||||
protected:
|
||||
BMProperty4D<QVector4D> m_color;
|
||||
BMProperty<qreal> m_opacity;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMFILL_P_H
|
@ -1,78 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMFILLEFFECT_P_H
|
||||
#define BMFILLEFFECT_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QColor>
|
||||
#include <QVector4D>
|
||||
|
||||
#include <QtBodymovin/private/bmbase_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMFillEffect : public BMBase
|
||||
{
|
||||
public:
|
||||
BMFillEffect(BMBase *parent);
|
||||
BMFillEffect(BMBase *parent, const BMFillEffect &other);
|
||||
BMFillEffect(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
QColor color() const;
|
||||
qreal opacity() const;
|
||||
|
||||
protected:
|
||||
BMProperty4D<QVector4D> m_color;
|
||||
BMProperty<qreal> m_opacity;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMFILLEFFECT_P_H
|
@ -1,107 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMFEEFORMSHAPE_P_H
|
||||
#define BMFEEFORMSHAPE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPainterPath>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmtrimpath_p.h>
|
||||
#include <QtBodymovin/private/lottierenderer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMFreeFormShape : public BMShape
|
||||
{
|
||||
public:
|
||||
BMFreeFormShape(BMBase *parent);
|
||||
BMFreeFormShape(BMBase *parent, const BMFreeFormShape &other);
|
||||
BMFreeFormShape(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
bool acceptsTrim() const override;
|
||||
|
||||
protected:
|
||||
struct VertexInfo {
|
||||
BMProperty2D<QPointF> pos;
|
||||
BMProperty2D<QPointF> ci;
|
||||
BMProperty2D<QPointF> co;
|
||||
};
|
||||
|
||||
void parseShapeKeyframes(QJsonObject &keyframes);
|
||||
void buildShape(const QJsonObject &keyframe);
|
||||
void buildShape(int frame);
|
||||
void parseEasedVertices(const QJsonObject &keyframe, int startFrame);
|
||||
|
||||
QHash<int, QJsonObject> m_vertexMap;
|
||||
QList<VertexInfo> m_vertexList;
|
||||
QMap<int, bool> m_closedShape;
|
||||
|
||||
private:
|
||||
struct VertexBuildInfo
|
||||
{
|
||||
QJsonArray posKeyframes;
|
||||
QJsonArray ciKeyframes;
|
||||
QJsonArray coKeyframes;
|
||||
};
|
||||
|
||||
void finalizeVertices();
|
||||
|
||||
QMap<int, VertexBuildInfo*> m_vertexInfos;
|
||||
|
||||
QJsonObject createKeyframe(QJsonArray startValue, QJsonArray endValue,
|
||||
int startFrame, QJsonObject easingIn,
|
||||
QJsonObject easingOut);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMFEEFORMSHAPE_P_H
|
@ -1,91 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMGFILL_P_H
|
||||
#define BMGFILL_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QVector4D>
|
||||
#include <QGradient>
|
||||
|
||||
#include <QtBodymovin/private/bmgroup_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmspatialproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BODYMOVIN_EXPORT BMGFill : public BMShape
|
||||
{
|
||||
public:
|
||||
BMGFill(BMBase *parent);
|
||||
BMGFill(BMBase *parent, const BMGFill &other);
|
||||
BMGFill(BMBase *parent, const QJsonObject &definition);
|
||||
~BMGFill() override;
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
QGradient *value() const;
|
||||
QGradient::Type gradientType() const;
|
||||
QPointF startPoint() const;
|
||||
QPointF endPoint() const;
|
||||
qreal highlightLength() const;
|
||||
qreal highlightAngle() const;
|
||||
qreal opacity() const;
|
||||
|
||||
private:
|
||||
void setGradient();
|
||||
|
||||
protected:
|
||||
BMProperty<qreal> m_opacity;
|
||||
BMSpatialProperty m_startPoint;
|
||||
BMSpatialProperty m_endPoint;
|
||||
BMProperty<qreal> m_highlightLength;
|
||||
BMProperty<qreal> m_highlightAngle;
|
||||
QList<BMProperty4D<QVector4D>> m_colors;
|
||||
QGradient *m_gradient = nullptr;
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMGFILL_P_H
|
@ -1,77 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMGROUP_P_H
|
||||
#define BMGROUP_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QColor>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmpathtrimmer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BMFill;
|
||||
class BMTrimPath;
|
||||
class BMPathTrimmer;
|
||||
|
||||
class BODYMOVIN_EXPORT BMGroup : public BMShape
|
||||
{
|
||||
public:
|
||||
BMGroup(BMBase *parent);
|
||||
BMGroup(BMBase *parent, const BMGroup &other);
|
||||
BMGroup(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject& definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
bool acceptsTrim() const override;
|
||||
void applyTrim(const BMTrimPath &trimmer) override;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMGROUP_P_H
|
@ -1,110 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMLAYER_P_H
|
||||
#define BMLAYER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmbase_p.h>
|
||||
#include <QtBodymovin/private/bmbasictransform_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class LottieRenderer;
|
||||
class BMMasks;
|
||||
|
||||
class BODYMOVIN_EXPORT BMLayer : public BMBase
|
||||
{
|
||||
public:
|
||||
enum MatteClipMode {NoClip, Alpha, InvertedAlpha, Luminence, InvertedLuminence};
|
||||
|
||||
BMLayer(BMBase *parent);
|
||||
BMLayer(BMBase *parent, const BMLayer &other);
|
||||
~BMLayer() override;
|
||||
|
||||
static BMLayer *construct(BMBase *parent, QJsonObject definition);
|
||||
|
||||
bool active(int frame) const override;
|
||||
|
||||
void parse(const QJsonObject &definition) override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
|
||||
BMBase *findChild(const QString &childName) override;
|
||||
|
||||
bool isClippedLayer() const;
|
||||
bool isMaskLayer() const;
|
||||
MatteClipMode clipMode() const;
|
||||
|
||||
int layerId() const;
|
||||
void renderFullTransform(LottieRenderer &renderer, int frame) const;
|
||||
|
||||
protected:
|
||||
void renderEffects(LottieRenderer &renderer, int frame) const;
|
||||
|
||||
virtual BMLayer *resolveLinkedLayer();
|
||||
virtual BMLayer *linkedLayer() const;
|
||||
|
||||
int m_layerIndex = 0;
|
||||
int m_startFrame;
|
||||
int m_endFrame;
|
||||
qreal m_startTime;
|
||||
int m_blendMode;
|
||||
bool m_3dLayer = false;
|
||||
BMBase *m_effects = nullptr;
|
||||
qreal m_stretch;
|
||||
BMBasicTransform m_layerTransform;
|
||||
BMMasks *m_masks = nullptr;
|
||||
|
||||
int m_parentLayer = 0;
|
||||
int m_td = 0;
|
||||
MatteClipMode m_clipMode = NoClip;
|
||||
|
||||
bool m_updated = false;
|
||||
|
||||
private:
|
||||
void parseEffects(const QJsonArray &definition, BMBase *effectRoot = nullptr);
|
||||
void parseMasks(const QJsonArray &definition);
|
||||
|
||||
BMLayer *m_linkedLayer = nullptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMLAYER_P_H
|
@ -1,69 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMMASKS_P_H
|
||||
#define BMMASKS_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPainterPath>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmtrimpath_p.h>
|
||||
#include <QtBodymovin/private/lottierenderer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMMasks : public BMBase
|
||||
{
|
||||
public:
|
||||
BMMasks(BMBase *parent);
|
||||
BMMasks(BMBase *parent, const BMMasks &other);
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMMASKCLIP_P_H
|
@ -1,118 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMMASKSHAPE_P_H
|
||||
#define BMMASKSHAPE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPainterPath>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmtrimpath_p.h>
|
||||
#include <QtBodymovin/private/lottierenderer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMMaskShape : public BMShape
|
||||
{
|
||||
public:
|
||||
BMMaskShape(BMBase *parent);
|
||||
BMMaskShape(BMBase *parent, const BMMaskShape &other);
|
||||
BMMaskShape(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
enum class Mode {
|
||||
Additive,
|
||||
Intersect,
|
||||
};
|
||||
|
||||
Mode mode() const;
|
||||
|
||||
bool inverted() const;
|
||||
|
||||
protected:
|
||||
struct VertexInfo {
|
||||
BMProperty2D<QPointF> pos;
|
||||
BMProperty2D<QPointF> ci;
|
||||
BMProperty2D<QPointF> co;
|
||||
};
|
||||
|
||||
void parseShapeKeyframes(QJsonObject &keyframes);
|
||||
void buildShape(const QJsonObject &keyframe);
|
||||
void buildShape(int frame);
|
||||
void parseEasedVertices(const QJsonObject &keyframe, int startFrame);
|
||||
|
||||
QHash<int, QJsonObject> m_vertexMap;
|
||||
QList<VertexInfo> m_vertexList;
|
||||
QMap<int, bool> m_closedShape;
|
||||
|
||||
bool m_inverted = false;
|
||||
BMProperty<qreal> m_opacity;
|
||||
Mode m_mode = Mode::Additive;
|
||||
|
||||
private:
|
||||
struct VertexBuildInfo
|
||||
{
|
||||
QJsonArray posKeyframes;
|
||||
QJsonArray ciKeyframes;
|
||||
QJsonArray coKeyframes;
|
||||
};
|
||||
|
||||
void finalizeVertices();
|
||||
|
||||
QMap<int, VertexBuildInfo*> m_vertexInfos;
|
||||
|
||||
QJsonObject createKeyframe(QJsonArray startValue, QJsonArray endValue,
|
||||
int startFrame, QJsonObject easingIn,
|
||||
QJsonObject easingOut);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMMASKSHAPE_P_H
|
@ -1,71 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMNULLLAYER_P_H
|
||||
#define BMNULLLAYER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmlayer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class LottieRenderer;
|
||||
class BMShape;
|
||||
class BMTrimPath;
|
||||
class BMBasicTransform;
|
||||
|
||||
class BODYMOVIN_EXPORT BMNullLayer final : public BMLayer
|
||||
{
|
||||
public:
|
||||
BMNullLayer(BMBase *parent);
|
||||
BMNullLayer(BMBase *parent, const BMNullLayer &other);
|
||||
BMNullLayer(BMBase *parent, const QJsonObject &definition);
|
||||
~BMNullLayer() override;
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void render(LottieRenderer &render, int frame) const override;
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMNULLLAYER_P_H
|
@ -1,78 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef BMPATHTRIMMER_P_H
|
||||
#define BMPATHTRIMMER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
class BMTrimPath;
|
||||
class LottieRenderer;
|
||||
class BMBase;
|
||||
class BMShape;
|
||||
|
||||
class BODYMOVIN_EXPORT BMPathTrimmer
|
||||
{
|
||||
public:
|
||||
BMPathTrimmer(BMBase *root);
|
||||
|
||||
void addTrim(BMTrimPath* trim);
|
||||
bool inUse() const;
|
||||
|
||||
void applyTrim(BMShape *shape);
|
||||
|
||||
void updateProperties(int frame);
|
||||
void render(LottieRenderer &renderer, int frame) const;
|
||||
|
||||
private:
|
||||
BMBase *m_root = nullptr;
|
||||
|
||||
QList<BMTrimPath*> m_trimPaths;
|
||||
BMTrimPath *m_appliedTrim = nullptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMPATHTRIMMER_P_H
|
||||
|
@ -1,63 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMPRECOMPASSET_P_H
|
||||
#define BMPRECOMPASSET_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmasset_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class LottieRenderer;
|
||||
|
||||
class BODYMOVIN_EXPORT BMPreCompAsset : public BMAsset
|
||||
{
|
||||
public:
|
||||
BMPreCompAsset(BMBase *parent);
|
||||
BMPreCompAsset(BMBase *parent, const BMPreCompAsset &other);
|
||||
BMPreCompAsset(BMBase *parent, const QJsonObject &definition);
|
||||
~BMPreCompAsset() = default;
|
||||
|
||||
BMPreCompAsset *clone(BMBase *parent) const override;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMPRECOMPASSET_P_H
|
@ -1,80 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMPRECOMPLAYER_P_H
|
||||
#define BMPRECOMPLAYER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmlayer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class LottieRenderer;
|
||||
class BMShape;
|
||||
class BMTrimPath;
|
||||
class BMBasicTransform;
|
||||
|
||||
class BODYMOVIN_EXPORT BMPreCompLayer final : public BMLayer
|
||||
{
|
||||
public:
|
||||
BMPreCompLayer(BMBase *parent);
|
||||
BMPreCompLayer(BMBase *parent, const BMPreCompLayer &other);
|
||||
BMPreCompLayer(BMBase *parent, const QJsonObject &definition);
|
||||
~BMPreCompLayer() override;
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
void resolveAssets(const std::function<BMAsset*(BMBase*, QString)> &resolver) override;
|
||||
|
||||
QString refId() const;
|
||||
|
||||
private:
|
||||
QString m_refId;
|
||||
BMBase *m_layers = nullptr;
|
||||
bool m_resolving = false;
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMPRECOMPLAYER_P_H
|
@ -1,380 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMPROPERTY_P_H
|
||||
#define BMPROPERTY_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonValue>
|
||||
#include <QPointF>
|
||||
#include <QLoggingCategory>
|
||||
#include <QtMath>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <QtBodymovin/private/bmconstants_p.h>
|
||||
#include <QtBodymovin/private/beziereasing_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
enum class EasingSegmentState : char {
|
||||
Complete,
|
||||
Incomplete,
|
||||
Final,
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct EasingSegment {
|
||||
EasingSegmentState state = EasingSegmentState::Incomplete;
|
||||
double startFrame = 0;
|
||||
double endFrame = 0;
|
||||
T startValue;
|
||||
T endValue;
|
||||
BezierEasing easing;
|
||||
|
||||
double bezierLength = 0.;
|
||||
struct BezierPoint {
|
||||
QPointF point;
|
||||
double length = 0.;
|
||||
};
|
||||
std::vector<BezierPoint> bezierPoints;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class BODYMOVIN_EXPORT BMProperty
|
||||
{
|
||||
public:
|
||||
virtual ~BMProperty() = default;
|
||||
|
||||
void construct(const QJsonObject &definition)
|
||||
{
|
||||
if (definition.value(QStringLiteral("s")).toVariant().toInt())
|
||||
qCWarning(lcLottieQtBodymovinParser)
|
||||
<< "Property is split into separate x and y but it is not supported";
|
||||
|
||||
m_animated = definition.value(QStringLiteral("a")).toDouble() > 0;
|
||||
if (m_animated) {
|
||||
QJsonArray keyframes = definition.value(QStringLiteral("k")).toArray();
|
||||
QJsonArray::const_iterator it = keyframes.constBegin();
|
||||
QJsonArray::const_iterator previous;
|
||||
while (it != keyframes.constEnd()) {
|
||||
QJsonObject keyframe = (*it).toObject();
|
||||
EasingSegment<T> easing = parseKeyframe(keyframe);
|
||||
addEasing(easing);
|
||||
|
||||
if (m_easingCurves.length() > 1) {
|
||||
postprocessEasingCurve(
|
||||
m_easingCurves[m_easingCurves.length() - 2],
|
||||
(*previous).toObject());
|
||||
}
|
||||
previous = it;
|
||||
++it;
|
||||
}
|
||||
finalizeEasingCurves();
|
||||
if (m_easingCurves.length() > 0) {
|
||||
EasingSegment<T> &last = m_easingCurves.last();
|
||||
if (last.state == EasingSegmentState::Complete) {
|
||||
postprocessEasingCurve(
|
||||
last,
|
||||
(*previous).toObject());
|
||||
}
|
||||
}
|
||||
m_value = T();
|
||||
} else
|
||||
m_value = getValue(definition.value(QStringLiteral("k")));
|
||||
}
|
||||
|
||||
void setValue(const T& value)
|
||||
{
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
const T& value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
bool animated() const {
|
||||
return m_animated;
|
||||
}
|
||||
|
||||
virtual bool update(int frame)
|
||||
{
|
||||
if (!m_animated)
|
||||
return false;
|
||||
|
||||
int adjustedFrame = qBound(m_startFrame, frame, m_endFrame);
|
||||
if (const EasingSegment<T> *easing = getEasingSegment(adjustedFrame)) {
|
||||
qreal progress;
|
||||
if (easing->endFrame == easing->startFrame)
|
||||
progress = 1;
|
||||
else
|
||||
progress = ((adjustedFrame - easing->startFrame) * 1.0) /
|
||||
(easing->endFrame - easing->startFrame);
|
||||
qreal easedValue = easing->easing.valueForProgress(progress);
|
||||
m_value = easing->startValue + easedValue *
|
||||
((easing->endValue - easing->startValue));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
void addEasing(EasingSegment<T>& easing)
|
||||
{
|
||||
if (m_easingCurves.length()) {
|
||||
EasingSegment<T> &prevEase = m_easingCurves.last();
|
||||
// The end value has to be hand picked to the
|
||||
// previous easing segment, as the json data does
|
||||
// not contain end values for segments
|
||||
prevEase.endFrame = easing.startFrame;
|
||||
if (prevEase.state == EasingSegmentState::Incomplete) {
|
||||
prevEase.endValue = easing.startValue;
|
||||
prevEase.state = EasingSegmentState::Complete;
|
||||
}
|
||||
}
|
||||
m_easingCurves.push_back(easing);
|
||||
}
|
||||
|
||||
void finalizeEasingCurves()
|
||||
{
|
||||
if (m_easingCurves.length()) {
|
||||
EasingSegment<T> &last = m_easingCurves.last();
|
||||
if (last.state == EasingSegmentState::Incomplete) {
|
||||
last.endValue = last.startValue;
|
||||
last.endFrame = last.startFrame;
|
||||
this->m_endFrame = last.startFrame;
|
||||
last.state = EasingSegmentState::Final;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const EasingSegment<T>* getEasingSegment(int frame)
|
||||
{
|
||||
// TODO: Improve with a faster search algorithm
|
||||
const EasingSegment<T> *easing = m_currentEasing;
|
||||
if (!easing || easing->startFrame < frame ||
|
||||
easing->endFrame > frame) {
|
||||
for (int i=0; i < m_easingCurves.length(); i++) {
|
||||
if (m_easingCurves.at(i).startFrame <= frame &&
|
||||
m_easingCurves.at(i).endFrame >= frame) {
|
||||
m_currentEasing = &m_easingCurves.at(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_currentEasing) {
|
||||
qCWarning(lcLottieQtBodymovinParser)
|
||||
<< "Property is animated but easing cannot be found";
|
||||
}
|
||||
return m_currentEasing;
|
||||
}
|
||||
|
||||
EasingSegment<T> parseKeyframe(const QJsonObject keyframe)
|
||||
{
|
||||
EasingSegment<T> easing;
|
||||
|
||||
int startTime = keyframe.value(QStringLiteral("t")).toVariant().toInt();
|
||||
|
||||
// AE exported Bodymovin file includes the last
|
||||
// key frame but no other properties.
|
||||
// No need to process in that case
|
||||
if (!keyframe.contains(QStringLiteral("s")) && !keyframe.contains(QStringLiteral("e"))) {
|
||||
// In this case start time is the last frame for the property
|
||||
this->m_endFrame = startTime;
|
||||
easing.startFrame = startTime;
|
||||
easing.endFrame = startTime;
|
||||
easing.state = EasingSegmentState::Final;
|
||||
if (m_easingCurves.length()) {
|
||||
const EasingSegment<T> &last = m_easingCurves.last();
|
||||
if (last.state == EasingSegmentState::Complete) {
|
||||
easing.startValue = last.endValue;
|
||||
easing.endValue = last.endValue;
|
||||
} else {
|
||||
qCWarning(lcLottieQtBodymovinParser())
|
||||
<< "Last keyframe found after an incomplete one";
|
||||
}
|
||||
}
|
||||
return easing;
|
||||
}
|
||||
|
||||
if (m_startFrame > startTime)
|
||||
m_startFrame = startTime;
|
||||
|
||||
easing.startFrame = startTime;
|
||||
easing.startValue = getValue(keyframe.value(QStringLiteral("s")).toArray());
|
||||
if (keyframe.contains(QStringLiteral("e"))) {
|
||||
easing.endValue = getValue(keyframe.value(QStringLiteral("e")).toArray());
|
||||
easing.state = EasingSegmentState::Complete;
|
||||
}
|
||||
|
||||
QJsonObject easingIn = keyframe.value(QStringLiteral("i")).toObject();
|
||||
QJsonObject easingOut = keyframe.value(QStringLiteral("o")).toObject();
|
||||
|
||||
if (easingIn.value(QStringLiteral("x")).isArray()) {
|
||||
qreal eix = easingIn.value(QStringLiteral("x")).toArray().at(0).toDouble();
|
||||
qreal eiy = easingIn.value(QStringLiteral("y")).toArray().at(0).toDouble();
|
||||
|
||||
qreal eox = easingOut.value(QStringLiteral("x")).toArray().at(0).toDouble();
|
||||
qreal eoy = easingOut.value(QStringLiteral("y")).toArray().at(0).toDouble();
|
||||
|
||||
QPointF c1 = QPointF(eox, eoy);
|
||||
QPointF c2 = QPointF(eix, eiy);
|
||||
|
||||
easing.easing.addCubicBezierSegment(c1, c2, QPointF(1.0, 1.0));
|
||||
} else {
|
||||
qreal eix = easingIn.value(QStringLiteral("x")).toDouble();
|
||||
qreal eiy = easingIn.value(QStringLiteral("y")).toDouble();
|
||||
|
||||
qreal eox = easingOut.value(QStringLiteral("x")).toDouble();
|
||||
qreal eoy = easingOut.value(QStringLiteral("y")).toDouble();
|
||||
|
||||
QPointF c1 = QPointF(eox, eoy);
|
||||
QPointF c2 = QPointF(eix, eiy);
|
||||
|
||||
easing.easing.addCubicBezierSegment(c1, c2, QPointF(1.0, 1.0));
|
||||
}
|
||||
|
||||
return easing;
|
||||
}
|
||||
|
||||
virtual void postprocessEasingCurve(
|
||||
EasingSegment<T> &easing,
|
||||
const QJsonObject &keyframe) {
|
||||
}
|
||||
|
||||
virtual T getValue(const QJsonValue &value)
|
||||
{
|
||||
if (value.isArray())
|
||||
return getValue(value.toArray());
|
||||
else {
|
||||
QVariant val = value.toVariant();
|
||||
if (val.canConvert<T>()) {
|
||||
T t = val.value<T>();
|
||||
return t;
|
||||
}
|
||||
else
|
||||
return T();
|
||||
}
|
||||
}
|
||||
|
||||
virtual T getValue(const QJsonArray &value)
|
||||
{
|
||||
QVariant val = value.at(0).toVariant();
|
||||
if (val.canConvert<T>()) {
|
||||
T t = val.value<T>();
|
||||
return t;
|
||||
}
|
||||
else
|
||||
return T();
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_animated = false;
|
||||
QList<EasingSegment<T>> m_easingCurves;
|
||||
const EasingSegment<T> *m_currentEasing = nullptr;
|
||||
int m_startFrame = INT_MAX;
|
||||
int m_endFrame = 0;
|
||||
T m_value = T();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class BODYMOVIN_EXPORT BMProperty2D : public BMProperty<T>
|
||||
{
|
||||
protected:
|
||||
T getValue(const QJsonArray &value) override
|
||||
{
|
||||
if (value.count() > 1)
|
||||
return T(value.at(0).toDouble(),
|
||||
value.at(1).toDouble());
|
||||
else
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class BODYMOVIN_EXPORT BMProperty4D : public BMProperty<T>
|
||||
{
|
||||
public:
|
||||
bool update(int frame) override
|
||||
{
|
||||
if (!this->m_animated)
|
||||
return false;
|
||||
|
||||
int adjustedFrame = qBound(this->m_startFrame, frame, this->m_endFrame);
|
||||
if (const EasingSegment<T> *easing = BMProperty<T>::getEasingSegment(adjustedFrame)) {
|
||||
qreal progress;
|
||||
if (easing->endFrame == easing->startFrame)
|
||||
progress = 1;
|
||||
else
|
||||
progress = ((adjustedFrame - easing->startFrame) * 1.0) /
|
||||
(easing->endFrame - easing->startFrame);
|
||||
qreal easedValue = easing->easing.valueForProgress(progress);
|
||||
// For the time being, 4D vectors are used only for colors, and
|
||||
// the value must be restricted to between [0, 1]
|
||||
easedValue = qBound(qreal(0.0), easedValue, qreal(1.0));
|
||||
T sv = easing->startValue;
|
||||
T ev = easing->endValue;
|
||||
qreal x = sv.x() + easedValue * (ev.x() - sv.x());
|
||||
qreal y = sv.y() + easedValue * (ev.y() - sv.y());
|
||||
qreal z = sv.z() + easedValue * (ev.z() - sv.z());
|
||||
qreal w = sv.w() + easedValue * (ev.w() - sv.w());
|
||||
this->m_value = T(x, y, z, w);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
T getValue(const QJsonArray &value) override
|
||||
{
|
||||
if (value.count() > 3)
|
||||
return T(value.at(0).toDouble(), value.at(1).toDouble(),
|
||||
value.at(2).toDouble(), value.at(3).toDouble());
|
||||
else
|
||||
return T();
|
||||
}
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMPROPERTY_P_H
|
@ -1,82 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMRECT_P_H
|
||||
#define BMRECT_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QRect>
|
||||
#include <QPointF>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmspatialproperty_p.h>
|
||||
#include <QtBodymovin/private/bmfill_p.h>
|
||||
#include <QtBodymovin/private/bmstroke_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BODYMOVIN_EXPORT BMRect : public BMShape
|
||||
{
|
||||
public:
|
||||
BMRect(BMBase *parent);
|
||||
BMRect(BMBase *parent, const BMRect &other);
|
||||
BMRect(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
bool acceptsTrim() const override;
|
||||
|
||||
QPointF position() const;
|
||||
QSizeF size() const;
|
||||
qreal roundness() const;
|
||||
|
||||
protected:
|
||||
BMSpatialProperty m_position;
|
||||
BMProperty2D<QSizeF> m_size;
|
||||
BMProperty<qreal> m_roundness;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMRECT_P_H
|
@ -1,79 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMREPEATER_P_H
|
||||
#define BMREPEATER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/bmglobal.h>
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmrepeatertransform_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMRepeater : public BMShape
|
||||
{
|
||||
public:
|
||||
BMRepeater(BMBase *parent);
|
||||
BMRepeater(BMBase *parent, const BMRepeater &other);
|
||||
BMRepeater(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject& definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
int copies() const;
|
||||
qreal offset() const;
|
||||
const BMRepeaterTransform &transform() const;
|
||||
|
||||
protected:
|
||||
BMProperty<int> m_copies;
|
||||
BMProperty<qreal> m_offset;
|
||||
BMRepeaterTransform m_transform;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMREPEATER_P_H
|
@ -1,79 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMREPEATERTRANSFORM_P_H
|
||||
#define BMREPEATERTRANSFORM_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmbasictransform_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMRepeaterTransform : public BMBasicTransform
|
||||
{
|
||||
public:
|
||||
BMRepeaterTransform(BMBase *parent);
|
||||
BMRepeaterTransform(BMBase *parent, const BMRepeaterTransform &other);
|
||||
BMRepeaterTransform(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
qreal startOpacity() const;
|
||||
qreal endOpacity() const;
|
||||
|
||||
void setInstanceCount(int copies);
|
||||
qreal opacityAtInstance(int instance) const;
|
||||
|
||||
protected:
|
||||
int m_copies = 0;
|
||||
BMProperty<qreal> m_startOpacity;
|
||||
BMProperty<qreal> m_endOpacity;
|
||||
QList<qreal> m_opacities;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMREPEATERTRANSFORM_P_H
|
@ -1,84 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMROUND_P_H
|
||||
#define BMROUND_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QRect>
|
||||
#include <QPointF>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmspatialproperty_p.h>
|
||||
#include <QtBodymovin/private/bmfill_p.h>
|
||||
#include <QtBodymovin/private/bmstroke_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMRound : public BMShape
|
||||
{
|
||||
public:
|
||||
BMRound(BMBase *parent);
|
||||
BMRound(BMBase *parent, const BMRound &other);
|
||||
BMRound(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
bool acceptsTrim() const override;
|
||||
|
||||
QPointF position() const;
|
||||
qreal radius() const;
|
||||
|
||||
protected:
|
||||
BMSpatialProperty m_position;
|
||||
BMProperty<qreal> m_radius;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMROUND_P_H
|
@ -1,104 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMSCENE_P_H
|
||||
#define BMSCENE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <QtBodymovin/private/bmbase_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BMAsset;
|
||||
|
||||
class BODYMOVIN_EXPORT BMScene : public BMBase
|
||||
{
|
||||
public:
|
||||
BMScene(const BMScene &other) = delete;
|
||||
BMScene &operator=(const BMScene &other) = delete;
|
||||
explicit BMScene(const QJsonObject &definition);
|
||||
virtual ~BMScene();
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
int startFrame() const;
|
||||
int endFrame() const;
|
||||
int frameRate() const;
|
||||
int width() const;
|
||||
int height() const;
|
||||
|
||||
protected:
|
||||
BMScene *resolveTopRoot() const override;
|
||||
|
||||
private:
|
||||
void parse(const QJsonObject &definition);
|
||||
void resolveAllAssets();
|
||||
|
||||
std::vector<std::unique_ptr<BMAsset>> _assets;
|
||||
QHash<QString, int> _assetIndexById;
|
||||
|
||||
std::unique_ptr<BMBase> _blueprint;
|
||||
std::unique_ptr<BMBase> _current;
|
||||
|
||||
int _startFrame = 0;
|
||||
int _endFrame = 0;
|
||||
int _frameRate = 30;
|
||||
int _width = 0;
|
||||
int _height = 0;
|
||||
QHash<QString, int> _markers;
|
||||
|
||||
bool _unsupported = false;
|
||||
|
||||
// Parsing stage.
|
||||
bool _parsing = false;
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMSCENE_P_H
|
@ -1,94 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMSHAPE_P_H
|
||||
#define BMSHAPE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPainterPath>
|
||||
|
||||
#include <QtBodymovin/private/bmbase_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BMFill;
|
||||
class BMStroke;
|
||||
class BMTrimPath;
|
||||
|
||||
#define BM_SHAPE_ANY_TYPE_IX -1
|
||||
#define BM_SHAPE_ELLIPSE_IX 0
|
||||
#define BM_SHAPE_FILL_IX 1
|
||||
#define BM_SHAPE_GFILL_IX 2
|
||||
#define BM_SHAPE_GSTROKE_IX 3
|
||||
#define BM_SHAPE_GROUP_IX 4
|
||||
#define BM_SHAPE_RECT_IX 5
|
||||
#define BM_SHAPE_ROUND_IX 6
|
||||
#define BM_SHAPE_SHAPE_IX 7
|
||||
#define BM_SHAPE_STAR_IX 8
|
||||
#define BM_SHAPE_STROKE_IX 9
|
||||
#define BM_SHAPE_TRIM_IX 10
|
||||
#define BM_SHAPE_TRANS_IX 11
|
||||
#define BM_SHAPE_REPEATER_IX 12
|
||||
|
||||
class BODYMOVIN_EXPORT BMShape : public BMBase
|
||||
{
|
||||
public:
|
||||
BMShape(BMBase *parent);
|
||||
BMShape(BMBase *parent, const BMShape &other);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
static BMShape *construct(BMBase *parent, QJsonObject definition);
|
||||
|
||||
virtual const QPainterPath &path() const;
|
||||
virtual bool acceptsTrim() const;
|
||||
virtual void applyTrim(const BMTrimPath& trimmer);
|
||||
|
||||
int direction() const;
|
||||
|
||||
protected:
|
||||
QPainterPath m_path;
|
||||
BMTrimPath *m_appliedTrim = nullptr;
|
||||
int m_direction = 0;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMSHAPE_P_H
|
@ -1,74 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMSHAPELAYER_P_H
|
||||
#define BMSHAPELAYER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtBodymovin/private/bmlayer_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class LottieRenderer;
|
||||
class BMShape;
|
||||
class BMTrimPath;
|
||||
class BMBasicTransform;
|
||||
|
||||
class BODYMOVIN_EXPORT BMShapeLayer final : public BMLayer
|
||||
{
|
||||
public:
|
||||
BMShapeLayer(BMBase *parent);
|
||||
BMShapeLayer(BMBase *parent, const BMShapeLayer &other);
|
||||
BMShapeLayer(BMBase *parent, const QJsonObject &definition);
|
||||
~BMShapeLayer() override;
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &render, int frame) const override;
|
||||
|
||||
private:
|
||||
BMTrimPath *m_appliedTrim = nullptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMSHAPELAYER_P_H
|
@ -1,84 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMSHAPETRANSFORM_P_H
|
||||
#define BMSHAPETRANSFORM_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPointF>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmbasictransform_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
class BODYMOVIN_EXPORT BMShapeTransform : public BMBasicTransform
|
||||
{
|
||||
public:
|
||||
BMShapeTransform(BMBase *parent);
|
||||
BMShapeTransform(BMBase *parent, const BMShapeTransform &other);
|
||||
BMShapeTransform(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
qreal skew() const;
|
||||
qreal skewAxis() const;
|
||||
qreal shearX() const;
|
||||
qreal shearY() const;
|
||||
qreal shearAngle() const;
|
||||
|
||||
protected:
|
||||
BMProperty<qreal> m_skew;
|
||||
BMProperty<qreal> m_skewAxis;
|
||||
qreal m_shearX;
|
||||
qreal m_shearY;
|
||||
qreal m_shearAngle;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMSHAPETRANSFORM_P_H
|
@ -1,141 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMSPATIALPROPERTY_P_H
|
||||
#define BMSPATIALPROPERTY_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPointF>
|
||||
#include <QPainterPath>
|
||||
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BMSpatialProperty : public BMProperty2D<QPointF>
|
||||
{
|
||||
public:
|
||||
virtual void postprocessEasingCurve(
|
||||
EasingSegment<QPointF> &easing,
|
||||
const QJsonObject &keyframe) override {
|
||||
// No need to parse further incomplete keyframes (i.e. last keyframes)
|
||||
if (easing.state != EasingSegmentState::Complete) {
|
||||
return;
|
||||
}
|
||||
|
||||
qreal tix = 0, tiy = 0, tox = 0, toy = 0;
|
||||
QJsonArray tiArr = keyframe.value(QStringLiteral("ti")).toArray();
|
||||
QJsonArray toArr = keyframe.value(QStringLiteral("to")).toArray();
|
||||
|
||||
if (tiArr.count() && toArr.count()) {
|
||||
tix = tiArr.at(0).toDouble();
|
||||
tiy = tiArr.at(1).toDouble();
|
||||
tox = toArr.at(0).toDouble();
|
||||
toy = toArr.at(1).toDouble();
|
||||
}
|
||||
QPointF s(easing.startValue);
|
||||
QPointF e(easing.endValue);
|
||||
QPointF c1(tox, toy);
|
||||
QPointF c2(tix, tiy);
|
||||
|
||||
c1 += s;
|
||||
c2 += e;
|
||||
|
||||
QBezier bezier = QBezier::fromPoints(s, c1, c2, e);
|
||||
|
||||
const auto kCount = 150;
|
||||
easing.bezierPoints.reserve(kCount);
|
||||
for (auto k = 0; k < kCount; ++k) {
|
||||
const auto percent = double(k) / (kCount - 1.);
|
||||
auto point = EasingSegment<QPointF>::BezierPoint();
|
||||
point.point = bezier.pointAt(percent);
|
||||
if (k > 0) {
|
||||
const auto delta = (point.point - easing.bezierPoints[k - 1].point);
|
||||
point.length = std::sqrt(QPointF::dotProduct(delta, delta));
|
||||
easing.bezierLength += point.length;
|
||||
}
|
||||
easing.bezierPoints.push_back(point);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool update(int frame) override
|
||||
{
|
||||
if (!m_animated)
|
||||
return false;
|
||||
|
||||
int adjustedFrame = qBound(m_startFrame, frame, m_endFrame);
|
||||
if (const EasingSegment<QPointF> *easing = getEasingSegment(adjustedFrame)) {
|
||||
if (easing->state == EasingSegmentState::Complete) {
|
||||
int length = (easing->endFrame - easing->startFrame);
|
||||
qreal progress = (length > 0)
|
||||
? ((adjustedFrame - easing->startFrame) * 1.0) / length
|
||||
: 1.;
|
||||
qreal easedValue = easing->easing.valueForProgress(progress);
|
||||
//m_value = easing->bezier.pointAtPercent(easedValue);
|
||||
|
||||
const auto distance = easedValue * easing->bezierLength;
|
||||
auto segmentPerc = 0.;
|
||||
auto addedLength = 0.;
|
||||
const auto count = easing->bezierPoints.size();
|
||||
for (auto j = 0; j != count; ++j) {
|
||||
addedLength += easing->bezierPoints[j].length;
|
||||
if (distance == 0. || easedValue == 0. || j == count - 1) {
|
||||
m_value = easing->bezierPoints[j].point;
|
||||
break;
|
||||
} else if (distance >= addedLength && distance < addedLength + easing->bezierPoints[j + 1].length) {
|
||||
segmentPerc = (distance - addedLength) / easing->bezierPoints[j + 1].length;
|
||||
m_value = easing->bezierPoints[j].point + (easing->bezierPoints[j + 1].point - easing->bezierPoints[j].point) * segmentPerc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// In case of incomplete easing we should just take the final point.
|
||||
//m_value = m_bezierPath.pointAtPercent(1.);
|
||||
m_value = easing->endValue;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMSPATIALPROPERTY_P_H
|
@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMSTROKE_P_H
|
||||
#define BMSTROKE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPen>
|
||||
#include <QVector4D>
|
||||
|
||||
#include <QtBodymovin/private/bmshape_p.h>
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BODYMOVIN_EXPORT BMStroke : public BMShape
|
||||
{
|
||||
public:
|
||||
BMStroke(BMBase *parent);
|
||||
BMStroke(BMBase *parent, const BMStroke &other);
|
||||
BMStroke(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
QPen pen() const;
|
||||
qreal opacity() const;
|
||||
|
||||
protected:
|
||||
QColor getColor() const;
|
||||
|
||||
protected:
|
||||
BMProperty<qreal> m_opacity;
|
||||
BMProperty<qreal> m_width;
|
||||
BMProperty4D<QVector4D> m_color;
|
||||
Qt::PenCapStyle m_capStyle;
|
||||
Qt::PenJoinStyle m_joinStyle;
|
||||
qreal m_miterLimit = 0.;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMSTROKE_P_H
|
@ -1,87 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BMTRIMPATH_P_H
|
||||
#define BMTRIMPATH_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPainterPath>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include <QtBodymovin/private/bmproperty_p.h>
|
||||
#include <QtBodymovin/private/bmgroup_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BODYMOVIN_EXPORT BMTrimPath : public BMShape
|
||||
{
|
||||
public:
|
||||
BMTrimPath(BMBase *parent);
|
||||
BMTrimPath(BMBase *parent, const BMTrimPath &other);
|
||||
BMTrimPath(BMBase *parent, const QJsonObject &definition);
|
||||
|
||||
void inherit(const BMTrimPath &other);
|
||||
|
||||
BMBase *clone(BMBase *parent) const override;
|
||||
|
||||
void parse(const QJsonObject &definition);
|
||||
|
||||
void updateProperties(int frame) override;
|
||||
void render(LottieRenderer &renderer, int frame) const override;
|
||||
|
||||
bool acceptsTrim() const override;
|
||||
void applyTrim(const BMTrimPath &trimmer) override;
|
||||
|
||||
qreal start() const;
|
||||
qreal end() const;
|
||||
qreal offset() const;
|
||||
bool simultaneous() const;
|
||||
|
||||
QPainterPath trim(const QPainterPath &path) const;
|
||||
|
||||
protected:
|
||||
BMProperty<qreal> m_start;
|
||||
BMProperty<qreal> m_end;
|
||||
BMProperty<qreal> m_offset;
|
||||
bool m_simultaneous = false;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // BMTRIMPATH_P_H
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef LOTTIERENDERER_H
|
||||
#define LOTTIERENDERER_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QStack>
|
||||
|
||||
#include "bmglobal.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BMBase;
|
||||
class BMLayer;
|
||||
class BMRect;
|
||||
class BMFill;
|
||||
class BMGFill;
|
||||
class BMStroke;
|
||||
class BMBasicTransform;
|
||||
class BMLayerTransform;
|
||||
class BMShapeTransform;
|
||||
class BMRepeaterTransform;
|
||||
class BMShapeLayer;
|
||||
class BMEllipse;
|
||||
class BMRound;
|
||||
class BMFreeFormShape;
|
||||
class BMTrimPath;
|
||||
class BMFillEffect;
|
||||
class BMRepeater;
|
||||
|
||||
class BMMasks;
|
||||
class BMMaskShape;
|
||||
|
||||
class BODYMOVIN_EXPORT LottieRenderer
|
||||
{
|
||||
public:
|
||||
enum TrimmingState{Off = 0, Simultaneous, Individual};
|
||||
|
||||
virtual ~LottieRenderer() = default;
|
||||
|
||||
virtual void saveState() = 0;
|
||||
virtual void restoreState() = 0;
|
||||
|
||||
virtual void setTrimmingState(TrimmingState state);
|
||||
virtual TrimmingState trimmingState() const;
|
||||
|
||||
virtual void startMergeGeometry() = 0;
|
||||
virtual void renderMergedGeometry() = 0;
|
||||
|
||||
virtual void render(const BMLayer &layer) = 0;
|
||||
virtual void render(const BMRect &rect) = 0;
|
||||
virtual void render(const BMEllipse &ellipse) = 0;
|
||||
virtual void render(const BMRound &round) = 0;
|
||||
virtual void render(const BMFill &fill) = 0;
|
||||
virtual void render(const BMGFill &fill) = 0;
|
||||
virtual void render(const BMStroke &stroke) = 0;
|
||||
virtual void render(const BMBasicTransform &trans) = 0;
|
||||
virtual void render(const BMShapeTransform &trans) = 0;
|
||||
virtual void render(const BMFreeFormShape &shape) = 0;
|
||||
virtual void render(const BMTrimPath &trans) = 0;
|
||||
virtual void render(const BMFillEffect &effect) = 0;
|
||||
virtual void render(const BMRepeater &repeater) = 0;
|
||||
|
||||
virtual void render(const BMMaskShape &shape) = 0;
|
||||
virtual void render(const BMMasks &masks) = 0;
|
||||
|
||||
protected:
|
||||
void saveTrimmingState();
|
||||
void restoreTrimmingState();
|
||||
|
||||
TrimmingState m_trimmingState = Off;
|
||||
|
||||
private:
|
||||
QStack<LottieRenderer::TrimmingState> m_trimStateStack;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // LOTTIERENDERER_H
|
@ -1,93 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the lottie-qt module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 or (at your option) any later version
|
||||
** approved by the KDE Free Qt Foundation. The licenses are as published by
|
||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef TRIMPATH_P_H
|
||||
#define TRIMPATH_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QPainterPath>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class TrimPath {
|
||||
public:
|
||||
TrimPath() = default;
|
||||
TrimPath(const QPainterPath &path)
|
||||
: mPath(path) {}
|
||||
TrimPath(const TrimPath &other)
|
||||
: mPath(other.mPath), mLens(other.mLens) {}
|
||||
~TrimPath() {}
|
||||
|
||||
void setPath(const QPainterPath &path) {
|
||||
mPath = path;
|
||||
mLens.clear();
|
||||
}
|
||||
|
||||
QPainterPath path() const {
|
||||
return mPath;
|
||||
}
|
||||
|
||||
QPainterPath trimmed(qreal f1, qreal f2, qreal offset = 0.0) const;
|
||||
|
||||
private:
|
||||
bool lensIsDirty() const {
|
||||
return mLens.size() != mPath.elementCount();
|
||||
}
|
||||
void updateLens() const;
|
||||
int elementAtLength(qreal len) const;
|
||||
QPointF endPointOfElement(int elemIdx) const;
|
||||
void appendTrimmedElement(QPainterPath *to, int elemIdx, bool trimStart, qreal startLen, bool trimEnd, qreal endLen) const;
|
||||
void appendStartOfElement(QPainterPath *to, int elemIdx, qreal len) const {
|
||||
appendTrimmedElement(to, elemIdx, false, 0.0, true, len);
|
||||
}
|
||||
void appendEndOfElement(QPainterPath *to, int elemIdx, qreal len) const {
|
||||
appendTrimmedElement(to, elemIdx, true, len, false, 1.0);
|
||||
}
|
||||
|
||||
void appendElementRange(QPainterPath *to, int first, int last) const;
|
||||
|
||||
QPainterPath mPath;
|
||||
mutable QVector<qreal> mLens;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(TrimPath);
|
||||
|
||||
#endif // TRIMPATH_P_H
|
@ -84,32 +84,31 @@
|
||||
'<(lottie_loc)/bodymovin/bmrepeatertransform.cpp',
|
||||
'<(lottie_loc)/bodymovin/beziereasing.cpp',
|
||||
|
||||
'<(lottie_loc)/bodymovin/beziereasing_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmbase_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmbasictransform_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmconstants_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmellipse_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmfill_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmfilleffect_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmfreeformshape_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmgfill_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmgroup_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmlayer_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmproperty_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmrect_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmrepeater_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmrepeatertransform_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmround_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmshape_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmshapelayer_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmshapetransform_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmspatialproperty_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmstroke_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmtrimpath_p.h',
|
||||
'<(lottie_loc)/bodymovin/trimpath_p.h',
|
||||
'<(lottie_loc)/bodymovin/lottierenderer_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmpathtrimmer_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmglobal.h',
|
||||
'<(lottie_loc)/bodymovin/beziereasing.h',
|
||||
'<(lottie_loc)/bodymovin/bmbase.h',
|
||||
'<(lottie_loc)/bodymovin/bmbasictransform.h',
|
||||
'<(lottie_loc)/bodymovin/bmconstants.h',
|
||||
'<(lottie_loc)/bodymovin/bmellipse.h',
|
||||
'<(lottie_loc)/bodymovin/bmfill.h',
|
||||
'<(lottie_loc)/bodymovin/bmfilleffect.h',
|
||||
'<(lottie_loc)/bodymovin/bmfreeformshape.h',
|
||||
'<(lottie_loc)/bodymovin/bmgfill.h',
|
||||
'<(lottie_loc)/bodymovin/bmgroup.h',
|
||||
'<(lottie_loc)/bodymovin/bmlayer.h',
|
||||
'<(lottie_loc)/bodymovin/bmproperty.h',
|
||||
'<(lottie_loc)/bodymovin/bmrect.h',
|
||||
'<(lottie_loc)/bodymovin/bmrepeater.h',
|
||||
'<(lottie_loc)/bodymovin/bmrepeatertransform.h',
|
||||
'<(lottie_loc)/bodymovin/bmround.h',
|
||||
'<(lottie_loc)/bodymovin/bmshape.h',
|
||||
'<(lottie_loc)/bodymovin/bmshapelayer.h',
|
||||
'<(lottie_loc)/bodymovin/bmshapetransform.h',
|
||||
'<(lottie_loc)/bodymovin/bmspatialproperty.h',
|
||||
'<(lottie_loc)/bodymovin/bmstroke.h',
|
||||
'<(lottie_loc)/bodymovin/bmtrimpath.h',
|
||||
'<(lottie_loc)/bodymovin/trimpath.h',
|
||||
'<(lottie_loc)/bodymovin/lottierenderer.h',
|
||||
'<(lottie_loc)/bodymovin/bmpathtrimmer.h',
|
||||
|
||||
# taken from qtlottie/src/imports/imports.pro
|
||||
'<(lottie_loc)/imports/rasterrenderer/lottierasterrenderer.cpp',
|
||||
@ -125,13 +124,13 @@
|
||||
'<(lottie_loc)/bodymovin/bmmasks.cpp',
|
||||
'<(lottie_loc)/bodymovin/bmmaskshape.cpp',
|
||||
|
||||
'<(lottie_loc)/bodymovin/bmasset_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmprecompasset_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmnulllayer_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmprecomplayer_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmscene_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmmasks_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmmaskshape_p.h',
|
||||
'<(lottie_loc)/bodymovin/bmasset.h',
|
||||
'<(lottie_loc)/bodymovin/bmprecompasset.h',
|
||||
'<(lottie_loc)/bodymovin/bmnulllayer.h',
|
||||
'<(lottie_loc)/bodymovin/bmprecomplayer.h',
|
||||
'<(lottie_loc)/bodymovin/bmscene.h',
|
||||
'<(lottie_loc)/bodymovin/bmmasks.h',
|
||||
'<(lottie_loc)/bodymovin/bmmaskshape.h',
|
||||
],
|
||||
'conditions': [[ 'build_macold', {
|
||||
'xcode_settings': {
|
||||
|
@ -1,13 +0,0 @@
|
||||
@echo OFF
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
set "FullScriptPath=%~dp0"
|
||||
|
||||
python %FullScriptPath%lottie_helper.py
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
exit /b
|
||||
|
||||
:error
|
||||
echo FAILED
|
||||
exit /b 1
|
@ -1,34 +0,0 @@
|
||||
'''
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
'''
|
||||
import sys, os, re, subprocess, shutil
|
||||
|
||||
def finish(code):
|
||||
global executePath
|
||||
os.chdir(executePath)
|
||||
sys.exit(code)
|
||||
|
||||
if sys.platform == 'win32' and not 'COMSPEC' in os.environ:
|
||||
print('[ERROR] COMSPEC environment variable is not set.')
|
||||
finish(1)
|
||||
|
||||
executePath = os.getcwd()
|
||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||
src = scriptPath + '/../ThirdParty/qtlottie/src/bodymovin'
|
||||
dst = scriptPath + '/../ThirdParty/qtlottie_helper/QtBodymovin'
|
||||
|
||||
shutil.rmtree(dst, ignore_errors=True)
|
||||
os.makedirs(dst + '/private')
|
||||
|
||||
for r, d, f in os.walk(src):
|
||||
for file in f:
|
||||
if re.search(r'_p\.h$', file):
|
||||
shutil.copyfile(src + '/' + file, dst + '/private/' + file)
|
||||
elif re.search(r'\.h$', file):
|
||||
shutil.copyfile(src + '/' + file, dst + '/' + file)
|
||||
|
||||
finish(0)
|
Loading…
Reference in New Issue
Block a user