File indexing completed on 2024-04-28 15:24:31
0001 /* 0002 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 0003 2004, 2005, 2006 Rob Buis <buis@kde.org> 0004 0005 This file is part of the KDE project 0006 0007 This library is free software; you can redistribute it and/or 0008 modify it under the terms of the GNU Library General Public 0009 License as published by the Free Software Foundation; either 0010 version 2 of the License, or (at your option) any later version. 0011 0012 This library is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 Library General Public License for more details. 0016 0017 You should have received a copy of the GNU Library General Public License 0018 along with this library; see the file COPYING.LIB. If not, write to 0019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 Boston, MA 02110-1301, USA. 0021 */ 0022 0023 #if ENABLE(SVG) && ENABLE(SVG_FILTERS) 0024 #include "SVGFEGaussianBlurElement.h" 0025 0026 #include "SVGNames.h" 0027 #include "SVGParserUtilities.h" 0028 #include "SVGResourceFilter.h" 0029 0030 namespace WebCore 0031 { 0032 0033 SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName &tagName, Document *doc) 0034 : SVGFilterPrimitiveStandardAttributes(tagName, doc) 0035 , m_stdDeviationX(0.0f) 0036 , m_stdDeviationY(0.0f) 0037 , m_filterEffect(0) 0038 { 0039 } 0040 0041 SVGFEGaussianBlurElement::~SVGFEGaussianBlurElement() 0042 { 0043 delete m_filterEffect; 0044 } 0045 0046 ANIMATED_PROPERTY_DEFINITIONS(SVGFEGaussianBlurElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1) 0047 ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(SVGFEGaussianBlurElement, float, Number, number, StdDeviationX, stdDeviationX, SVGNames::stdDeviationAttr, "stdDeviationX", m_stdDeviationX) 0048 ANIMATED_PROPERTY_DEFINITIONS_WITH_CUSTOM_IDENTIFIER(SVGFEGaussianBlurElement, float, Number, number, StdDeviationY, stdDeviationY, SVGNames::stdDeviationAttr, "stdDeviationY", m_stdDeviationY) 0049 0050 void SVGFEGaussianBlurElement::setStdDeviation(float stdDeviationX, float stdDeviationY) 0051 { 0052 } 0053 0054 void SVGFEGaussianBlurElement::parseMappedAttribute(MappedAttribute *attr) 0055 { 0056 const String &value = attr->value(); 0057 if (attr->name() == SVGNames::stdDeviationAttr) { 0058 float x, y; 0059 if (parseNumberOptionalNumber(value, x, y)) { 0060 setStdDeviationXBaseValue(x); 0061 setStdDeviationYBaseValue(y); 0062 } 0063 } else if (attr->name() == SVGNames::inAttr) { 0064 setIn1BaseValue(value); 0065 } else { 0066 SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); 0067 } 0068 } 0069 0070 SVGFEGaussianBlur *SVGFEGaussianBlurElement::filterEffect(SVGResourceFilter *filter) const 0071 { 0072 if (!m_filterEffect) { 0073 m_filterEffect = new SVGFEGaussianBlur(filter); 0074 } 0075 0076 m_filterEffect->setIn(in1()); 0077 m_filterEffect->setStdDeviationX(stdDeviationX()); 0078 m_filterEffect->setStdDeviationY(stdDeviationY()); 0079 0080 setStandardAttributes(m_filterEffect); 0081 return m_filterEffect; 0082 } 0083 0084 } 0085 0086 #endif // ENABLE(SVG) 0087