SVGFEBlendElement.h [plain text]
#pragma once
#include "GraphicsTypes.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
namespace WebCore {
template<>
struct SVGPropertyTraits<BlendMode> {
static unsigned highestEnumValue() { return static_cast<unsigned>(BlendMode::Luminosity); }
static BlendMode fromString(const String& string)
{
BlendMode mode = BlendMode::Normal;
parseBlendMode(string, mode);
return mode;
}
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(); }
String in2() const { return m_in2->currentValue(); }
BlendMode mode() const { return m_mode->currentValue<BlendMode>(); }
SVGAnimatedString& in1Animated() { return m_in1; }
SVGAnimatedString& in2Animated() { return m_in2; }
SVGAnimatedEnumeration& modeAnimated() { return m_mode; }
private:
SVGFEBlendElement(const QualifiedName&, Document&);
using PropertyRegistry = SVGPropertyOwnerRegistry<SVGFEBlendElement, SVGFilterPrimitiveStandardAttributes>;
const SVGPropertyRegistry& propertyRegistry() const final { return m_propertyRegistry; }
void parseAttribute(const QualifiedName&, const AtomString&) override;
void svgAttributeChanged(const QualifiedName&) override;
RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) const override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
PropertyRegistry m_propertyRegistry { *this };
Ref<SVGAnimatedString> m_in1 { SVGAnimatedString::create(this) };
Ref<SVGAnimatedString> m_in2 { SVGAnimatedString::create(this) };
Ref<SVGAnimatedEnumeration> m_mode { SVGAnimatedEnumeration::create(this, BlendMode::Normal) };
};
}