1 18 package org.apache.batik.svggen; 19 20 import java.util.HashMap ; 21 import java.util.LinkedList ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 import org.w3c.dom.Element ; 26 27 34 public class SVGPaintDescriptor implements SVGDescriptor, SVGSyntax{ 35 private Element def; 36 private String paintValue; 37 private String opacityValue; 38 39 public SVGPaintDescriptor(String paintValue, 40 String opacityValue){ 41 this.paintValue = paintValue; 42 this.opacityValue = opacityValue; 43 } 44 45 public SVGPaintDescriptor(String paintValue, 46 String opacityValue, 47 Element def){ 48 this(paintValue, opacityValue); 49 this.def = def; 50 } 51 52 public String getPaintValue(){ 53 return paintValue; 54 } 55 56 public String getOpacityValue(){ 57 return opacityValue; 58 } 59 60 public Element getDef(){ 61 return def; 62 } 63 64 public Map getAttributeMap(Map attrMap){ 65 if(attrMap == null) 66 attrMap = new HashMap (); 67 68 attrMap.put(SVG_FILL_ATTRIBUTE, paintValue); 69 attrMap.put(SVG_STROKE_ATTRIBUTE, paintValue); 70 attrMap.put(SVG_FILL_OPACITY_ATTRIBUTE, opacityValue); 71 attrMap.put(SVG_STROKE_OPACITY_ATTRIBUTE, opacityValue); 72 73 return attrMap; 74 } 75 76 public List getDefinitionSet(List defSet){ 77 if(defSet == null) 78 defSet = new LinkedList (); 79 80 if(def != null) 81 defSet.add(def); 82 83 return defSet; 84 } 85 } 86 | Popular Tags |