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


001:        /*
002:         * $RCSfile: MlibWarpRIF.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:09 $
010:         * $State: Exp $
011:         */
012:        package com.sun.media.jai.mlib;
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.RenderedImageFactory;
018:        import javax.media.jai.BorderExtender;
019:        import javax.media.jai.ImageLayout;
020:        import javax.media.jai.Interpolation;
021:        import javax.media.jai.InterpolationNearest;
022:        import javax.media.jai.InterpolationBilinear;
023:        import javax.media.jai.InterpolationBicubic;
024:        import javax.media.jai.InterpolationBicubic2;
025:        import javax.media.jai.InterpolationTable;
026:        import java.util.Map;
027:        import javax.media.jai.Warp;
028:        import javax.media.jai.WarpGrid;
029:        import javax.media.jai.WarpPolynomial;
030:        import com.sun.media.jai.opimage.RIFUtil;
031:
032:        import com.sun.medialib.mlib.*;
033:
034:        /**
035:         * A <code>RIF</code> supporting the "Warp" operation in the
036:         * rendered image mode using MediaLib.
037:         *
038:         * @see javax.media.jai.operator.WarpDescriptor
039:         * @see MlibWarpNearestOpImage
040:         * @see MlibWarpBilinearOpImage
041:         * @see MlibWarpBicubicOpImage
042:         *
043:         * @since 1.0
044:         *
045:         */
046:        public class MlibWarpRIF implements  RenderedImageFactory {
047:
048:            /** Constructor. */
049:            public MlibWarpRIF() {
050:            }
051:
052:            /**
053:             * Creates a new instance of <code>MlibWarpOpImage</code> in
054:             * the rendered image mode.
055:             *
056:             * @param args  The source images.
057:             * @param hints  May contain rendering hints and destination image layout.
058:             */
059:            public RenderedImage create(ParameterBlock args,
060:                    RenderingHints hints) {
061:                /* Get ImageLayout and TileCache from RenderingHints. */
062:                ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
063:
064:                RenderedImage source = args.getRenderedSource(0);
065:
066:                if (!MediaLibAccessor.isMediaLibCompatible(args, layout)
067:                        || !MediaLibAccessor.hasSameNumBands(args, layout)
068:                        ||
069:                        // Medialib cannot deal with source image having tiles with any
070:                        // dimension greater than or equal to 32768
071:                        source.getTileWidth() >= 32768
072:                        || source.getTileHeight() >= 32768) {
073:                    return null;
074:                }
075:
076:                /* Get BorderExtender from hints if any. */
077:                BorderExtender extender = RIFUtil.getBorderExtenderHint(hints);
078:
079:                Warp warp = (Warp) args.getObjectParameter(0);
080:                Interpolation interp = (Interpolation) args
081:                        .getObjectParameter(1);
082:                double[] backgroundValues = (double[]) args
083:                        .getObjectParameter(2);
084:
085:                int filter = -1;
086:                if (interp instanceof  InterpolationNearest) {
087:                    filter = Constants.MLIB_NEAREST;
088:                } else if (interp instanceof  InterpolationBilinear) {
089:                    filter = Constants.MLIB_BILINEAR;
090:                } else if (interp instanceof  InterpolationBicubic) {
091:                    filter = Constants.MLIB_BICUBIC;
092:                } else if (interp instanceof  InterpolationBicubic2) {
093:                    filter = Constants.MLIB_BICUBIC2;
094:                } else if (interp instanceof  InterpolationTable) {
095:                    ;
096:                    // filter =  Constants.MLIB_TABLE; not defined yet;
097:                } else {
098:                    /* Other kinds of interpolation cannot be handled via mlib. */
099:                    return null;
100:                }
101:
102:                if (warp instanceof  WarpGrid) {
103:                    if (interp instanceof  InterpolationTable) {
104:                        return new MlibWarpGridTableOpImage(source, extender,
105:                                hints, layout, (WarpGrid) warp, interp,
106:                                backgroundValues);
107:                    } else {
108:                        return new MlibWarpGridOpImage(source, extender, hints,
109:                                layout, (WarpGrid) warp, interp, filter,
110:                                backgroundValues);
111:                    }
112:
113:                } else if (warp instanceof  WarpPolynomial) {
114:                    if (interp instanceof  InterpolationTable) {
115:                        return new MlibWarpPolynomialTableOpImage(source,
116:                                extender, hints, layout, (WarpPolynomial) warp,
117:                                interp, backgroundValues);
118:                    } else {
119:                        return new MlibWarpPolynomialOpImage(source, extender,
120:                                hints, layout, (WarpPolynomial) warp, interp,
121:                                filter, backgroundValues);
122:                    }
123:                } else {
124:                    return null;
125:                }
126:
127:            }
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.