01: /*
02: * $RCSfile: LookupCRIF.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:30 $
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 javax.media.jai.CRIFImpl;
18: import javax.media.jai.ImageLayout;
19: import java.util.Map;
20: import javax.media.jai.LookupTableJAI;
21:
22: /**
23: * A <code>CRIF</code> supporting the "Lookup" operation in the
24: * rendered and renderable image layers.
25: *
26: * <p>Although Lookup is supported in the renderable layer, it is necessary
27: * to understand that in some situations the operator may not produce smooth
28: * results. This is due to an affine transform being performed on the source
29: * image, which combined with certain types of table data will produce
30: * random/unexpected destination values. In addition, a lookup operation
31: * with the same input source and table in the renderable chain will yield
32: * to different destination from different rendering.
33: *
34: * @see javax.media.jai.operator.LookupDescriptor
35: * @see LookupOpImage
36: *
37: */
38: public class LookupCRIF extends CRIFImpl {
39:
40: /** Constructor. */
41: public LookupCRIF() {
42: super ("lookup");
43: }
44:
45: /**
46: * Creates a new instance of <code>LookupOpImage</code>
47: * in the rendered layer.
48: *
49: * @param args The source image and the lookup table.
50: * @param hints Optionally contains destination image layout.
51: */
52: public RenderedImage create(ParameterBlock args,
53: RenderingHints renderHints) {
54: // Get ImageLayout from renderHints if any.
55: ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
56:
57: return new LookupOpImage(args.getRenderedSource(0),
58: renderHints, layout, (LookupTableJAI) args
59: .getObjectParameter(0));
60: }
61: }
|