blob: 79fb91ade35389a293c98335f22332875fba5990 [file] [log] [blame]
Hal Canary6c8422c2020-01-10 15:22:09 -05001// 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"
4REG_FIDDLE(setimagefilter, 256, 100, false, 0) {
5void draw(SkCanvas* canvas) {
6 SkBitmap bitmap;
7 bitmap.allocN32Pixels(100, 100);
8 SkCanvas offscreen(bitmap);
9 SkPaint paint;
10 paint.setAntiAlias(true);
11 paint.setColor(SK_ColorWHITE);
12 SkFont font(nullptr, 96);
13 offscreen.clear(0);
14 offscreen.drawString("e", 20, 70, font, paint);
15 paint.setImageFilter(SkLightingImageFilter::MakePointLitDiffuse(
16 SkPoint3::Make(80, 100, 10), SK_ColorWHITE, 1, 2, nullptr, nullptr));
17 canvas->drawBitmap(bitmap, 0, 0, &paint);
18}
19
20} // END FIDDLE