2015-12-10 15:52:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// This is an example of the translation unit that needs to be
|
|
|
|
// assembled by the fiddler program to compile into a fiddle: an
|
|
|
|
// implementation of the GetDrawOptions() and draw() functions.
|
|
|
|
|
|
|
|
#include "fiddle_main.h"
|
|
|
|
DrawOptions GetDrawOptions() {
|
|
|
|
// path *should* be absolute.
|
2016-08-02 18:13:48 +00:00
|
|
|
static const char path[] = "resources/color_wheel.png";
|
2017-02-13 16:39:43 +00:00
|
|
|
return DrawOptions(256, 256, true, true, true, true, true, false, false, path);
|
2015-12-10 15:52:45 +00:00
|
|
|
}
|
|
|
|
void draw(SkCanvas* canvas) {
|
|
|
|
canvas->clear(SK_ColorWHITE);
|
|
|
|
SkMatrix matrix;
|
|
|
|
matrix.setScale(0.75f, 0.75f);
|
2017-04-19 18:05:14 +00:00
|
|
|
matrix.preRotate(frame * 30.0f * duration); // If an animation, rotate at 30 deg/s.
|
2015-12-10 15:52:45 +00:00
|
|
|
SkPaint paint;
|
2016-03-25 18:29:34 +00:00
|
|
|
paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
|
|
|
|
SkShader::kRepeat_TileMode,
|
|
|
|
&matrix));
|
2015-12-10 15:52:45 +00:00
|
|
|
canvas->drawPaint(paint);
|
2017-02-13 16:39:43 +00:00
|
|
|
SkDebugf("This is text output: %d", 2);
|
2015-12-10 15:52:45 +00:00
|
|
|
}
|