2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
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.
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.
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.
23 #include "core/svg/SVGFEOffsetElement.h"
25 #include "core/SVGNames.h"
26 #include "core/svg/graphics/filters/SVGFilterBuilder.h"
27 #include "platform/graphics/filters/FilterEffect.h"
31 inline SVGFEOffsetElement::SVGFEOffsetElement(Document
& document
)
32 : SVGFilterPrimitiveStandardAttributes(SVGNames::feOffsetTag
, document
)
33 , m_dx(SVGAnimatedNumber::create(this, SVGNames::dxAttr
, SVGNumber::create()))
34 , m_dy(SVGAnimatedNumber::create(this, SVGNames::dyAttr
, SVGNumber::create()))
35 , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr
, SVGString::create()))
37 addToPropertyMap(m_dx
);
38 addToPropertyMap(m_dy
);
39 addToPropertyMap(m_in1
);
42 DEFINE_TRACE(SVGFEOffsetElement
)
46 visitor
->trace(m_in1
);
47 SVGFilterPrimitiveStandardAttributes::trace(visitor
);
50 DEFINE_NODE_FACTORY(SVGFEOffsetElement
)
52 void SVGFEOffsetElement::svgAttributeChanged(const QualifiedName
& attrName
)
54 if (attrName
== SVGNames::inAttr
|| attrName
== SVGNames::dxAttr
55 || attrName
== SVGNames::dyAttr
) {
56 SVGElement::InvalidationGuard
invalidationGuard(this);
61 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName
);
64 PassRefPtrWillBeRawPtr
<FilterEffect
> SVGFEOffsetElement::build(SVGFilterBuilder
* filterBuilder
, Filter
* filter
)
66 FilterEffect
* input1
= filterBuilder
->getEffectById(AtomicString(m_in1
->currentValue()->value()));
71 RefPtrWillBeRawPtr
<FilterEffect
> effect
= FEOffset::create(filter
, m_dx
->currentValue()->value(), m_dy
->currentValue()->value());
72 effect
->inputEffects().append(input1
);
73 return effect
.release();