1 7 8 package java.awt.image; 9 10 import java.util.Hashtable ; 11 12 28 public class ImageFilter implements ImageConsumer , Cloneable { 29 39 protected ImageConsumer consumer; 40 41 55 public ImageFilter getFilterInstance(ImageConsumer ic) { 56 ImageFilter instance = (ImageFilter ) clone(); 57 instance.consumer = ic; 58 return instance; 59 } 60 61 72 public void setDimensions(int width, int height) { 73 consumer.setDimensions(width, height); 74 } 75 76 89 public void setProperties(Hashtable <?,?> props) { 90 Hashtable <Object ,Object > p = (Hashtable <Object ,Object >)props.clone(); 91 Object o = p.get("filters"); 92 if (o == null) { 93 p.put("filters", toString()); 94 } else if (o instanceof String ) { 95 p.put("filters", ((String ) o)+toString()); 96 } 97 consumer.setProperties(p); 98 } 99 100 111 public void setColorModel(ColorModel model) { 112 consumer.setColorModel(model); 113 } 114 115 126 public void setHints(int hints) { 127 consumer.setHints(hints); 128 } 129 130 141 public void setPixels(int x, int y, int w, int h, 142 ColorModel model, byte pixels[], int off, 143 int scansize) { 144 consumer.setPixels(x, y, w, h, model, pixels, off, scansize); 145 } 146 147 158 public void setPixels(int x, int y, int w, int h, 159 ColorModel model, int pixels[], int off, 160 int scansize) { 161 consumer.setPixels(x, y, w, h, model, pixels, off, scansize); 162 } 163 164 175 public void imageComplete(int status) { 176 consumer.imageComplete(status); 177 } 178 179 226 public void resendTopDownLeftRight(ImageProducer ip) { 227 ip.requestTopDownLeftRightResend(this); 228 } 229 230 233 public Object clone() { 234 try { 235 return super.clone(); 236 } catch (CloneNotSupportedException e) { 237 throw new InternalError (); 239 } 240 } 241 } 242 | Popular Tags |