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