01: /*
02: * $RCSfile: GradientRIF.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:27 $
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.BorderExtender;
19: import javax.media.jai.ImageLayout;
20: import javax.media.jai.JAI;
21: import javax.media.jai.KernelJAI;
22: import java.awt.image.SampleModel;
23: import java.awt.image.DataBuffer;
24: import java.util.Map;
25:
26: /**
27: * @see GradientOpImage
28: */
29: public class GradientRIF implements RenderedImageFactory {
30:
31: /** Constructor. */
32: public GradientRIF() {
33: }
34:
35: /**
36: * Create a new instance of GradientOpImage in the rendered layer.
37: * This method satisfies the implementation of RIF.
38: *
39: * @param paramBlock The source image and the gradient's
40: * horizontal kernel & vertical kernel.
41: */
42: public RenderedImage create(ParameterBlock paramBlock,
43: RenderingHints renderHints) {
44: // Get ImageLayout from renderHints if any.
45: ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
46:
47: // Get BorderExtender from renderHints if any.
48: BorderExtender extender = RIFUtil
49: .getBorderExtenderHint(renderHints);
50:
51: RenderedImage source = paramBlock.getRenderedSource(0);
52:
53: // Get the Horizontal & Vertical kernels
54: KernelJAI kern_h = (KernelJAI) paramBlock.getObjectParameter(0);
55: KernelJAI kern_v = (KernelJAI) paramBlock.getObjectParameter(1);
56:
57: return new GradientOpImage(source, extender, renderHints,
58: layout, kern_h, kern_v);
59: }
60: }
|