01: /*
02: * $RCSfile: MlibThresholdRIF.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:07 $
10: * $State: Exp $
11: */
12: package com.sun.media.jai.mlib;
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.ImageLayout;
19: import java.util.Map;
20: import com.sun.media.jai.opimage.RIFUtil;
21:
22: /**
23: * A <code>RIF</code> supporting the "Threshold" operation in the
24: * rendered image mode using MediaLib.
25: *
26: * @see javax.media.jai.operator.ThresholdDescriptor
27: * @see MlibThresholdOpImage
28: *
29: * @since 1.0
30: *
31: */
32: public class MlibThresholdRIF implements RenderedImageFactory {
33:
34: /** Constructor. */
35: public MlibThresholdRIF() {
36: }
37:
38: /**
39: * Creates a new instance of <code>MlibThresholdOpImage</code> in
40: * the rendered image mode.
41: *
42: * @param args The source image.
43: * @param hints May contain rendering hints and destination image layout.
44: */
45: public RenderedImage create(ParameterBlock args,
46: RenderingHints hints) {
47: /* Get ImageLayout and TileCache from RenderingHints. */
48: ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
49:
50: if (!MediaLibAccessor.isMediaLibCompatible(args, layout)
51: || !MediaLibAccessor.hasSameNumBands(args, layout)) {
52: return null;
53: }
54:
55: return new MlibThresholdOpImage(args.getRenderedSource(0),
56: hints, layout, (double[]) args.getObjectParameter(0),
57: (double[]) args.getObjectParameter(1), (double[]) args
58: .getObjectParameter(2));
59: }
60: }
|