blob: e8a1f831d351b6cc639a86c8b82af23536284eb0 [file] [log] [blame]
Jim Van Verth43475ad2017-01-13 14:37:37 -05001/*
2* Copyright 2017 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#include "SkShadowUtils.h"
9#include "SkCanvas.h"
10#include "../effects/SkShadowMaskFilter.h"
11
12// Draw an offset spot shadow and outlining ambient shadow for the given path.
13void SkShadowUtils::DrawShadow(SkCanvas* canvas, const SkPath& path, SkScalar occluderHeight,
14 const SkPoint3& lightPos, SkScalar lightRadius,
15 SkScalar ambientAlpha, SkScalar spotAlpha, SkColor color,
16 uint32_t flags) {
17 SkPaint newPaint;
18 newPaint.setColor(color);
19 newPaint.setMaskFilter(SkShadowMaskFilter::Make(occluderHeight, lightPos, lightRadius,
20 ambientAlpha, spotAlpha, flags));
21
22 canvas->drawPath(path, newPaint);
23}