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


001:        /*
002:         * $RCSfile: RookIterFactory.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:27 $
010:         * $State: Exp $
011:         */
012:        package javax.media.jai.iterator;
013:
014:        import java.awt.Rectangle;
015:        import java.awt.image.ComponentSampleModel;
016:        import java.awt.image.DataBuffer;
017:        import java.awt.image.Raster;
018:        import java.awt.image.WritableRaster;
019:        import java.awt.image.RenderedImage;
020:        import java.awt.image.SampleModel;
021:        import java.awt.image.WritableRenderedImage; // import com.sun.media.jai.iterator.RookIterCSMByte;
022:        // import com.sun.media.jai.iterator.RookIterCSMShort;
023:        // import com.sun.media.jai.iterator.RookIterCSMUShort;
024:        // import com.sun.media.jai.iterator.RookIterCSMInt;
025:        // import com.sun.media.jai.iterator.RookIterCSMFloat;
026:        // import com.sun.media.jai.iterator.RookIterCSMDouble;
027:        import com.sun.media.jai.iterator.RookIterFallback;
028:        import com.sun.media.jai.iterator.WrapperRI;
029:        import com.sun.media.jai.iterator.WrapperWRI; // import com.sun.media.jai.iterator.WritableRookIterCSMByte;
030:        // import com.sun.media.jai.iterator.WritableRookIterCSMShort;
031:        // import com.sun.media.jai.iterator.WritableRookIterCSMUShort;
032:        // import com.sun.media.jai.iterator.WritableRookIterCSMInt;
033:        // import com.sun.media.jai.iterator.WritableRookIterCSMFloat;
034:        // import com.sun.media.jai.iterator.WritableRookIterCSMDouble;
035:        import com.sun.media.jai.iterator.WritableRookIterFallback;
036:
037:        /**
038:         * A factory class to instantiate instances of the RookIter and
039:         * WritableRookIter interfaces on sources of type Raster,
040:         * RenderedImage, and WritableRenderedImage.
041:         *
042:         * @see RookIter
043:         * @see WritableRookIter
044:         */
045:        public class RookIterFactory {
046:
047:            /** Prevent this class from ever being instantiated. */
048:            private RookIterFactory() {
049:            }
050:
051:            /**
052:             * Constructs and returns an instance of RookIter suitable
053:             * for iterating over the given bounding rectangle within the
054:             * given RenderedImage source.  If the bounds parameter is null,
055:             * the entire image will be used.
056:             *
057:             * @param im a read-only RenderedImage source.
058:             * @param bounds the bounding Rectangle for the iterator, or null.
059:             * @return a RookIter allowing read-only access to the source.
060:             */
061:            public static RookIter create(RenderedImage im, Rectangle bounds) {
062:                if (bounds == null) {
063:                    bounds = new Rectangle(im.getMinX(), im.getMinY(), im
064:                            .getWidth(), im.getHeight());
065:                }
066:
067:                SampleModel sm = im.getSampleModel();
068:                if (sm instanceof  ComponentSampleModel) {
069:                    switch (sm.getDataType()) {
070:                    case DataBuffer.TYPE_BYTE:
071:                        // return new RookIterCSMByte(im, bounds);
072:                    case DataBuffer.TYPE_SHORT:
073:                        // return new RookIterCSMShort(im, bounds);
074:                    case DataBuffer.TYPE_USHORT:
075:                        // return new RookIterCSMUShort(im, bounds);
076:                    case DataBuffer.TYPE_INT:
077:                        // return new RookIterCSMInt(im, bounds);
078:                    case DataBuffer.TYPE_FLOAT:
079:                        // return new RookIterCSMFloat(im, bounds);
080:                    case DataBuffer.TYPE_DOUBLE:
081:                        // return new RookIterCSMDouble(im, bounds);
082:                    }
083:                }
084:
085:                return new RookIterFallback(im, bounds);
086:            }
087:
088:            /**
089:             * Constructs and returns an instance of RookIter suitable
090:             * for iterating over the given bounding rectangle within the
091:             * given Raster source.  If the bounds parameter is null,
092:             * the entire Raster will be used.
093:             *
094:             * @param ras a read-only Raster source.
095:             * @param bounds the bounding Rectangle for the iterator, or null.
096:             * @return a RookIter allowing read-only access to the source.
097:             */
098:            public static RookIter create(Raster ras, Rectangle bounds) {
099:                RenderedImage im = new WrapperRI(ras);
100:                return create(im, bounds);
101:            }
102:
103:            /**
104:             * Constructs and returns an instance of WritableRookIter suitable for
105:             * iterating over the given bounding rectangle within the given
106:             * WritableRenderedImage source.  If the bounds parameter is null,
107:             * the entire image will be used.
108:             *
109:             * @param im a WritableRenderedImage source.
110:             * @param bounds the bounding Rectangle for the iterator, or null.
111:             * @return a WritableRookIter allowing read/write access to the source.
112:             */
113:            public static WritableRookIter createWritable(
114:                    WritableRenderedImage im, Rectangle bounds) {
115:                if (bounds == null) {
116:                    bounds = new Rectangle(im.getMinX(), im.getMinY(), im
117:                            .getWidth(), im.getHeight());
118:                }
119:
120:                SampleModel sm = im.getSampleModel();
121:                if (sm instanceof  ComponentSampleModel) {
122:                    switch (sm.getDataType()) {
123:                    case DataBuffer.TYPE_BYTE:
124:                        // return new WritableRookIterCSMByte(im, bounds);
125:                    case DataBuffer.TYPE_SHORT:
126:                        // return new WritableRookIterCSMShort(im, bounds);
127:                    case DataBuffer.TYPE_USHORT:
128:                        // return new WritableRookIterCSMUShort(im, bounds);
129:                    case DataBuffer.TYPE_INT:
130:                        // return new WritableRookIterCSMInt(im, bounds);
131:                    case DataBuffer.TYPE_FLOAT:
132:                        // return new WritableRookIterCSMFloat(im, bounds);
133:                    case DataBuffer.TYPE_DOUBLE:
134:                        // return new WritableRookIterCSMDouble(im, bounds);
135:                    }
136:                }
137:
138:                return new WritableRookIterFallback(im, bounds);
139:            }
140:
141:            /**
142:             * Constructs and returns an instance of WritableRookIter suitable for
143:             * iterating over the given bounding rectangle within the given
144:             * WritableRaster source.  If the bounds parameter is null,
145:             * the entire Raster will be used.
146:             *
147:             * @param ras a WritableRaster source.
148:             * @param bounds the bounding Rectangle for the iterator, or null.
149:             * @return a WritableRookIter allowing read/write access to the source.
150:             */
151:            public static WritableRookIter createWritable(WritableRaster ras,
152:                    Rectangle bounds) {
153:                WritableRenderedImage im = new WrapperWRI(ras);
154:                return createWritable(im, bounds);
155:            }
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.