1/* 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public License 17 * along with this library; see the file COPYING.LIB. If not, write to 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22#ifndef SVGFEBlendElement_h 23#define SVGFEBlendElement_h 24 25#if ENABLE(FILTERS) 26#include "FEBlend.h" 27#include "SVGAnimatedEnumeration.h" 28#include "SVGFilterPrimitiveStandardAttributes.h" 29 30namespace WebCore { 31 32template<> 33struct SVGPropertyTraits<BlendMode> { 34 static unsigned highestEnumValue() { return BlendModeLighten; } 35 36 static String toString(BlendMode type) 37 { 38 switch (type) { 39 case BlendModeNormal: 40 return "normal"; 41 case BlendModeMultiply: 42 return "multiply"; 43 case BlendModeScreen: 44 return "screen"; 45 case BlendModeDarken: 46 return "darken"; 47 case BlendModeLighten: 48 return "lighten"; 49 default: 50 return emptyString(); 51 } 52 } 53}; 54 55class SVGFEBlendElement final : public SVGFilterPrimitiveStandardAttributes { 56public: 57 static PassRefPtr<SVGFEBlendElement> create(const QualifiedName&, Document&); 58 59private: 60 SVGFEBlendElement(const QualifiedName&, Document&); 61 62 bool isSupportedAttribute(const QualifiedName&); 63 virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; 64 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; 65 virtual void svgAttributeChanged(const QualifiedName&) override; 66 virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*) override; 67 68 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEBlendElement) 69 DECLARE_ANIMATED_STRING(In1, in1) 70 DECLARE_ANIMATED_STRING(In2, in2) 71 DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendMode) 72 END_DECLARE_ANIMATED_PROPERTIES 73}; 74 75} // namespace WebCore 76 77#endif // ENABLE(FILTERS) 78#endif 79