1 18 package org.apache.batik.gvt; 19 20 import java.awt.Graphics2D ; 21 import java.awt.Shape ; 22 import java.awt.geom.Rectangle2D ; 23 24 import org.apache.batik.ext.awt.image.GraphicsUtil; 25 import org.apache.batik.ext.awt.image.renderable.Filter; 26 27 34 public class RasterImageNode extends AbstractGraphicsNode { 35 36 39 protected Filter image; 40 41 44 public RasterImageNode() {} 45 46 50 55 public void setImage(Filter newImage) { 56 fireGraphicsNodeChangeStarted(); 57 invalidateGeometryCache(); 58 this.image = newImage; 59 fireGraphicsNodeChangeCompleted(); 60 } 61 62 67 public Filter getImage() { 68 return image; 69 } 70 71 76 public Rectangle2D getImageBounds() { 77 if (image == null) 78 return null; 79 return (Rectangle2D ) image.getBounds2D().clone(); 80 } 81 82 87 public Filter getGraphicsNodeRable() { 88 return image; 89 } 90 91 95 100 public void primitivePaint(Graphics2D g2d) { 101 if (image == null) return; 102 103 GraphicsUtil.drawImage(g2d, image); 104 } 105 106 110 113 public Rectangle2D getPrimitiveBounds() { 114 if (image == null) 115 return null; 116 return image.getBounds2D(); 117 } 118 119 124 public Rectangle2D getGeometryBounds() { 125 if (image == null) 126 return null; 127 return image.getBounds2D(); 128 } 129 130 135 public Rectangle2D getSensitiveBounds() { 136 if (image == null) 137 return null; 138 return image.getBounds2D(); 139 } 140 141 144 public Shape getOutline() { 145 if (image == null) 146 return null; 147 return image.getBounds2D(); 148 } 149 } 150 | Popular Tags |