Source Code Cross Referenced for MultiplyDescriptor.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » 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 » javax.media.jai.operator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: MultiplyDescriptor.java,v $
003:         *
004:         * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * Use is subject to license terms.
007:         *
008:         * $Revision: 1.1 $
009:         * $Date: 2005/02/11 04:57:41 $
010:         * $State: Exp $
011:         */
012:        package javax.media.jai.operator;
013:
014:        import java.awt.RenderingHints;
015:        import java.awt.image.RenderedImage;
016:        import java.awt.image.renderable.RenderableImage;
017:        import javax.media.jai.JAI;
018:        import javax.media.jai.OperationDescriptorImpl;
019:        import javax.media.jai.ParameterBlockJAI;
020:        import javax.media.jai.RenderableOp;
021:        import javax.media.jai.RenderedOp;
022:        import javax.media.jai.registry.RenderableRegistryMode;
023:        import javax.media.jai.registry.RenderedRegistryMode;
024:
025:        /**
026:         * An <code>OperationDescriptor</code> describing the "Multiply" operation.
027:         *
028:         * <p> The Multiply operation takes two rendered or renderable source
029:         * images,  and multiplies every pair of pixels, one from each source
030:         * image of the corresponding position and band. No additional
031:         * parameters are required.
032:         *
033:         * <p> The two source images may have different numbers of bands and
034:         * data types. By default, the destination image bounds are the
035:         * intersection of the two source image bounds.  If the sources don't
036:         * intersect, the destination will have a width and height of 0.
037:         *
038:         * <p> The default number of bands of the destination image is equal
039:         * to the smallest number of bands of the sources, and the data type
040:         * is the smallest data type with sufficient range to cover the range
041:         * of both source data types (not necessarily the range of their
042:         * sums).
043:         *
044:         * <p> As a special case, if one of the source images has N bands (N >
045:         * 1), the other source has 1 band, and an <code>ImageLayout</code>
046:         * hint is provided containing a destination <code>SampleModel</code>
047:         * with K bands (1 < K <= N), then the single band of the 1-banded
048:         * source is added to each of the first K bands of the N-band source.
049:         *
050:         * <p> If the result of the operation underflows/overflows the
051:         * minimum/maximum value supported by the destination data type, then
052:         * it will be clamped to the minimum/maximum value respectively.
053:         *
054:         * <p> The destination pixel values are defined by the pseudocode:
055:         * <pre>
056:         * dst[x][y][dstBand] = clamp(srcs[0][x][y][src0Band] *
057:         *                            srcs[1][x][y][src1Band]);
058:         * </pre>
059:         *
060:         * <p><table border=1>
061:         * <caption>Resource List</caption>
062:         * <tr><th>Name</th>        <th>Value</th></tr>
063:         * <tr><td>GlobalName</td>  <td>Multiply</td></tr>
064:         * <tr><td>LocalName</td>   <td>Multiply</td></tr>
065:         * <tr><td>Vendor</td>      <td>com.sun.media.jai</td></tr>
066:         * <tr><td>Description</td> <td>Multiplies two images.</td></tr>
067:         * <tr><td>DocURL</td>      <td>http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/MultiplyDescriptor.html</td></tr>
068:         * <tr><td>Version</td>     <td>1.0</td></tr>
069:         * </table></p>
070:         *
071:         * <p> No parameters are needed for this operation.
072:         *
073:         * @see javax.media.jai.OperationDescriptor
074:         */
075:        public class MultiplyDescriptor extends OperationDescriptorImpl {
076:
077:            /**
078:             * The resource strings that provide the general documentation
079:             * and specify the parameter list for this operation.
080:             */
081:            private static final String[][] resources = {
082:                    { "GlobalName", "Multiply" },
083:                    { "LocalName", "Multiply" },
084:                    { "Vendor", "com.sun.media.jai" },
085:                    { "Description", JaiI18N.getString("MultiplyDescriptor0") },
086:                    {
087:                            "DocURL",
088:                            "http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/MultiplyDescriptor.html" },
089:                    { "Version", JaiI18N.getString("DescriptorVersion") } };
090:
091:            /** Constructor. */
092:            public MultiplyDescriptor() {
093:                super (resources, 2, null, null, null);
094:            }
095:
096:            /** Returns <code>true</code> since renderable operation is supported. */
097:            public boolean isRenderableSupported() {
098:                return true;
099:            }
100:
101:            /**
102:             * Multiplies two images.
103:             *
104:             * <p>Creates a <code>ParameterBlockJAI</code> from all
105:             * supplied arguments except <code>hints</code> and invokes
106:             * {@link JAI#create(String,ParameterBlock,RenderingHints)}.
107:             *
108:             * @see JAI
109:             * @see ParameterBlockJAI
110:             * @see RenderedOp
111:             *
112:             * @param source0 <code>RenderedImage</code> source 0.
113:             * @param source1 <code>RenderedImage</code> source 1.
114:             * @param hints The <code>RenderingHints</code> to use.
115:             * May be <code>null</code>.
116:             * @return The <code>RenderedOp</code> destination.
117:             * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
118:             * @throws IllegalArgumentException if <code>source1</code> is <code>null</code>.
119:             */
120:            public static RenderedOp create(RenderedImage source0,
121:                    RenderedImage source1, RenderingHints hints) {
122:                ParameterBlockJAI pb = new ParameterBlockJAI("Multiply",
123:                        RenderedRegistryMode.MODE_NAME);
124:
125:                pb.setSource("source0", source0);
126:                pb.setSource("source1", source1);
127:
128:                return JAI.create("Multiply", pb, hints);
129:            }
130:
131:            /**
132:             * Multiplies two images.
133:             *
134:             * <p>Creates a <code>ParameterBlockJAI</code> from all
135:             * supplied arguments except <code>hints</code> and invokes
136:             * {@link JAI#createRenderable(String,ParameterBlock,RenderingHints)}.
137:             *
138:             * @see JAI
139:             * @see ParameterBlockJAI
140:             * @see RenderableOp
141:             *
142:             * @param source0 <code>RenderableImage</code> source 0.
143:             * @param source1 <code>RenderableImage</code> source 1.
144:             * @param hints The <code>RenderingHints</code> to use.
145:             * May be <code>null</code>.
146:             * @return The <code>RenderableOp</code> destination.
147:             * @throws IllegalArgumentException if <code>source0</code> is <code>null</code>.
148:             * @throws IllegalArgumentException if <code>source1</code> is <code>null</code>.
149:             */
150:            public static RenderableOp createRenderable(
151:                    RenderableImage source0, RenderableImage source1,
152:                    RenderingHints hints) {
153:                ParameterBlockJAI pb = new ParameterBlockJAI("Multiply",
154:                        RenderableRegistryMode.MODE_NAME);
155:
156:                pb.setSource("source0", source0);
157:                pb.setSource("source1", source1);
158:
159:                return JAI.createRenderable("Multiply", pb, hints);
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.