01: /*
02: * $RCSfile: OrderedDitherRIF.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:39 $
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.ColorCube;
19: import javax.media.jai.ImageLayout;
20: import javax.media.jai.KernelJAI;
21: import java.util.Map;
22:
23: /**
24: * A <code>RIF</code> supporting the "OrderedDither" operation in the rendered
25: * image layer.
26: *
27: * @since EA3
28: * @see javax.media.jai.operator.OrderedDitherDescriptor
29: *
30: */
31: public class OrderedDitherRIF implements RenderedImageFactory {
32:
33: /** Constructor. */
34: public OrderedDitherRIF() {
35: }
36:
37: /**
38: * Creates a new instance of an ordered dither operator according to the
39: * color map and dither mask kernel array.
40: *
41: * @param paramBlock The color map and dither mask kernel array objects.
42: */
43: public RenderedImage create(ParameterBlock paramBlock,
44: RenderingHints renderHints) {
45: // Get ImageLayout from renderHints if any.
46: ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
47:
48: RenderedImage source = paramBlock.getRenderedSource(0);
49: ColorCube colorMap = (ColorCube) paramBlock
50: .getObjectParameter(0);
51: KernelJAI[] ditherMask = (KernelJAI[]) paramBlock
52: .getObjectParameter(1);
53:
54: return new OrderedDitherOpImage(source, renderHints, layout,
55: colorMap, ditherMask);
56: }
57: }
|