aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/skotty/Skotty.h
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/skotty/Skotty.h')
-rw-r--r--experimental/skotty/Skotty.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/experimental/skotty/Skotty.h b/experimental/skotty/Skotty.h
new file mode 100644
index 0000000000..5cdffb829d
--- /dev/null
+++ b/experimental/skotty/Skotty.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef Skotty_DEFINED
+#define Skotty_DEFINED
+
+#include "SkRefCnt.h"
+#include "SkSize.h"
+#include "SkString.h"
+#include "SkTArray.h"
+#include "SkTHash.h"
+#include "SkTypes.h"
+
+#include <memory>
+
+class SkCanvas;
+class SkStream;
+
+namespace Json { class Value; }
+
+namespace sksg { class RenderNode; }
+
+namespace skotty {
+
+class AnimatorBase;
+
+class Animation : public SkNoncopyable {
+public:
+ static std::unique_ptr<Animation> Make(SkStream*);
+
+ ~Animation();
+
+ void render(SkCanvas*) const;
+
+ void animationTick(SkMSec);
+
+ const SkString& version() const { return fVersion; }
+ const SkSize& size() const { return fSize; }
+ SkScalar frameRate() const { return fFrameRate; }
+
+ void setShowInval(bool show) { fShowInval = show; }
+
+private:
+ Animation(SkString ver, const SkSize& size, SkScalar fps, const Json::Value&);
+
+ SkString fVersion;
+ SkSize fSize;
+ SkScalar fFrameRate,
+ fInPoint,
+ fOutPoint;
+
+ sk_sp<sksg::RenderNode> fDom;
+ SkTArray<std::unique_ptr<AnimatorBase>> fAnimators;
+
+ bool fShowInval = false;
+
+ typedef SkNoncopyable INHERITED;
+};
+
+} // namespace skotty
+
+#endif // Skotty_DEFINED