"tools/fiddle/draw.cpp",
"tools/fiddle/fiddle_main.cpp",
]
+ testonly = true
deps = [
+ ":flags",
":skia",
":skia.h",
]
--- /dev/null
+#!/bin/sh
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Create a 3 second long animation from the Raster output of fiddle at 15 fps.
+FPS=15
+DURATION=3
+FRAMES=$((DURATION * FPS))
+mkdir -p /tmp/animation
+for i in $(seq -f "%05g" 0 $FRAMES)
+do
+ ./out/Release/fiddle --duration $DURATION --frame `bc -l <<< "$i/$FRAMES"` | ./tools/fiddle/parse-fiddle-output
+ cp /tmp/fiddle_Raster.png /tmp/animation/image-"$i".png
+done
+cd /tmp/animation; ffmpeg -r $FPS -pattern_type glob -i '*.png' -c:v libvpx-vp9 -lossless 1 output.webm
canvas->clear(SK_ColorWHITE);
SkMatrix matrix;
matrix.setScale(0.75f, 0.75f);
- matrix.preRotate(30.0f);
+ matrix.preRotate(frame * 30.0f * duration); // If an animation, rotate at 30 deg/s.
SkPaint paint;
paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode,
#include <sstream>
#include <string>
+#include "SkCommandLineFlags.h"
+
#include "fiddle_main.h"
+DEFINE_double(duration, 1.0, "The total duration, in seconds, of the animation we are drawing.");
+DEFINE_double(frame, 1.0, "A double value in [0, 1] that specifies the point in animation to draw.");
+
// Globals externed in fiddle_main.h
SkBitmap source;
sk_sp<SkImage> image;
+double duration; // The total duration of the animation in seconds.
+double frame; // A value in [0, 1] of where we are in the animation.
// Global used by the local impl of SkDebugf.
std::ostringstream gTextOutput;
-int main() {
+int main(int argc, char** argv) {
+ SkCommandLineFlags::Parse(argc, argv);
+ duration = FLAGS_duration;
+ frame = FLAGS_frame;
DrawOptions options = GetDrawOptions();
// If textOnly then only do one type of image, otherwise the text
// output is duplicated for each type.
extern SkBitmap source;
extern sk_sp<SkImage> image;
+extern double duration; // The total duration of the animation in seconds.
+extern double frame; // A value in [0, 1] of where we are in the animation.
struct DrawOptions {
DrawOptions(int w, int h, bool r, bool g, bool p, bool k, bool srgb, bool f16, bool textOnly, const char* s)