1 18 package org.apache.batik.bridge; 19 20 import java.awt.geom.Rectangle2D ; 21 import java.util.Map ; 22 23 import org.apache.batik.ext.awt.image.Light; 24 import org.apache.batik.ext.awt.image.renderable.DiffuseLightingRable8Bit; 25 import org.apache.batik.ext.awt.image.renderable.Filter; 26 import org.apache.batik.gvt.GraphicsNode; 27 import org.w3c.dom.Element ; 28 29 35 public class SVGFeDiffuseLightingElementBridge 36 extends AbstractSVGLightingElementBridge { 37 38 39 42 public SVGFeDiffuseLightingElementBridge() {} 43 44 47 public String getLocalName() { 48 return SVG_FE_DIFFUSE_LIGHTING_TAG; 49 } 50 51 69 public Filter createFilter(BridgeContext ctx, 70 Element filterElement, 71 Element filteredElement, 72 GraphicsNode filteredNode, 73 Filter inputFilter, 74 Rectangle2D filterRegion, 75 Map filterMap) { 76 77 float surfaceScale 79 = convertNumber(filterElement, SVG_SURFACE_SCALE_ATTRIBUTE, 1); 80 81 float diffuseConstant 83 = convertNumber(filterElement, SVG_DIFFUSE_CONSTANT_ATTRIBUTE, 1); 84 85 88 Light light = extractLight(filterElement, ctx); 90 91 double [] kernelUnitLength = convertKernelUnitLength(filterElement); 93 94 Filter in = getIn(filterElement, 96 filteredElement, 97 filteredNode, 98 inputFilter, 99 filterMap, 100 ctx); 101 if (in == null) { 102 return null; } 104 105 Rectangle2D defaultRegion = in.getBounds2D(); 109 Rectangle2D primitiveRegion 110 = SVGUtilities.convertFilterPrimitiveRegion(filterElement, 111 filteredElement, 112 filteredNode, 113 defaultRegion, 114 filterRegion, 115 ctx); 116 Filter filter = new DiffuseLightingRable8Bit(in, 117 primitiveRegion, 118 light, 119 diffuseConstant, 120 surfaceScale, 121 kernelUnitLength); 122 123 handleColorInterpolationFilters(filter, filterElement); 125 126 updateFilterMap(filterElement, filter, filterMap); 128 129 return filter; 130 } 131 } 132 | Popular Tags |