KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > image > renderable > ContextualRenderedImageFactory


1 /*
2  * @(#)ContextualRenderedImageFactory.java 1.11 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 /* ********************************************************************
9  **********************************************************************
10  **********************************************************************
11  *** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
12  *** As an unpublished work pursuant to Title 17 of the United ***
13  *** States Code. All rights reserved. ***
14  **********************************************************************
15  **********************************************************************
16  **********************************************************************/

17
18 package java.awt.image.renderable;
19 import java.awt.geom.Rectangle2D JavaDoc;
20 import java.awt.image.RenderedImage JavaDoc;
21
22 /**
23  * ContextualRenderedImageFactory provides an interface for the
24  * functionality that may differ between instances of
25  * RenderableImageOp. Thus different operations on RenderableImages
26  * may be performed by a single class such as RenderedImageOp through
27  * the use of multiple instances of ContextualRenderedImageFactory.
28  * The name ContextualRenderedImageFactory is commonly shortened to
29  * "CRIF."
30  *
31  * <p> All operations that are to be used in a rendering-independent
32  * chain must implement ContextualRenderedImageFactory.
33  *
34  * <p> Classes that implement this interface must provide a
35  * constructor with no arguments.
36  */

37 public interface ContextualRenderedImageFactory extends RenderedImageFactory JavaDoc {
38  
39     /**
40      * Maps the operation's output RenderContext into a RenderContext
41      * for each of the operation's sources. This is useful for
42      * operations that can be expressed in whole or in part simply as
43      * alterations in the RenderContext, such as an affine mapping, or
44      * operations that wish to obtain lower quality renderings of
45      * their sources in order to save processing effort or
46      * transmission bandwith. Some operations, such as blur, can also
47      * use this mechanism to avoid obtaining sources of higher quality
48      * than necessary.
49      *
50      * @param i the index of the source image.
51      * @param renderContext the RenderContext being applied to the operation.
52      * @param paramBlock a ParameterBlock containing the operation's
53      * sources and parameters.
54      * @param image the RenderableImage being rendered.
55      * @return a <code>RenderContext</code> for
56      * the source at the specified index of the parameters
57      * Vector contained in the specified ParameterBlock.
58      */

59     RenderContext JavaDoc mapRenderContext(int i,
60                                    RenderContext JavaDoc renderContext,
61                                    ParameterBlock JavaDoc paramBlock,
62                                    RenderableImage JavaDoc image);
63        
64     /**
65      * Creates a rendering, given a RenderContext and a ParameterBlock
66      * containing the operation's sources and parameters. The output
67      * is a RenderedImage that takes the RenderContext into account to
68      * determine its dimensions and placement on the image plane.
69      * This method houses the "intelligence" that allows a
70      * rendering-independent operation to adapt to a specific
71      * RenderContext.
72      *
73      * @param renderContext The RenderContext specifying the rendering
74      * @param paramBlock a ParameterBlock containing the operation's
75      * sources and parameters
76      * @return a <code>RenderedImage</code> from the sources and parameters
77      * in the specified ParameterBlock and according to the
78      * rendering instructions in the specified RenderContext.
79      */

80     RenderedImage JavaDoc create(RenderContext JavaDoc renderContext,
81                          ParameterBlock JavaDoc paramBlock);
82     
83     /**
84      * Returns the bounding box for the output of the operation,
85      * performed on a given set of sources, in rendering-independent
86      * space. The bounds are returned as a Rectangle2D, that is, an
87      * axis-aligned rectangle with floating-point corner coordinates.
88      *
89      * @param paramBlock a ParameterBlock containing the operation's
90      * sources and parameters.
91      * @return a Rectangle2D specifying the rendering-independent
92      * bounding box of the output.
93      */

94     Rectangle2D JavaDoc getBounds2D(ParameterBlock JavaDoc paramBlock);
95
96     /**
97      * Gets the appropriate instance of the property specified by the name
98      * parameter. This method must determine which instance of a property to
99      * return when there are multiple sources that each specify the property.
100      *
101      * @param paramBlock a ParameterBlock containing the operation's
102      * sources and parameters.
103      * @param name a String naming the desired property.
104      * @return an object reference to the value of the property requested.
105      */

106     Object JavaDoc getProperty(ParameterBlock JavaDoc paramBlock, String JavaDoc name);
107
108     /**
109      * Returns a list of names recognized by getProperty.
110      * @return the list of property names.
111      */

112     String JavaDoc[] getPropertyNames();
113
114     /**
115      * Returns true if successive renderings (that is, calls to
116      * create(RenderContext, ParameterBlock)) with the same arguments
117      * may produce different results. This method may be used to
118      * determine whether an existing rendering may be cached and
119      * reused. It is always safe to return true.
120      * @return <code>true</code> if successive renderings with the
121      * same arguments might produce different results;
122      * <code>false</code> otherwise.
123      */

124     boolean isDynamic();
125 }
126
Popular Tags