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 8 #ifndef SkSpotShadowMaskFilter_DEFINED 9 #define SkSpotShadowMaskFilter_DEFINED 10 11 #include "SkMaskFilter.h" 12 #include "SkShadowFlags.h" 13 14 /* 15 * This filter implements a shadow for an occluding object 16 * representing a displaced shadow from a point light. 17 */ 18 class SK_API SkSpotShadowMaskFilter { 19 public: 20 /** Create a shadow maskfilter. 21 * @param occluderHeight Height of occluding object off of ground plane. 22 * @param lightPos Position of the light applied to this object. 23 * @param lightRadius Radius of the light (light is assumed to be spherical). 24 * @param spotAlpha Base opacity of the displaced spot shadow. 25 * @param flags Flags to use - defaults to none 26 * @return The new shadow maskfilter 27 */ 28 static sk_sp<SkMaskFilter> Make(SkScalar occluderHeight, const SkPoint3& lightPos, 29 SkScalar lightRadius, SkScalar spotAlpha, 30 uint32_t flags = SkShadowFlags::kNone_ShadowFlag); 31 32 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 33 34 private: 35 SkSpotShadowMaskFilter(); // can't be instantiated 36 }; 37 #endif 38