| 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 |
REG_FIDDLE(Canvas_skew, 256, 256, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPaint paint; |
| 7 |
SkFont font(fontMgr->matchFamilyStyle(nullptr, {}), 128); |
| 8 |
canvas->translate(30, 130); |
| 9 |
canvas->save(); |
| 10 |
canvas->skew(-.5, 0); |
| 11 |
canvas->drawString("A1", 0, 0, font, paint); |
| 12 |
canvas->restore(); |
| 13 |
canvas->save(); |
| 14 |
canvas->skew(0, .5); |
| 15 |
paint.setColor(SK_ColorRED); |
| 16 |
canvas->drawString("A1", 0, 0, font, paint); |
| 17 |
canvas->restore(); |
| 18 |
canvas->skew(-.5, .5); |
| 19 |
paint.setColor(SK_ColorBLUE); |
| 20 |
canvas->drawString("A1", 0, 0, font, paint); |
| 21 |
} |
| 22 |
} // END FIDDLE |