blob: eb49bbee3f24a2ee256220528ce95f0abedb3489 [file] [log] [blame]
Jim Van Verthbce74962017-01-25 09:39:46 -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
Jim Van Verthefe3ded2017-01-30 13:11:45 -05008#ifndef SkShadowTessellator_DEFINED
9#define SkShadowTessellator_DEFINED
Jim Van Verthbce74962017-01-25 09:39:46 -050010
Jim Van Verthefe3ded2017-01-30 13:11:45 -050011#include "SkColor.h"
Brian Salomonaff27a22017-02-06 15:47:44 -050012#include "SkPoint.h"
13#include "SkRefCnt.h"
Jim Van Verthbce74962017-01-25 09:39:46 -050014
15class SkMatrix;
16class SkPath;
Brian Salomonaff27a22017-02-06 15:47:44 -050017class SkVertices;
Jim Van Verthbce74962017-01-25 09:39:46 -050018
Brian Salomonaff27a22017-02-06 15:47:44 -050019namespace SkShadowTessellator {
20/**
21 * This function generates an ambient shadow mesh for a path by walking the path, outsetting by
22 * the radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively.
23 * If transparent is true, then the center of the ambient shadow will be filled in.
24 */
25sk_sp<SkVertices> MakeAmbient(const SkPath& path, const SkMatrix& ctm, SkScalar radius,
26 SkColor umbraColor, SkColor penumbraColor, bool transparent);
Jim Van Verthbce74962017-01-25 09:39:46 -050027
Brian Salomonaff27a22017-02-06 15:47:44 -050028/**
29 * This function generates a spot shadow mesh for a path by walking the transformed path,
30 * further transforming by the scale and translation, and outsetting and insetting by a radius.
31 * The center will be clipped against the original path unless transparent is true.
32 */
33sk_sp<SkVertices> MakeSpot(const SkPath& path, const SkMatrix& ctm, SkScalar scale,
34 const SkVector& translate, SkScalar radius, SkColor umbraColor,
35 SkColor penumbraColor, bool transparent);
36}
Jim Van Verth91af7272017-01-27 14:15:54 -050037
Jim Van Verthbce74962017-01-25 09:39:46 -050038#endif