• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • svg
SVGFECompositeElement.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3  2004, 2005, 2006 Rob Buis <buis@kde.org>
4 
5  This file is part of the KDE project
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #include "config.h"
24 
25 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
26 #include "SVGFECompositeElement.h"
27 
28 #include "SVGNames.h"
29 #include "SVGResourceFilter.h"
30 
31 namespace WebCore {
32 
33 SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document* doc)
34  : SVGFilterPrimitiveStandardAttributes(tagName, doc)
35  , m__operator(SVG_FECOMPOSITE_OPERATOR_OVER)
36  , m_k1(0.0f)
37  , m_k2(0.0f)
38  , m_k3(0.0f)
39  , m_k4(0.0f)
40  , m_filterEffect(0)
41 {
42 }
43 
44 SVGFECompositeElement::~SVGFECompositeElement()
45 {
46  delete m_filterEffect;
47 }
48 
49 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In1, in1, SVGNames::inAttr, m_in1)
50 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, String, String, string, In2, in2, SVGNames::in2Attr, m_in2)
51 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, int, Enumeration, enumeration, _operator, _operator, SVGNames::operatorAttr, m__operator)
52 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K1, k1, SVGNames::k1Attr, m_k1)
53 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K2, k2, SVGNames::k2Attr, m_k2)
54 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K3, k3, SVGNames::k3Attr, m_k3)
55 ANIMATED_PROPERTY_DEFINITIONS(SVGFECompositeElement, float, Number, number, K4, k4, SVGNames::k4Attr, m_k4)
56 
57 void SVGFECompositeElement::parseMappedAttribute(MappedAttribute *attr)
58 {
59  const String& value = attr->value();
60  if (attr->name() == SVGNames::operatorAttr) {
61  if (value == "over")
62  set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_OVER);
63  else if (value == "in")
64  set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_IN);
65  else if (value == "out")
66  set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_OUT);
67  else if (value == "atop")
68  set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_ATOP);
69  else if (value == "xor")
70  set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_XOR);
71  else if (value == "arithmetic")
72  set_operatorBaseValue(SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
73  }
74  else if (attr->name() == SVGNames::inAttr)
75  setIn1BaseValue(value);
76  else if (attr->name() == SVGNames::in2Attr)
77  setIn2BaseValue(value);
78  else if (attr->name() == SVGNames::k1Attr)
79  setK1BaseValue(value.toFloat());
80  else if (attr->name() == SVGNames::k2Attr)
81  setK2BaseValue(value.toFloat());
82  else if (attr->name() == SVGNames::k3Attr)
83  setK3BaseValue(value.toFloat());
84  else if (attr->name() == SVGNames::k4Attr)
85  setK4BaseValue(value.toFloat());
86  else
87  SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr);
88 }
89 
90 SVGFEComposite* SVGFECompositeElement::filterEffect(SVGResourceFilter* filter) const
91 {
92  if (!m_filterEffect)
93  m_filterEffect = new SVGFEComposite(filter);
94 
95  m_filterEffect->setOperation((SVGCompositeOperationType) _operator());
96  m_filterEffect->setIn(in1());
97  m_filterEffect->setIn2(in2());
98  m_filterEffect->setK1(k1());
99  m_filterEffect->setK2(k2());
100  m_filterEffect->setK3(k3());
101  m_filterEffect->setK4(k4());
102 
103  setStandardAttributes(m_filterEffect);
104  return m_filterEffect;
105 }
106 
107 }
108 
109 #endif // ENABLE(SVG)
110 
111 // vim:ts=4:noet
SVGFECompositeElement.h
WebCore::SVGNames::k3Attr
DOM::QualifiedName k3Attr
Definition: SVGNames.cpp:198
WebCore::SVGNames::in2Attr
DOM::QualifiedName in2Attr
Definition: SVGNames.cpp:193
WebCore::SVGNames::k2Attr
DOM::QualifiedName k2Attr
Definition: SVGNames.cpp:197
WebCore::SVGNames::k1Attr
DOM::QualifiedName k1Attr
Definition: SVGNames.cpp:196
WebCore::SVGNames::k4Attr
DOM::QualifiedName k4Attr
Definition: SVGNames.cpp:199
SVGNames.h
WebCore::SVGNames::inAttr
DOM::QualifiedName inAttr
Definition: SVGNames.cpp:192
WebCore::SVGNames::operatorAttr
DOM::QualifiedName operatorAttr
Definition: SVGNames.cpp:238
SVGResourceFilter.h
WebCore::String
DOM::DOMString String
Definition: PlatformString.h:8
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal