aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/shadows/SkSpotShadowMaskFilter.h
blob: 5e1a4a9ec902e8ca123ba68266c7145e0b01caa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkSpotShadowMaskFilter_DEFINED
#define SkSpotShadowMaskFilter_DEFINED

#include "SkMaskFilter.h"
#include "SkShadowFlags.h"

/*
 * This filter implements a shadow for an occluding object
 * representing a displaced shadow from a point light.
 */
class SK_API SkSpotShadowMaskFilter {
public:
    /** Create a shadow maskfilter.
     *  @param occluderHeight Height of occluding object off of ground plane.
     *  @param lightPos       Position of the light applied to this object.
     *  @param lightRadius    Radius of the light (light is assumed to be spherical).
     *  @param spotAlpha      Base opacity of the displaced spot shadow.
     *  @param flags          Flags to use - defaults to none
     *  @return The new shadow maskfilter
     */
    static sk_sp<SkMaskFilter> Make(SkScalar occluderHeight, const SkPoint3& lightPos,
                                    SkScalar lightRadius, SkScalar spotAlpha,
                                    uint32_t flags = SkShadowFlags::kNone_ShadowFlag);

    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()

private:
    SkSpotShadowMaskFilter(); // can't be instantiated
};
#endif