void SVGFEDiffuseLightingElement::parseMappedAttribute(MappedAttribute *attr) { const String& value = attr->value(); if (attr->name() == SVGNames::inAttr) setIn1BaseValue(value); else if (attr->name() == SVGNames::surfaceScaleAttr) setSurfaceScaleBaseValue(value.toFloat()); else if (attr->name() == SVGNames::diffuseConstantAttr) setDiffuseConstantBaseValue(value.toInt()); else if (attr->name() == SVGNames::kernelUnitLengthAttr) { float x, y; if (parseNumberOptionalNumber(value, x, y)) { setKernelUnitLengthXBaseValue(x); setKernelUnitLengthYBaseValue(y); } } else SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); }
void SVGFEConvolveMatrixElement::parseMappedAttribute(Attribute* attr) { const String& value = attr->value(); if (attr->name() == SVGNames::inAttr) setIn1BaseValue(value); else if (attr->name() == SVGNames::orderAttr) { float x, y; if (parseNumberOptionalNumber(value, x, y)) { setOrderXBaseValue(x); setOrderYBaseValue(y); } } else if (attr->name() == SVGNames::edgeModeAttr) { if (value == "duplicate") setEdgeModeBaseValue(EDGEMODE_DUPLICATE); else if (value == "wrap") setEdgeModeBaseValue(EDGEMODE_WRAP); else if (value == "none") setEdgeModeBaseValue(EDGEMODE_NONE); } else if (attr->name() == SVGNames::kernelMatrixAttr) kernelMatrixBaseValue()->parse(value); else if (attr->name() == SVGNames::divisorAttr) setDivisorBaseValue(value.toFloat()); else if (attr->name() == SVGNames::biasAttr) setBiasBaseValue(value.toFloat()); else if (attr->name() == SVGNames::targetXAttr) setTargetXBaseValue(value.toUIntStrict()); else if (attr->name() == SVGNames::targetYAttr) setTargetYBaseValue(value.toUIntStrict()); else if (attr->name() == SVGNames::kernelUnitLengthAttr) { float x, y; if (parseNumberOptionalNumber(value, x, y)) { setKernelUnitLengthXBaseValue(x); setKernelUnitLengthYBaseValue(y); } } else if (attr->name() == SVGNames::preserveAlphaAttr) { if (value == "true") setPreserveAlphaBaseValue(true); else if (value == "false") setPreserveAlphaBaseValue(false); } else SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); }
void SVGFEConvolveMatrixElement::setKernelUnitLength(float x, float y) { setKernelUnitLengthXBaseValue(x); setKernelUnitLengthYBaseValue(y); invalidate(); }
void SVGFEConvolveMatrixElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (!isSupportedAttribute(name)) { SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); return; } if (name == SVGNames::inAttr) { setIn1BaseValue(value); return; } if (name == SVGNames::orderAttr) { float x, y; if (parseNumberOptionalNumber(value, x, y) && x >= 1 && y >= 1) { setOrderXBaseValue(x); setOrderYBaseValue(y); } else document().accessSVGExtensions()->reportWarning( "feConvolveMatrix: problem parsing order=\"" + value + "\". Filtered element will not be displayed."); return; } if (name == SVGNames::edgeModeAttr) { EdgeModeType propertyValue = SVGPropertyTraits<EdgeModeType>::fromString(value); if (propertyValue > 0) setEdgeModeBaseValue(propertyValue); else document().accessSVGExtensions()->reportWarning( "feConvolveMatrix: problem parsing edgeMode=\"" + value + "\". Filtered element will not be displayed."); return; } if (name == SVGNames::kernelMatrixAttr) { SVGNumberList newList; newList.parse(value); detachAnimatedKernelMatrixListWrappers(newList.size()); setKernelMatrixBaseValue(newList); return; } if (name == SVGNames::divisorAttr) { float divisor = value.toFloat(); if (divisor) setDivisorBaseValue(divisor); else document().accessSVGExtensions()->reportWarning( "feConvolveMatrix: problem parsing divisor=\"" + value + "\". Filtered element will not be displayed."); return; } if (name == SVGNames::biasAttr) { setBiasBaseValue(value.toFloat()); return; } if (name == SVGNames::targetXAttr) { setTargetXBaseValue(value.string().toUIntStrict()); return; } if (name == SVGNames::targetYAttr) { setTargetYBaseValue(value.string().toUIntStrict()); return; } if (name == SVGNames::kernelUnitLengthAttr) { float x, y; if (parseNumberOptionalNumber(value, x, y) && x > 0 && y > 0) { setKernelUnitLengthXBaseValue(x); setKernelUnitLengthYBaseValue(y); } else document().accessSVGExtensions()->reportWarning( "feConvolveMatrix: problem parsing kernelUnitLength=\"" + value + "\". Filtered element will not be displayed."); return; } if (name == SVGNames::preserveAlphaAttr) { if (value == "true") setPreserveAlphaBaseValue(true); else if (value == "false") setPreserveAlphaBaseValue(false); else document().accessSVGExtensions()->reportWarning( "feConvolveMatrix: problem parsing preserveAlphaAttr=\"" + value + "\". Filtered element will not be displayed."); return; } ASSERT_NOT_REACHED(); }