SVGFEBlendElement.h [plain text]
#pragma once
#include "GraphicsTypes.h"
#include "SVGAnimatedEnumeration.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
namespace WebCore {
template<>
struct SVGPropertyTraits<BlendMode> {
static unsigned highestEnumValue() { return static_cast<unsigned>(BlendMode::Luminosity); }
static String toString(BlendMode type)
{
if (type < BlendMode::PlusDarker)
return blendModeName(type);
return emptyString();
}
};
class SVGFEBlendElement final : public SVGFilterPrimitiveStandardAttributes {
WTF_MAKE_ISO_ALLOCATED(SVGFEBlendElement);
public:
static Ref<SVGFEBlendElement> create(const QualifiedName&, Document&);
String in1() const { return m_in1.currentValue(attributeOwnerProxy()); }
String in2() const { return m_in2.currentValue(attributeOwnerProxy()); }
BlendMode mode() const { return m_mode.currentValue(attributeOwnerProxy()); }
RefPtr<SVGAnimatedString> in1Animated() { return m_in1.animatedProperty(attributeOwnerProxy()); }
RefPtr<SVGAnimatedString> in2Animated() { return m_in2.animatedProperty(attributeOwnerProxy()); }
RefPtr<SVGAnimatedEnumeration> modeAnimated() { return m_mode.animatedProperty(attributeOwnerProxy()); }
private:
SVGFEBlendElement(const QualifiedName&, Document&);
using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGFEBlendElement, SVGFilterPrimitiveStandardAttributes>;
static AttributeOwnerProxy::AttributeRegistry& attributeRegistry() { return AttributeOwnerProxy::attributeRegistry(); }
static bool isKnownAttribute(const QualifiedName& attributeName) { return AttributeOwnerProxy::isKnownAttribute(attributeName); }
static void registerAttributes();
const SVGAttributeOwnerProxy& attributeOwnerProxy() const final { return m_attributeOwnerProxy; }
void parseAttribute(const QualifiedName&, const AtomicString&) override;
void svgAttributeChanged(const QualifiedName&) override;
RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
AttributeOwnerProxy m_attributeOwnerProxy { *this };
SVGAnimatedStringAttribute m_in1;
SVGAnimatedStringAttribute m_in2;
SVGAnimatedEnumerationAttribute<BlendMode> m_mode { BlendMode::Normal };
};
}