1 18 package org.apache.batik.svggen; 19 20 import java.awt.AlphaComposite ; 21 import java.awt.Composite ; 22 import java.util.LinkedList ; 23 import java.util.List ; 24 25 import org.apache.batik.ext.awt.g2d.GraphicContext; 26 27 44 public class SVGComposite implements SVGConverter { 45 48 private SVGAlphaComposite svgAlphaComposite; 49 50 53 private SVGCustomComposite svgCustomComposite; 54 55 58 private SVGGeneratorContext generatorContext; 59 60 64 public SVGComposite(SVGGeneratorContext generatorContext) { 65 this.svgAlphaComposite = new SVGAlphaComposite(generatorContext); 66 this.svgCustomComposite = new SVGCustomComposite(generatorContext); 67 this.generatorContext = generatorContext; 68 } 69 70 74 public List getDefinitionSet() { 75 List compositeDefs = new LinkedList (svgAlphaComposite.getDefinitionSet()); 76 compositeDefs.addAll(svgCustomComposite.getDefinitionSet()); 77 return compositeDefs; 78 } 79 80 public SVGAlphaComposite getAlphaCompositeConverter() { 81 return svgAlphaComposite; 82 } 83 84 public SVGCustomComposite getCustomCompositeConverter() { 85 return svgCustomComposite; 86 } 87 88 98 public SVGDescriptor toSVG(GraphicContext gc) { 99 return toSVG(gc.getComposite()); 100 } 101 102 107 public SVGCompositeDescriptor toSVG(Composite composite) { 108 if (composite instanceof AlphaComposite ) 109 return svgAlphaComposite.toSVG((AlphaComposite )composite); 110 else 111 return svgCustomComposite.toSVG(composite); 112 } 113 } 114 | Popular Tags |