1bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth/*
2bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth * Copyright 2017 Google Inc.
3bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth *
4bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth * Use of this source code is governed by a BSD-style license that can be
5bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth * found in the LICENSE file.
6bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth */
7bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth
8efe3dedbb3493b738abdb56041b093245e4e8711Jim Van Verth#ifndef SkShadowTessellator_DEFINED
9efe3dedbb3493b738abdb56041b093245e4e8711Jim Van Verth#define SkShadowTessellator_DEFINED
10bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth
11efe3dedbb3493b738abdb56041b093245e4e8711Jim Van Verth#include "SkColor.h"
12aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon#include "SkPoint.h"
13aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon#include "SkRefCnt.h"
14bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth
15bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verthclass SkMatrix;
16bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verthclass SkPath;
17aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomonclass SkVertices;
18bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth
19aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomonnamespace SkShadowTessellator {
20b436655ad5c40a04b65c1642d0a0e781ce296c96Jim Van Verth
21b436655ad5c40a04b65c1642d0a0e781ce296c96Jim Van Verthtypedef std::function<SkScalar(SkScalar, SkScalar)> HeightFunc;
22b436655ad5c40a04b65c1642d0a0e781ce296c96Jim Van Verth
23aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon/**
24aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon * This function generates an ambient shadow mesh for a path by walking the path, outsetting by
25aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon * the radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively.
26aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon * If transparent is true, then the center of the ambient shadow will be filled in.
27aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon */
28b436655ad5c40a04b65c1642d0a0e781ce296c96Jim Van Verthsk_sp<SkVertices> MakeAmbient(const SkPath& path, const SkMatrix& ctm,
29e308a122ef996a64a21a6339e3b50b9edfdf654fJim Van Verth                              const SkPoint3& zPlane, bool transparent);
30958fbc460a1e680c6a9979e140da8bfc00b8831dBrian Salomon
31aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon/**
32aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon * This function generates a spot shadow mesh for a path by walking the transformed path,
33aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon * further transforming by the scale and translation, and outsetting and insetting by a radius.
34aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon * The center will be clipped against the original path unless transparent is true.
35aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon */
36e308a122ef996a64a21a6339e3b50b9edfdf654fJim Van Verthsk_sp<SkVertices> MakeSpot(const SkPath& path, const SkMatrix& ctm, const SkPoint3& zPlane,
37060d9820364b0cf09c7eb3bda449f24c3dcba2e2Jim Van Verth                           const SkPoint3& lightPos, SkScalar lightRadius, bool transparent);
38aff27a23ad4b38851429066dbfb43cfa7199e37cBrian Salomon}
3991af72703830f3946c538b47c6c7c96afc0adde2Jim Van Verth
40bce7496d7dd9131cc7121389a55f6d512ee7661eJim Van Verth#endif
41