Source Code Cross Referenced for MlibScaleOpImage.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) 


01:        /*
02:         * $RCSfile: MlibScaleOpImage.java,v $
03:         *
04:         * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05:         *
06:         * Use is subject to license terms.
07:         *
08:         * $Revision: 1.1 $
09:         * $Date: 2005/02/11 04:56:04 $
10:         * $State: Exp $
11:         */
12:        package com.sun.media.jai.mlib;
13:
14:        import java.awt.Rectangle;
15:        import java.awt.image.RenderedImage;
16:        import javax.media.jai.BorderExtender;
17:        import javax.media.jai.ImageLayout;
18:        import javax.media.jai.Interpolation;
19:        import javax.media.jai.ScaleOpImage;
20:        import java.util.Map;
21:
22:        /**
23:         * MlibScaleOpImage extends ScaleOpImage for use by further extension
24:         * classes.
25:         *
26:         * @see ScaleOpImage
27:         *
28:         */
29:        abstract class MlibScaleOpImage extends ScaleOpImage {
30:
31:            /**
32:             * Constructs a MlibScaleOpImage from a RenderedImage source,
33:             * Interpolation object, x and y scale values.  The image
34:             * dimensions are determined by forward-mapping the source bounds.
35:             * The tile grid layout, SampleModel, and ColorModel are specified
36:             * by the image source, possibly overridden by values from the
37:             * ImageLayout parameter.
38:             * 
39:             * @param source a RenderedImage.
40:             * @param extender a BorderExtender, or null.
41:
42:             *        or null.  If null, a default cache will be used.
43:             * @param layout an ImageLayout optionally containing the tile grid layout,
44:             *        SampleModel, and ColorModel, or null.
45:             * @param scaleX scale factor along x axis.
46:             * @param scaleY scale factor along y axis.
47:             * @param transX translation factor along x axis.
48:             * @param transY translation factor along y axis.
49:             * @param interp an Interpolation object to use for resampling.
50:             * @param cobbleSources a boolean indicating whether computeRect()
51:             *        expects contiguous sources.
52:             */
53:            public MlibScaleOpImage(RenderedImage source,
54:                    BorderExtender extender, Map config, ImageLayout layout,
55:                    float scaleX, float scaleY, float transX, float transY,
56:                    Interpolation interp, boolean cobbleSources) {
57:                super (source, layout, config, cobbleSources, extender, interp,
58:                        scaleX, scaleY, transX, transY);
59:
60:                // If the user did not provide a BorderExtender, attach a
61:                // BorderExtenderCopy to Medialib such that when Medialib
62:                // ask for additional source which may lie outside the 
63:                // bounds, it always gets it.
64:                this .extender = (extender == null) ? BorderExtender
65:                        .createInstance(BorderExtender.BORDER_COPY) : extender;
66:            }
67:
68:            // Override backwardMapRect to pad the source by one extra pixel
69:            // in all directions for non Nearest Neighbor interpolations, so 
70:            // that precision issues don't cause Medialib to not write areas
71:            // in the destination rectangle.
72:
73:            /**
74:             * Returns the minimum bounding box of the region of the specified
75:             * source to which a particular <code>Rectangle</code> of the
76:             * destination will be mapped.
77:             *
78:             * @param destRect the <code>Rectangle</code> in destination coordinates.
79:             * @param sourceIndex the index of the source image.
80:             *
81:             * @return a <code>Rectangle</code> indicating the source bounding box,
82:             *         or <code>null</code> if the bounding box is unknown.
83:             *
84:             * @throws IllegalArgumentException if <code>sourceIndex</code> is
85:             *         negative or greater than the index of the last source.
86:             * @throws IllegalArgumentException if <code>destRect</code> is
87:             *         <code>null</code>.
88:             */
89:            protected Rectangle backwardMapRect(Rectangle destRect,
90:                    int sourceIndex) {
91:
92:                Rectangle srcRect = super 
93:                        .backwardMapRect(destRect, sourceIndex);
94:                Rectangle paddedSrcRect = new Rectangle(srcRect.x - 1,
95:                        srcRect.y - 1, srcRect.width + 2, srcRect.height + 2);
96:
97:                return paddedSrcRect;
98:            }
99:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.