• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 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(skpaint_mix, 256, 256, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6     SkPaint fillPaint;
7     SkPaint strokePaint;
8     strokePaint.setStyle(SkPaint::kStroke_Style);
9     strokePaint.setStrokeWidth(3.0f);
10 
11     canvas->drawRect(SkRect::MakeXYWH(10, 10, 60, 20), fillPaint);
12     canvas->drawRect(SkRect::MakeXYWH(80, 10, 60, 20), strokePaint);
13 
14     strokePaint.setStrokeWidth(5.0f);
15     canvas->drawOval(SkRect::MakeXYWH(150, 10, 60, 20), strokePaint);
16 
17     sk_sp<SkTextBlob> blob = SkTextBlob::MakeFromString("SKIA", SkFont(nullptr, 80));
18 
19     fillPaint.setColor(SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00));
20     canvas->drawTextBlob(blob.get(), 20, 120, fillPaint);
21 
22     fillPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0x00, 0xFF));
23     canvas->drawTextBlob(blob.get(), 20, 220, fillPaint);
24 }
25 }  // END FIDDLE
26