// Extract Blend operation
CompositeRule rule = getRule(filterElement);
// Extract sources
String in1Attr = filterElement.getAttributeNS(null, ATTR_IN);
Filter in1;
in1 = CSSUtilities.getFilterSource(filteredNode,
in1Attr,
bridgeContext,
filteredElement,
in,
filterMap);
String in2Attr = filterElement.getAttributeNS(null, ATTR_IN2);
if (in2Attr.length() == 0) {
throw new MissingAttributeException(
Messages.formatMessage("feBlend.in2.required", null));
}
Filter in2;
in2 = CSSUtilities.getFilterSource(filteredNode,
in2Attr,
bridgeContext,
filteredElement,
in,
filterMap);
if ((in1 == null) || (in2 == null)) {
return null;
}
//
// The default region is the union of the input sources
// regions unless 'in' is 'SourceGraphic' in which case the
// default region is the filterChain's region
//
Filter sourceGraphics = (Filter)filterMap.get(VALUE_SOURCE_GRAPHIC);
Rectangle2D defaultRegion = in1.getBounds2D();
defaultRegion.add(in2.getBounds2D());
if(in1 == sourceGraphics) {
defaultRegion = filterRegion;
}
CSSStyleDeclaration cssDecl
= bridgeContext.getViewCSS().getComputedStyle(filterElement, null);
UnitProcessor.Context uctx
= new DefaultUnitProcessorContext(bridgeContext, cssDecl);
Rectangle2D blendArea
= SVGUtilities.convertFilterPrimitiveRegion(filterElement,
filteredElement,
defaultRegion,
filteredNode,
uctx);
// Now, do the blend.
Filter filter = null;
Vector srcs = new Vector(2);
srcs.add(in2);
srcs.add(in1);
filter = new ConcreteCompositeRable(srcs, rule);