Source Code Cross Referenced for ImageFunction3DDescriptor.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » ca » forklabs » media » jai » operator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » ca.forklabs.media.jai.operator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#) $Header: /cvs/jai-operators/src/main/ca/forklabs/media/jai/operator/ImageFunction3DDescriptor.java,v 1.2 2007/07/17 16:29:00 forklabs Exp $
003:         *
004:         * Copyright (C) 2007  Forklabs Daniel Léonard
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         */
020:
021:        package ca.forklabs.media.jai.operator;
022:
023:        import java.awt.RenderingHints;
024:        import java.awt.image.RenderedImage;
025:        import java.util.Collection;
026:        import javax.media.jai.JAI;
027:        import javax.media.jai.OperationDescriptor;
028:        import javax.media.jai.OperationDescriptorImpl;
029:        import javax.media.jai.ParameterBlockJAI;
030:        import javax.media.jai.registry.CollectionRegistryMode;
031:        import javax.media.jai.util.Range;
032:        import ca.forklabs.media.jai.ImageFunction3D;
033:
034:        /**
035:         * Class {@code ImageFunction3DDescriptor} is an {@link OperationDescriptor}
036:         * describing the <em>imagefunction</em> operation for the collection mode.
037:         * This operation generates a collection of images based on a
038:         * {@link ImageFunction3D}.
039:         * <p>
040:         * The <em>imagefunction</em> operation takes two parameters, the image
041:         * function and the dimensions.
042:         * <p>
043:         * The default data type is {@link DataBuffer#TYPE_FLOAT}. The other acceptable
044:         * data type is {@link DataBuffer#TYPE_DOUBLE} and must be specified in a
045:         * {@link SampleModel} inside the {@link RenderingHints} (key is
046:         * {@link JAI#KEY_IMAGE_LAYOUT}).
047:         *
048:         * <table border=1>
049:         * <caption>Resource List</caption>
050:         * <tr><th>Name</th>        <th>Value</th></tr>
051:         * <tr><td>GlobalName</td>  <td>ImageFunction3D</td></tr>
052:         * <tr><td>LocalName</td>   <td>ImageFunction3D</td></tr>
053:         * <tr><td>Vendor</td>      <td>ca.forklabs.media.jai.opimage</td></tr>
054:         * <tr><td>Description</td> <td>Generates a collection of images from a functional description</td></tr>
055:         * <tr><td>DocURL</td>      <td>n/a</td></tr>
056:         * <tr><td>Version</td>     <td>$Version$</td></tr>
057:         * <tr><td>Arg0Desct</td>   <td>The functional description</td></tr>
058:         * <tr><td>Arg0Desct</td>   <td>The width of the image</td></tr>
059:         * <tr><td>Arg0Desct</td>   <td>The height of the image</td></tr>
060:         * <tr><td>Arg0Desct</td>   <td>The depth of the image</td></tr>
061:         * </table>
062:         *
063:         * <table border=1>
064:         * <caption>Parameter List</caption>
065:         * <tr><th>Name</th>       <th>Class Type</th>                <th>Default Value</th></tr>
066:         * <tr><td>function</td>   <td>{@link ImageFunction3D}</td>   <td>NO_PARAMETER_DEFAULT</td>
067:         * <tr><td>width</td>      <td>{@link Integer}</td>           <td>NO_PARAMETER_DEFAULT</td>
068:         * <tr><td>height</td>     <td>{@link Integer}</td>           <td>NO_PARAMETER_DEFAULT</td>
069:         * <tr><td>depth</td>      <td>{@link Integer}</td>           <td>NO_PARAMETER_DEFAULT</td>
070:         * </table>
071:         *
072:         * @author   <a href="mailto:forklabs at dev.java.net?subject=ca.forklabs.media.jai.operator.ImageFunction3DDescriptor">Daniel Léonard</a>
073:         * @version $Revision: 1.2 $
074:         */
075:        public class ImageFunction3DDescriptor extends OperationDescriptorImpl {
076:
077:            //---------------------------
078:            // Class variables
079:            //---------------------------
080:
081:            /** <em>serialVersionUID</em>. */
082:            private static final long serialVersionUID = -2567683936057065923L;
083:
084:            /** The name of this operator. */
085:            @SuppressWarnings("nls")
086:            public static final String NAME = "ImageFunction";
087:
088:            /** The name of the function parameter. */
089:            @SuppressWarnings("nls")
090:            public static final String FUNCTION_PARAMETER_NAME = "function";
091:            /** The name of the width parameter. */
092:            @SuppressWarnings("nls")
093:            public static final String WIDTH_PARAMETER_NAME = "width";
094:            /** The name of the height parameter. */
095:            @SuppressWarnings("nls")
096:            public static final String HEIGHT_PARAMETER_NAME = "height";
097:            /** The name of the depth parameter. */
098:            @SuppressWarnings("nls")
099:            public static final String DEPTH_PARAMETER_NAME = "depth";
100:
101:            /** The index in the parameter block of the function parameter. */
102:            public static final int FUNCTION_PARAMETER_INDEX = 0;
103:            /** The index in the parameter block of the width parameter. */
104:            public static final int WIDTH_PARAMETER_INDEX = 1;
105:            /** The index in the parameter block of the height parameter. */
106:            public static final int HEIGHT_PARAMETER_INDEX = 2;
107:            /** The index in the parameter block of the depth parameter. */
108:            public static final int DEPTH_PARAMETER_INDEX = 3;
109:
110:            /** The function default value. */
111:            public static final Object FUNCTION_DEFAULT_VALUE = OperationDescriptor.NO_PARAMETER_DEFAULT;
112:            /** The width default value. */
113:            public static final Object WIDTH_DEFAULT_VALUE = OperationDescriptor.NO_PARAMETER_DEFAULT;
114:            /** The height default value. */
115:            public static final Object HEIGHT_DEFAULT_VALUE = OperationDescriptor.NO_PARAMETER_DEFAULT;
116:            /** The depth default value. */
117:            public static final Object DEPTH_DEFAULT_VALUE = OperationDescriptor.NO_PARAMETER_DEFAULT;
118:
119:            /** The function default value. */
120:            public static final Object FUNCTION_VALID_VALUE = null;
121:            /** The width default value. */
122:            public static final Object WIDTH_VALID_VALUE = new Range(
123:                    Integer.class, Integer.valueOf(1), Integer
124:                            .valueOf(Integer.MAX_VALUE));
125:            /** The height default value. */
126:            public static final Object HEIGHT_VALID_VALUE = new Range(
127:                    Integer.class, Integer.valueOf(1), Integer
128:                            .valueOf(Integer.MAX_VALUE));
129:            /** The depth default value. */
130:            public static final Object DEPTH_VALID_VALUE = new Range(
131:                    Integer.class, Integer.valueOf(1), Integer
132:                            .valueOf(Integer.MAX_VALUE));
133:
134:            /**
135:             * The resource strings that provide the general documentation and specify
136:             * the parameter list for this operation.
137:             */
138:            @SuppressWarnings("nls")
139:            private static final String[][] RESOURCES = {
140:                    { "GlobalName", ImageFunction3DDescriptor.NAME, },
141:                    { "LocalName", ImageFunction3DDescriptor.NAME, },
142:                    { "Vendor", "ca.forklabs.media.jai.opimage", },
143:                    { "Description",
144:                            ImageFunction3DDescriptor.getDescription(), },
145:                    { "DocURL", "n/a", },
146:                    { "Version", "$Version$", },
147:                    { "arg0Desc",
148:                            ImageFunction3DDescriptor.getArg0Description(), },
149:                    { "arg1Desc",
150:                            ImageFunction3DDescriptor.getArg1Description(), },
151:                    { "arg2Desc",
152:                            ImageFunction3DDescriptor.getArg2Description(), },
153:                    { "arg3Desc",
154:                            ImageFunction3DDescriptor.getArg3Description(), }, };
155:
156:            /** The supported modes. */
157:            private static final String[] SUPPORTED_MODES = { CollectionRegistryMode.MODE_NAME, };
158:
159:            /** The parameter class list for this operation. */
160:            private static final Class<?>[] PARAMETER_CLASSES = {
161:                    ImageFunction3D.class, Integer.class, Integer.class,
162:                    Integer.class, };
163:
164:            /** The parameter name list for this operation. */
165:            private static final String[] PARAMETER_NAMES = {
166:                    ImageFunction3DDescriptor.FUNCTION_PARAMETER_NAME,
167:                    ImageFunction3DDescriptor.WIDTH_PARAMETER_NAME,
168:                    ImageFunction3DDescriptor.HEIGHT_PARAMETER_NAME,
169:                    ImageFunction3DDescriptor.DEPTH_PARAMETER_NAME, };
170:
171:            /** The default parameters. */
172:            private static final Object[] PARAMETER_DEFAULTS = new Object[] {
173:                    ImageFunction3DDescriptor.FUNCTION_DEFAULT_VALUE,
174:                    ImageFunction3DDescriptor.WIDTH_DEFAULT_VALUE,
175:                    ImageFunction3DDescriptor.HEIGHT_DEFAULT_VALUE,
176:                    ImageFunction3DDescriptor.DEPTH_DEFAULT_VALUE, };
177:
178:            /** Valid parameter values. */
179:            private static final Object[] VALID_PARAMETERS = new Object[] {
180:                    ImageFunction3DDescriptor.FUNCTION_VALID_VALUE,
181:                    ImageFunction3DDescriptor.WIDTH_VALID_VALUE,
182:                    ImageFunction3DDescriptor.HEIGHT_VALID_VALUE,
183:                    ImageFunction3DDescriptor.DEPTH_VALID_VALUE, };
184:
185:            //---------------------------
186:            // Constructor
187:            //---------------------------
188:
189:            /**
190:             * Constructor.
191:             */
192:            public ImageFunction3DDescriptor() {
193:                super (RESOURCES, SUPPORTED_MODES, 0, PARAMETER_NAMES,
194:                        PARAMETER_CLASSES, PARAMETER_DEFAULTS, VALID_PARAMETERS);
195:            }
196:
197:            //---------------------------
198:            // Class methods
199:            //---------------------------
200:
201:            /**
202:             * Creates and fills a new parameter block for the collection mode.
203:             * @param   function   the functional description.
204:             * @param   width   the width of the image.
205:             * @param   height   the height of the image.
206:             * @param   depth   the depth of the image.
207:             * @return   a new parameter block.
208:             */
209:            public static ParameterBlockJAI createParameterBlock(
210:                    ImageFunction3D function, int width, int height, int depth) {
211:                String name = ImageFunction3DDescriptor.NAME;
212:                String mode = CollectionRegistryMode.MODE_NAME;
213:                ParameterBlockJAI pb = new ParameterBlockJAI(name, mode);
214:                pb.setParameter(
215:                        ImageFunction3DDescriptor.FUNCTION_PARAMETER_NAME,
216:                        function);
217:                pb.setParameter(ImageFunction3DDescriptor.WIDTH_PARAMETER_NAME,
218:                        width);
219:                pb
220:                        .setParameter(
221:                                ImageFunction3DDescriptor.HEIGHT_PARAMETER_NAME,
222:                                height);
223:                pb.setParameter(ImageFunction3DDescriptor.DEPTH_PARAMETER_NAME,
224:                        depth);
225:                return pb;
226:            }
227:
228:            /**
229:             * Performs the <em>imagefunction3d</em> operation on with the given
230:             * functional description.
231:             * @param   function   the functional description.
232:             * @param   width   the width of the image.
233:             * @param   height   the height of the image.
234:             * @param   depth   the depth of the image.
235:             * @param   hints    the rendering hints, may be {@code null}.
236:             * @return   the rendered result image.
237:             */
238:            @SuppressWarnings("unchecked")
239:            public static Collection<RenderedImage> createCollection(
240:                    ImageFunction3D function, int width, int height, int depth,
241:                    RenderingHints hints) {
242:                String name = ImageFunction3DDescriptor.NAME;
243:                ParameterBlockJAI pb = ImageFunction3DDescriptor
244:                        .createParameterBlock(function, width, height, depth);
245:                Collection<RenderedImage> sinks = JAI.createCollection(name,
246:                        pb, hints);
247:                return sinks;
248:            }
249:
250:            //---------------------------
251:            // External resources methods
252:            //---------------------------
253:
254:            /**
255:             * Gets the description of this operation.
256:             * @return   the description message.
257:             */
258:            protected static String getDescription() {
259:                String key = Resources.IMAGE_FUNCTION_3D_DESCRIPTION;
260:                String message = Resources.getLocalizedString(key);
261:                return message;
262:            }
263:
264:            /**
265:             * Gets the description for the first argument, the function.
266:             * @return   the description message.
267:             */
268:            protected static String getArg0Description() {
269:                String key = Resources.IMAGE_FUNCTION_3D_ARG0_DESCRIPTION;
270:                String message = Resources.getLocalizedString(key);
271:                return message;
272:            }
273:
274:            /**
275:             * Gets the description for the second argument, the width.
276:             * @return   the description message.
277:             */
278:            protected static String getArg1Description() {
279:                String key = Resources.IMAGE_FUNCTION_3D_ARG1_DESCRIPTION;
280:                String message = Resources.getLocalizedString(key);
281:                return message;
282:            }
283:
284:            /**
285:             * Gets the description for the third argument, the height.
286:             * @return   the description message.
287:             */
288:            protected static String getArg2Description() {
289:                String key = Resources.IMAGE_FUNCTION_3D_ARG2_DESCRIPTION;
290:                String message = Resources.getLocalizedString(key);
291:                return message;
292:            }
293:
294:            /**
295:             * Gets the description for the fourth argument, the depth.
296:             * @return   the description message.
297:             */
298:            protected static String getArg3Description() {
299:                String key = Resources.IMAGE_FUNCTION_3D_ARG3_DESCRIPTION;
300:                String message = Resources.getLocalizedString(key);
301:                return message;
302:            }
303:
304:        }
305:
306:        /*
307:         * $Log: ImageFunction3DDescriptor.java,v $
308:         * Revision 1.2  2007/07/17 16:29:00  forklabs
309:         * Operation renamed from imagefunction3d to imagefunction.
310:         *
311:         * Revision 1.1  2007/07/05 18:30:38  forklabs
312:         * Operator imagefunction3d.
313:         *
314:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.