01: /*
02: * $RCSfile: PeriodicShiftCRIF.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:40 $
10: * $State: Exp $
11: */
12: package com.sun.media.jai.opimage;
13:
14: import java.awt.RenderingHints;
15: import java.awt.geom.Rectangle2D;
16: import java.awt.geom.AffineTransform;
17: import java.awt.image.RenderedImage;
18: import java.awt.image.renderable.ParameterBlock;
19: import java.awt.image.renderable.RenderableImage;
20: import java.awt.image.renderable.RenderableImageOp;
21: import java.awt.image.renderable.RenderContext;
22: import java.awt.image.renderable.RenderedImageFactory;
23: import javax.media.jai.CRIFImpl;
24: import javax.media.jai.ImageLayout;
25: import javax.media.jai.Interpolation;
26: import javax.media.jai.InterpolationNearest;
27: import javax.media.jai.InterpolationBilinear;
28: import javax.media.jai.InterpolationBicubic;
29: import java.util.Map;
30:
31: /**
32: * This image factory supports image operator <code>PeriodicShiftOpImage</code>
33: * in the rendered and renderable image layers.
34: *
35: * @see PeriodicShiftOpImage
36: */
37: public class PeriodicShiftCRIF extends CRIFImpl {
38:
39: /** Constructor. */
40: public PeriodicShiftCRIF() {
41: super ("periodicshift");
42: }
43:
44: /**
45: * Creates a new instance of <code>PeriodicShiftOpImage</code>
46: * in the rendered layer. This method satisfies the
47: * implementation of RIF.
48: */
49: public RenderedImage create(ParameterBlock paramBlock,
50: RenderingHints renderHints) {
51: // Get ImageLayout from renderHints if any.
52: ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
53:
54: // Get the source image.
55: RenderedImage source = paramBlock.getRenderedSource(0);
56:
57: // Get the translation parameters.
58: int shiftX = paramBlock.getIntParameter(0);
59: int shiftY = paramBlock.getIntParameter(1);
60:
61: // Return the OpImage.
62: return new PeriodicShiftOpImage(source, renderHints, layout,
63: shiftX, shiftY);
64: }
65: }
|