1 18 package org.apache.batik.transcoder.image; 19 20 import java.util.HashMap ; 21 import java.util.Map ; 22 23 import org.apache.batik.transcoder.TranscoderInput; 24 25 32 public class DimensionTest extends AbstractImageTranscoderTest { 33 34 35 protected String inputURI; 36 37 38 protected String refImageURI; 39 40 41 protected Float width; 42 43 44 protected Float height; 45 46 54 public DimensionTest(String inputURI, 55 String refImageURI, 56 Float width, 57 Float height) { 58 this.inputURI = inputURI; 59 this.refImageURI = refImageURI; 60 this.width = width; 61 this.height = height; 62 } 63 64 67 protected TranscoderInput createTranscoderInput() { 68 return new TranscoderInput(resolveURL(inputURI).toString()); 69 } 70 71 74 protected Map createTranscodingHints() { 75 Map hints = new HashMap (7); 76 if (width.floatValue() > 0) { 77 hints.put(ImageTranscoder.KEY_WIDTH, width); 78 } 79 if (height.floatValue() > 0) { 80 hints.put(ImageTranscoder.KEY_HEIGHT, height); 81 } 82 return hints; 83 } 84 85 88 protected byte [] getReferenceImageData() { 89 return createBufferedImageData(resolveURL(refImageURI)); 90 } 91 } 92 | Popular Tags |