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


001:        /*
002:         * $RCSfile: CompositeCRIF.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:56:18 $
010:         * $State: Exp $
011:         */
012:        package com.sun.media.jai.opimage;
013:
014:        import java.awt.RenderingHints;
015:        import java.awt.image.RenderedImage;
016:        import java.awt.image.renderable.ParameterBlock;
017:        import java.awt.image.renderable.RenderableImage;
018:        import java.awt.image.renderable.RenderContext;
019:        import javax.media.jai.CRIFImpl;
020:        import javax.media.jai.EnumeratedParameter;
021:        import javax.media.jai.ImageLayout;
022:        import javax.media.jai.JAI;
023:        import java.util.Map;
024:        import javax.media.jai.operator.CompositeDescriptor;
025:
026:        /**
027:         * A <code>CRIF</code> supporting the "Composite" operation in the
028:         * rendered and renderable image modes.
029:         *
030:         * @see javax.media.jai.operator.CompositeDescriptor
031:         * @see CompositeOpImage
032:         * @see CompositeNoAlphaOpImage
033:         *
034:         */
035:        public class CompositeCRIF extends CRIFImpl {
036:
037:            /** Constructor. */
038:            public CompositeCRIF() {
039:                super ("composite");
040:            }
041:
042:            /**
043:             * Creates a new instance of <code>CompositeOpImage</code>
044:             * in the rendered layer. This method satisfies the
045:             * implementation of RIF.
046:             */
047:            public RenderedImage create(ParameterBlock args,
048:                    RenderingHints hints) {
049:                /* Get ImageLayout from RenderingHints if any. */
050:                ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
051:
052:                RenderedImage source1 = args.getRenderedSource(0);
053:                RenderedImage source2 = args.getRenderedSource(1);
054:
055:                RenderedImage alpha1 = (RenderedImage) args
056:                        .getObjectParameter(0);
057:                RenderedImage alpha2 = null;
058:                if (args.getObjectParameter(1) != null) {
059:                    alpha2 = (RenderedImage) args.getObjectParameter(1);
060:                }
061:
062:                boolean premultiplied = ((Boolean) args.getObjectParameter(2))
063:                        .booleanValue();
064:                EnumeratedParameter destAlpha = (EnumeratedParameter) args
065:                        .getObjectParameter(3);
066:
067:                if (destAlpha.equals(CompositeDescriptor.NO_DESTINATION_ALPHA)) {
068:                    return new CompositeNoDestAlphaOpImage(source1, source2,
069:                            hints, layout, alpha1, alpha2, premultiplied);
070:                } else {
071:                    return new CompositeOpImage(
072:                            source1,
073:                            source2,
074:                            hints,
075:                            layout,
076:                            alpha1,
077:                            alpha2,
078:                            premultiplied,
079:                            destAlpha
080:                                    .equals(CompositeDescriptor.DESTINATION_ALPHA_FIRST));
081:                }
082:            }
083:
084:            /**
085:             * Creates a <Code>RenderedImage</Code> from the renderable layer.
086:             *
087:             * @param renderContext The rendering information associated with
088:             *        this rendering.
089:             * @param paramBlock The parameters used to create the image.
090:             * @return A <code>RenderedImage</code>.
091:             */
092:            public RenderedImage create(RenderContext renderContext,
093:                    ParameterBlock paramBlock) {
094:
095:                // Get the two renderable alpha images from the parameter block
096:                RenderableImage alphaImage1 = (RenderableImage) paramBlock
097:                        .getObjectParameter(0);
098:                RenderableImage alphaImage2 = (RenderableImage) paramBlock
099:                        .getObjectParameter(1);
100:
101:                // Cause the two renderable alpha images to be rendered
102:                RenderedImage rAlphaImage1 = alphaImage1
103:                        .createRendering(renderContext);
104:                RenderedImage rAlphaImage2 = alphaImage2
105:                        .createRendering(renderContext);
106:
107:                ParameterBlock newPB = (ParameterBlock) paramBlock.clone();
108:
109:                // Replace the renderable alpha images in the ParameterBlock with
110:                // their renderings
111:                newPB.set(rAlphaImage1, 0);
112:                newPB.set(rAlphaImage2, 1);
113:
114:                // Return JAI.create("composite") 
115:                return JAI.create("composite", newPB, renderContext
116:                        .getRenderingHints());
117:            }
118:
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.