01: /*
02: * $RCSfile: MeanRIF.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:56:33 $
10: * $State: Exp $
11: */
12: package com.sun.media.jai.opimage;
13:
14: import java.awt.RenderingHints;
15: import java.awt.image.RenderedImage;
16: import java.awt.image.renderable.ParameterBlock;
17: import java.awt.image.renderable.RenderedImageFactory;
18: import javax.media.jai.ROI;
19:
20: /**
21: * A <code>RIF</code> supporting the "Mean" operation in the
22: * rendered image layer.
23: *
24: * @since EA2
25: * @see javax.media.jai.operator.MeanDescriptor
26: *
27: */
28: public class MeanRIF implements RenderedImageFactory {
29:
30: /** Constructor. */
31: public MeanRIF() {
32: }
33:
34: /**
35: * Creates a new instance of <code>MeanOpImage</code>
36: * in the rendered layer. Any image layout information in
37: * <code>RenderingHints</code> is ignored.
38: * This method satisfies the implementation of RIF.
39: */
40: public RenderedImage create(ParameterBlock paramBlock,
41: RenderingHints renderHints) {
42: RenderedImage src = paramBlock.getRenderedSource(0);
43:
44: int xStart = src.getMinX(); // default values
45: int yStart = src.getMinY();
46:
47: int maxWidth = src.getWidth();
48: int maxHeight = src.getHeight();
49:
50: return new MeanOpImage(src, (ROI) paramBlock
51: .getObjectParameter(0), xStart, yStart, paramBlock
52: .getIntParameter(1), paramBlock.getIntParameter(2));
53: }
54: }
|