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