1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 // HASH=935c8f8b9782d297a73d7186f6ef7945
5 REG_FIDDLE(Canvas_drawTextRSXform, 256, 256, false, 0) {
6 void draw(SkCanvas* canvas) {
7 const int iterations = 26;
8 SkRSXform transforms[iterations];
9 char alphabet[iterations];
12 for (size_t i = 0; i < SK_ARRAY_COUNT(transforms); ++i) {
13 const SkScalar s = SkScalarSin(angle) * scale;
14 const SkScalar c = SkScalarCos(angle) * scale;
15 transforms[i] = SkRSXform::Make(-c, -s, -s * 16, c * 16);
18 alphabet[i] = 'A' + i;
21 SkFont font(nullptr, 20);
22 auto spiral = SkTextBlob::MakeFromRSXform(alphabet, sizeof(alphabet), transforms, font);
23 canvas->drawTextBlob(spiral, 110, 138, paint);