1 /*
2 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
87 * @see ImageConsumer#setDimensions
88 */
89 public void setDimensions(int width, int height) {
90 consumer.setDimensions(width, height);
91 }
92
93 /**
94 * Passes the properties from the source object along after adding a
95 * property indicating the stream of filters it has been run through.
96 * <p>
97 * Note: This method is intended to be called by the ImageProducer
98 * of the Image whose pixels are being filtered. Developers using
99 * this class to filter pixels from an image should avoid calling
100 * this method directly since that operation could interfere
101 * with the filtering operation.
102 *
103 * @param props the properties from the source object
104 * @exception NullPointerException if <code>props</code> is null
105 */
106 public void setProperties(Hashtable<?,?> props) {
107 Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
108 Object o = p.get("filters");
109 if (o == null) {
110 p.put("filters", toString());
111 } else if (o instanceof String) {
112 p.put("filters", ((String) o)+toString());
113 }
114 consumer.setProperties(p);
115 }
116
117 /**
118 * Filter the information provided in the setColorModel method
119 * of the ImageConsumer interface.
120 * <p>
121 * Note: This method is intended to be called by the ImageProducer
122 * of the Image whose pixels are being filtered. Developers using
123 * this class to filter pixels from an image should avoid calling
124 * this method directly since that operation could interfere
125 * with the filtering operation.
126 * @see ImageConsumer#setColorModel
|
1 /*
2 * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
87 * @see ImageConsumer#setDimensions
88 */
89 public void setDimensions(int width, int height) {
90 consumer.setDimensions(width, height);
91 }
92
93 /**
94 * Passes the properties from the source object along after adding a
95 * property indicating the stream of filters it has been run through.
96 * <p>
97 * Note: This method is intended to be called by the ImageProducer
98 * of the Image whose pixels are being filtered. Developers using
99 * this class to filter pixels from an image should avoid calling
100 * this method directly since that operation could interfere
101 * with the filtering operation.
102 *
103 * @param props the properties from the source object
104 * @exception NullPointerException if <code>props</code> is null
105 */
106 public void setProperties(Hashtable<?,?> props) {
107 @SuppressWarnings("unchecked")
108 Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
109 Object o = p.get("filters");
110 if (o == null) {
111 p.put("filters", toString());
112 } else if (o instanceof String) {
113 p.put("filters", ((String) o)+toString());
114 }
115 consumer.setProperties(p);
116 }
117
118 /**
119 * Filter the information provided in the setColorModel method
120 * of the ImageConsumer interface.
121 * <p>
122 * Note: This method is intended to be called by the ImageProducer
123 * of the Image whose pixels are being filtered. Developers using
124 * this class to filter pixels from an image should avoid calling
125 * this method directly since that operation could interfere
126 * with the filtering operation.
127 * @see ImageConsumer#setColorModel
|