1 18 package org.apache.batik.svggen; 19 20 import java.awt.Rectangle ; 21 import java.awt.image.BufferedImageOp ; 22 import java.awt.image.ConvolveOp ; 23 import java.awt.image.LookupOp ; 24 import java.awt.image.RescaleOp ; 25 import java.util.LinkedList ; 26 import java.util.List ; 27 28 39 public class SVGBufferedImageOp extends AbstractSVGFilterConverter { 40 43 private SVGLookupOp svgLookupOp; 44 45 48 private SVGRescaleOp svgRescaleOp; 49 50 53 private SVGConvolveOp svgConvolveOp; 54 55 59 private SVGCustomBufferedImageOp svgCustomBufferedImageOp; 60 61 66 public SVGBufferedImageOp(SVGGeneratorContext generatorContext) { 67 super(generatorContext); 68 this.svgLookupOp = new SVGLookupOp(generatorContext); 69 this.svgRescaleOp = new SVGRescaleOp(generatorContext); 70 this.svgConvolveOp = new SVGConvolveOp(generatorContext); 71 this.svgCustomBufferedImageOp = 72 new SVGCustomBufferedImageOp(generatorContext); 73 } 74 75 79 public List getDefinitionSet(){ 80 List filterSet = new LinkedList (svgLookupOp.getDefinitionSet()); 81 filterSet.addAll(svgRescaleOp.getDefinitionSet()); 82 filterSet.addAll(svgConvolveOp.getDefinitionSet()); 83 filterSet.addAll(svgCustomBufferedImageOp.getDefinitionSet()); 84 return filterSet; 85 } 86 87 public SVGLookupOp getLookupOpConverter(){ 88 return svgLookupOp; 89 } 90 91 public SVGRescaleOp getRescaleOpConverter(){ 92 return svgRescaleOp; 93 } 94 95 public SVGConvolveOp getConvolveOpConverter(){ 96 return svgConvolveOp; 97 } 98 99 public SVGCustomBufferedImageOp getCustomBufferedImageOpConverter(){ 100 return svgCustomBufferedImageOp; 101 } 102 103 111 public SVGFilterDescriptor toSVG(BufferedImageOp op, 112 Rectangle filterRect){ 113 SVGFilterDescriptor filterDesc = 114 svgCustomBufferedImageOp.toSVG(op, filterRect); 115 116 if(filterDesc == null){ 117 if(op instanceof LookupOp ) 118 filterDesc = svgLookupOp.toSVG((LookupOp )op, filterRect); 119 else if(op instanceof RescaleOp ) 120 filterDesc = svgRescaleOp.toSVG((RescaleOp )op, filterRect); 121 else if(op instanceof ConvolveOp ) 122 filterDesc = svgConvolveOp.toSVG((ConvolveOp )op, filterRect); 123 } 124 125 return filterDesc; 126 } 127 } 128 | Popular Tags |