01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2003, 2ie Technologie
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.image.jai;
18:
19: // J2SE dependencies
20: import java.awt.RenderingHints;
21: import java.awt.image.RenderedImage;
22: import java.awt.image.renderable.ParameterBlock;
23:
24: // JAI dependencies
25: import javax.media.jai.CRIFImpl;
26: import javax.media.jai.ImageLayout;
27: import javax.media.jai.JAI;
28:
29: /**
30: * The factory for the {@link Hysteresis} operation.
31: *
32: * @since 2.1
33: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/image/jai/HysteresisCRIF.java $
34: * @version $Id: HysteresisCRIF.java 20970 2006-08-11 07:53:22Z jgarnett $
35: * @author Lionel Flahaut
36: */
37: public class HysteresisCRIF extends CRIFImpl {
38: /**
39: * Constructs a default factory.
40: */
41: public HysteresisCRIF() {
42: }
43:
44: /**
45: * Creates a {@link RenderedImage} for the results of an imaging
46: * operation for a given {@link ParameterBlock} and {@link RenderingHints}.
47: */
48: public RenderedImage create(final ParameterBlock param,
49: final RenderingHints hints) {
50: final RenderedImage image = (RenderedImage) param.getSource(0);
51: final ImageLayout layout = (ImageLayout) hints
52: .get(JAI.KEY_IMAGE_LAYOUT);
53: final double low = param.getDoubleParameter(0);
54: final double high = param.getDoubleParameter(1);
55: final double padValue = param.getDoubleParameter(2);
56: return new Hysteresis(image, layout, hints, low, high, padValue);
57: }
58: }
|