1 /* 2 * Copyright 2013 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 #include "SkColor.h" 9 #include "SkImageFilter.h" 10 #include "SkScalar.h" 11 12 class SK_API SkDropShadowImageFilter : public SkImageFilter { 13 public: 14 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, 15 SkScalar sigmaX, SkScalar sigmaY, SkColor color, 16 SkImageFilter* input = NULL, 17 const CropRect* cropRect = NULL, 18 uint32_t uniqueID = 0) { 19 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, 20 color, input, cropRect, uniqueID)); 21 } 22 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; 23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) 24 25 protected: 26 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, 27 SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID); 28 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 29 explicit SkDropShadowImageFilter(SkReadBuffer&); 30 #endif 31 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 32 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE; 33 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, 34 SkIRect* dst) const SK_OVERRIDE; 35 36 private: 37 SkScalar fDx, fDy, fSigmaX, fSigmaY; 38 SkColor fColor; 39 typedef SkImageFilter INHERITED; 40 }; 41