SkDropShadowImageFilter.h revision cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977
15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/* 2ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch * Copyright 2013 Google Inc. 3ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch * 4ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch * Use of this source code is governed by a BSD-style license that can be 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * found in the LICENSE file. 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "SkColor.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "SkImageFilter.h" 10ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "SkScalar.h" 11ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class SK_API SkDropShadowImageFilter : public SkImageFilter { 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)public: 145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigma, 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SkColor color, SkImageFilter* input = NULL) { 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigma, color, input)); 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SkScalar sigmaX, SkScalar sigmaY, SkColor color, 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SkImageFilter* input = NULL, 214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) const CropRect* cropRect = NULL) { 224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, 234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) color, input, cropRect)); 244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } 254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)protected: 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) explicit SkDropShadowImageFilter(SkReadBuffer&); 301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool onFilterImage(Proxy*, const SkBitmap& source, const SkMatrix&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE; 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, 336e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) SkIRect* dst) const SK_OVERRIDE; 34424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 356e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS 366e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)public: 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigma, SkColor, 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SkImageFilter* input = NULL); 40ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, 41ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch SkImageFilter* input = NULL, const CropRect* cropRect = NULL); 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 43private: 44 SkScalar fDx, fDy, fSigmaX, fSigmaY; 45 SkColor fColor; 46 typedef SkImageFilter INHERITED; 47}; 48