Home | History | Annotate | Download | only in filters
      1 /*
      2  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
      3  * Copyright (C) 2013 Google Inc. All rights reserved.
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Library General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2 of the License, or (at your option) any later version.
      9  *
     10  * This library is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13  * Library General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Library General Public License
     16  * along with this library; see the file COPYING.LIB.  If not, write to
     17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18  * Boston, MA 02110-1301, USA.
     19  */
     20 
     21 #ifndef FEDropShadow_h
     22 #define FEDropShadow_h
     23 
     24 #include "platform/graphics/Color.h"
     25 #include "platform/graphics/filters/Filter.h"
     26 #include "platform/graphics/filters/FilterEffect.h"
     27 
     28 namespace blink {
     29 
     30 class PLATFORM_EXPORT FEDropShadow : public FilterEffect {
     31 public:
     32     static PassRefPtr<FEDropShadow> create(Filter*, float, float, float, float, const Color&, float);
     33 
     34     float stdDeviationX() const { return m_stdX; }
     35     void setStdDeviationX(float stdX) { m_stdX = stdX; }
     36 
     37     float stdDeviationY() const { return m_stdY; }
     38     void setStdDeviationY(float stdY) { m_stdY = stdY; }
     39 
     40     float dx() const { return m_dx; }
     41     void setDx(float dx) { m_dx = dx; }
     42 
     43     float dy() const { return m_dy; }
     44     void setDy(float dy) { m_dy = dy; }
     45 
     46     Color shadowColor() const { return m_shadowColor; }
     47     void setShadowColor(const Color& shadowColor) { m_shadowColor = shadowColor; }
     48 
     49     float shadowOpacity() const { return m_shadowOpacity; }
     50     void setShadowOpacity(float shadowOpacity) { m_shadowOpacity = shadowOpacity; }
     51 
     52     virtual FloatRect mapRect(const FloatRect&, bool forward = true) OVERRIDE FINAL;
     53 
     54     virtual TextStream& externalRepresentation(TextStream&, int indention) const OVERRIDE;
     55     virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*) OVERRIDE;
     56 
     57 private:
     58     FEDropShadow(Filter*, float, float, float, float, const Color&, float);
     59 
     60     virtual void applySoftware() OVERRIDE;
     61 
     62     float m_stdX;
     63     float m_stdY;
     64     float m_dx;
     65     float m_dy;
     66     Color m_shadowColor;
     67     float m_shadowOpacity;
     68 };
     69 
     70 } // namespace blink
     71 
     72 #endif // FEDropShadow_h
     73