62 cropX = x;
63 cropY = y;
64 cropW = w;
65 cropH = h;
66 }
67
68 /**
69 * Passes along the properties from the source object after adding a
70 * property indicating the cropped region.
71 * This method invokes <code>super.setProperties</code>,
72 * which might result in additional properties being added.
73 * <p>
74 * Note: This method is intended to be called by the
75 * <code>ImageProducer</code> of the <code>Image</code> whose pixels
76 * are being filtered. Developers using
77 * this class to filter pixels from an image should avoid calling
78 * this method directly since that operation could interfere
79 * with the filtering operation.
80 */
81 public void setProperties(Hashtable<?,?> props) {
82 Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
83 p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH));
84 super.setProperties(p);
85 }
86
87 /**
88 * Override the source image's dimensions and pass the dimensions
89 * of the rectangular cropped region to the ImageConsumer.
90 * <p>
91 * Note: This method is intended to be called by the
92 * <code>ImageProducer</code> of the <code>Image</code> whose
93 * pixels are being filtered. Developers using
94 * this class to filter pixels from an image should avoid calling
95 * this method directly since that operation could interfere
96 * with the filtering operation.
97 * @see ImageConsumer
98 */
99 public void setDimensions(int w, int h) {
100 consumer.setDimensions(cropW, cropH);
101 }
|
62 cropX = x;
63 cropY = y;
64 cropW = w;
65 cropH = h;
66 }
67
68 /**
69 * Passes along the properties from the source object after adding a
70 * property indicating the cropped region.
71 * This method invokes <code>super.setProperties</code>,
72 * which might result in additional properties being added.
73 * <p>
74 * Note: This method is intended to be called by the
75 * <code>ImageProducer</code> of the <code>Image</code> whose pixels
76 * are being filtered. Developers using
77 * this class to filter pixels from an image should avoid calling
78 * this method directly since that operation could interfere
79 * with the filtering operation.
80 */
81 public void setProperties(Hashtable<?,?> props) {
82 @SuppressWarnings("unchecked")
83 Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
84 p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH));
85 super.setProperties(p);
86 }
87
88 /**
89 * Override the source image's dimensions and pass the dimensions
90 * of the rectangular cropped region to the ImageConsumer.
91 * <p>
92 * Note: This method is intended to be called by the
93 * <code>ImageProducer</code> of the <code>Image</code> whose
94 * pixels are being filtered. Developers using
95 * this class to filter pixels from an image should avoid calling
96 * this method directly since that operation could interfere
97 * with the filtering operation.
98 * @see ImageConsumer
99 */
100 public void setDimensions(int w, int h) {
101 consumer.setDimensions(cropW, cropH);
102 }
|