SVGFEDisplacementMapElement.h [plain text]
#pragma once
#include "FEDisplacementMap.h"
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedNumber.h"
#include "SVGFilterPrimitiveStandardAttributes.h"
namespace WebCore {
template<>
struct SVGPropertyTraits<ChannelSelectorType> {
static unsigned highestEnumValue() { return CHANNEL_A; }
static String toString(ChannelSelectorType type)
{
switch (type) {
case CHANNEL_UNKNOWN:
return emptyString();
case CHANNEL_R:
return "R"_s;
case CHANNEL_G:
return "G"_s;
case CHANNEL_B:
return "B"_s;
case CHANNEL_A:
return "A"_s;
}
ASSERT_NOT_REACHED();
return emptyString();
}
static ChannelSelectorType fromString(const String& value)
{
if (value == "R")
return CHANNEL_R;
if (value == "G")
return CHANNEL_G;
if (value == "B")
return CHANNEL_B;
if (value == "A")
return CHANNEL_A;
return CHANNEL_UNKNOWN;
}
};
class SVGFEDisplacementMapElement final : public SVGFilterPrimitiveStandardAttributes {
WTF_MAKE_ISO_ALLOCATED(SVGFEDisplacementMapElement);
public:
static Ref<SVGFEDisplacementMapElement> create(const QualifiedName&, Document&);
static ChannelSelectorType stringToChannel(const String&);
private:
SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&);
void parseAttribute(const QualifiedName&, const AtomicString&) override;
bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override;
void svgAttributeChanged(const QualifiedName&) override;
RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override;
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement)
DECLARE_ANIMATED_STRING(In1, in1)
DECLARE_ANIMATED_STRING(In2, in2)
DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType)
DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType)
DECLARE_ANIMATED_NUMBER(Scale, scale)
END_DECLARE_ANIMATED_PROPERTIES
};
}