blob: 68cbbdf8d60e0c62c5f2ee59220e0adbd065d652 [file] [log] [blame]
halcanarydecb21e2015-12-10 07:52:45 -08001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8// This is an example of the translation unit that needs to be
9// assembled by the fiddler program to compile into a fiddle: an
10// implementation of the GetDrawOptions() and draw() functions.
11
12#include "fiddle_main.h"
13DrawOptions GetDrawOptions() {
14 // path *should* be absolute.
mtklein5dbd2742016-08-02 11:13:48 -070015 static const char path[] = "resources/color_wheel.png";
halcanarydecb21e2015-12-10 07:52:45 -080016 return DrawOptions(256, 256, true, true, true, true, path);
17}
18void draw(SkCanvas* canvas) {
19 canvas->clear(SK_ColorWHITE);
20 SkMatrix matrix;
21 matrix.setScale(0.75f, 0.75f);
22 matrix.preRotate(30.0f);
halcanarydecb21e2015-12-10 07:52:45 -080023 SkPaint paint;
halcanaryd0964592016-03-25 11:29:34 -070024 paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
25 SkShader::kRepeat_TileMode,
26 &matrix));
halcanarydecb21e2015-12-10 07:52:45 -080027 canvas->drawPaint(paint);
28}