Jim Van Verth | bce7496 | 2017-01-25 09:39:46 -0500 | [diff] [blame] | 1 | /* |
| 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 Verth | efe3ded | 2017-01-30 13:11:45 -0500 | [diff] [blame] | 8 | #ifndef SkShadowTessellator_DEFINED |
| 9 | #define SkShadowTessellator_DEFINED |
Jim Van Verth | bce7496 | 2017-01-25 09:39:46 -0500 | [diff] [blame] | 10 | |
Jim Van Verth | efe3ded | 2017-01-30 13:11:45 -0500 | [diff] [blame] | 11 | #include "SkColor.h" |
Brian Salomon | aff27a2 | 2017-02-06 15:47:44 -0500 | [diff] [blame] | 12 | #include "SkPoint.h" |
| 13 | #include "SkRefCnt.h" |
Jim Van Verth | bce7496 | 2017-01-25 09:39:46 -0500 | [diff] [blame] | 14 | |
| 15 | class SkMatrix; |
| 16 | class SkPath; |
Mike Reed | 54518ac | 2017-07-22 08:29:48 -0400 | [diff] [blame] | 17 | struct SkPoint3; |
Brian Salomon | aff27a2 | 2017-02-06 15:47:44 -0500 | [diff] [blame] | 18 | class SkVertices; |
Jim Van Verth | bce7496 | 2017-01-25 09:39:46 -0500 | [diff] [blame] | 19 | |
Brian Salomon | aff27a2 | 2017-02-06 15:47:44 -0500 | [diff] [blame] | 20 | namespace SkShadowTessellator { |
Jim Van Verth | b436655 | 2017-03-27 14:25:29 -0400 | [diff] [blame] | 21 | |
| 22 | typedef std::function<SkScalar(SkScalar, SkScalar)> HeightFunc; |
| 23 | |
Brian Salomon | aff27a2 | 2017-02-06 15:47:44 -0500 | [diff] [blame] | 24 | /** |
| 25 | * This function generates an ambient shadow mesh for a path by walking the path, outsetting by |
| 26 | * the radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively. |
| 27 | * If transparent is true, then the center of the ambient shadow will be filled in. |
| 28 | */ |
Jim Van Verth | b436655 | 2017-03-27 14:25:29 -0400 | [diff] [blame] | 29 | sk_sp<SkVertices> MakeAmbient(const SkPath& path, const SkMatrix& ctm, |
Jim Van Verth | e308a12 | 2017-05-08 14:19:30 -0400 | [diff] [blame] | 30 | const SkPoint3& zPlane, bool transparent); |
Jim Van Verth | bce7496 | 2017-01-25 09:39:46 -0500 | [diff] [blame] | 31 | |
Brian Salomon | aff27a2 | 2017-02-06 15:47:44 -0500 | [diff] [blame] | 32 | /** |
| 33 | * This function generates a spot shadow mesh for a path by walking the transformed path, |
| 34 | * further transforming by the scale and translation, and outsetting and insetting by a radius. |
| 35 | * The center will be clipped against the original path unless transparent is true. |
| 36 | */ |
Jim Van Verth | e308a12 | 2017-05-08 14:19:30 -0400 | [diff] [blame] | 37 | sk_sp<SkVertices> MakeSpot(const SkPath& path, const SkMatrix& ctm, const SkPoint3& zPlane, |
Jim Van Verth | 060d982 | 2017-05-04 09:58:17 -0400 | [diff] [blame] | 38 | const SkPoint3& lightPos, SkScalar lightRadius, bool transparent); |
Jim Van Verth | 1af03d4 | 2017-07-31 09:34:58 -0400 | [diff] [blame] | 39 | |
| 40 | |
Brian Salomon | aff27a2 | 2017-02-06 15:47:44 -0500 | [diff] [blame] | 41 | } |
Jim Van Verth | 91af727 | 2017-01-27 14:15:54 -0500 | [diff] [blame] | 42 | |
Jim Van Verth | bce7496 | 2017-01-25 09:39:46 -0500 | [diff] [blame] | 43 | #endif |