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


001:        /*
002:         * $RCSfile: InterpolationNearest.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:11 $
010:         * $State: Exp $
011:         */
012:        package javax.media.jai;
013:
014:        /**
015:         * A class representing nearest-neighbor interpolation.  Since
016:         * nearest-neighbor interpolation is simply pixel copying, and not
017:         * really interpolation at all, most code that performs
018:         * nearest-neighbor sampling will want to use special-purpose code.
019:         * However, this class is provided both as a way to specify such
020:         * interpolation, with the consumer making use of 'instanceof' to
021:         * detect the particular class, and as a way to force general
022:         * Interpolation users to use nearest-neighbor sampling.
023:         *
024:         * Note that this interpolator does not actually select the 
025:         * "nearest" pixel, but only uses the truncated integer pixel
026:         * location (floor). This is an optimization reflecting an
027:         * assumption about the implementation of the resampler. It 
028:         * is assumed that the conversion of continuous source
029:         * image coordinates to discrete pixel indices drops the final
030:         * subtraction of 0.5 for the case of a nearest-neighbor interpolator.
031:         *
032:         * <p> Neighborhoods of sizes 2x1, 1x2, 2x2, 4x1, 1x4, 4x4, Nx1 and
033:         * 1xN, that is, all the interpolate() methods defined in the
034:         * Interpolation class, are supported in the interest of simplifying
035:         * code that handles a number of types of interpolation.  In each
036:         * case, the central sample is returned and the rest are ignored.
037:         *
038:         * <p> The class is marked 'final' so that it may be more easily inlined.
039:         */
040:        public final class InterpolationNearest extends Interpolation {
041:
042:            /**
043:             * Constructs an <code>InterpolationNearest</code>.  The return
044:             * value of <code>getSubsampleBitsH()</code> and
045:             * <code>getSubsampleBitsV()</code> will be 0.
046:             */
047:            public InterpolationNearest() {
048:                super (1, 1, 0, 0, 0, 0, 0, 0);
049:            }
050:
051:            /**
052:             * Performs horizontal interpolation on a one-dimensional array of 
053:             * integral samples. The central sample (samples[0]) is returned.
054:             */
055:            public int interpolateH(int[] samples, int xfrac) {
056:                return samples[0];
057:            }
058:
059:            /**
060:             * Performs vertical interpolation on a one-dimensional array of 
061:             * integral samples. The central sample (samples[0]) is returned.
062:             */
063:            public int interpolateV(int[] samples, int yfrac) {
064:                return samples[0];
065:            }
066:
067:            /**
068:             * Performs interpolation on a two-dimensional array of integral samples.
069:             * The central sample (samples[0][0]) is returned.
070:             */
071:            public int interpolate(int[][] samples, int xfrac, int yfrac) {
072:                return samples[0][0];
073:            }
074:
075:            /**
076:             * Performs horizontal interpolation on a pair of integral samples.
077:             * The central sample (s0) is returned.
078:             */
079:            public int interpolateH(int s0, int s1, int xfrac) {
080:                return s0;
081:            }
082:
083:            /**
084:             * Performs vertical interpolation on a pair of integral samples.
085:             * The central sample (s0) is returned.
086:             */
087:            public int interpolateV(int s0, int s1, int yfrac) {
088:                return s0;
089:            }
090:
091:            /**
092:             * Performs interpolation on a 2x2 grid of integral samples.
093:             * The central sample (s00) is returned.
094:             */
095:            public int interpolate(int s00, int s01, int s10, int s11,
096:                    int xfrac, int yfrac) {
097:                return s00;
098:            }
099:
100:            /**
101:             * Performs interpolation on a 4x4 grid of integral samples.
102:             * The central sample (s00) is returned.
103:             */
104:            public int interpolate(int s__, int s_0, int s_1, int s_2, int s0_,
105:                    int s00, int s01, int s02, int s1_, int s10, int s11,
106:                    int s12, int s2_, int s20, int s21, int s22, int xfrac,
107:                    int yfrac) {
108:                return s00;
109:            }
110:
111:            /**
112:             * Performs horizontal interpolation on a one-dimensional array of
113:             * floating-point samples.  The central sample (s0) is returned.
114:             */
115:            public float interpolateH(float[] samples, float xfrac) {
116:                return samples[0];
117:            }
118:
119:            /**
120:             * Performs vertical interpolation on a one-dimensional array of
121:             * floating-point samples.  The central sample (s0) is returned.
122:             */
123:            public float interpolateV(float[] samples, float yfrac) {
124:                return samples[0];
125:            }
126:
127:            /**
128:             * Performs interpolation on a two-dimensional array of
129:             * floating-point samples.  The central sample (samples[0][0]) is
130:             * returned.
131:             */
132:            public float interpolate(float[][] samples, float xfrac, float yfrac) {
133:                return samples[0][0];
134:            }
135:
136:            /**
137:             * Performs horizontal interpolation on a pair of floating-point
138:             * samples.  The central sample (s0) is returned.
139:             */
140:            public float interpolateH(float s0, float s1, float xfrac) {
141:                return s0;
142:            }
143:
144:            /**
145:             * Performs vertical interpolation on a pair of floating-point
146:             * samples.  The central sample (s0) is returned.
147:             */
148:            public float interpolateV(float s0, float s1, float yfrac) {
149:                return s0;
150:            }
151:
152:            /**
153:             * Performs interpolation on a 2x2 grid of floating-point samples.
154:             * The central sample (s00) is returned.
155:             */
156:            public float interpolate(float s00, float s01, float s10,
157:                    float s11, float xfrac, float yfrac) {
158:                return s00;
159:            }
160:
161:            /**
162:             * Performs interpolation on a 4x4 grid of floating-point samples.
163:             * The central sample (s00) is returned.
164:             */
165:            public float interpolate(float s__, float s_0, float s_1,
166:                    float s_2, float s0_, float s00, float s01, float s02,
167:                    float s1_, float s10, float s11, float s12, float s2_,
168:                    float s20, float s21, float s22, float xfrac, float yfrac) {
169:                return s00;
170:            }
171:
172:            /**
173:             * Performs horizontal interpolation on a one-dimensional array of
174:             * double samples.  The central sample (s0) is returned.
175:             */
176:            public double interpolateH(double[] samples, float xfrac) {
177:                return samples[0];
178:            }
179:
180:            /**
181:             * Performs vertical interpolation on a one-dimensional array of
182:             * double samples.  The central sample (s0) is returned.
183:             */
184:            public double interpolateV(double[] samples, float yfrac) {
185:                return samples[0];
186:            }
187:
188:            /**
189:             * Performs interpolation on a two-dimensional array of
190:             * double samples.  The central sample (samples[0][0]) is
191:             * returned.
192:             */
193:            public double interpolate(double[][] samples, float xfrac,
194:                    float yfrac) {
195:                return samples[0][0];
196:            }
197:
198:            /**
199:             * Performs horizontal interpolation on a pair of double
200:             * samples.  The central sample (s0) is returned.
201:             */
202:            public double interpolateH(double s0, double s1, float xfrac) {
203:                return s0;
204:            }
205:
206:            /**
207:             * Performs vertical interpolation on a pair of double
208:             * samples.  The central sample (s0) is returned.
209:             */
210:            public double interpolateV(double s0, double s1, float yfrac) {
211:                return s0;
212:            }
213:
214:            /**
215:             * Performs interpolation on a 2x2 grid of double samples.
216:             * The central sample (s00) is returned.
217:             */
218:            public double interpolate(double s00, double s01, double s10,
219:                    double s11, float xfrac, float yfrac) {
220:                return s00;
221:            }
222:
223:            /**
224:             * Performs interpolation on a 4x4 grid of double samples.
225:             * The central sample (s00) is returned.
226:             */
227:            public double interpolate(double s__, double s_0, double s_1,
228:                    double s_2, double s0_, double s00, double s01, double s02,
229:                    double s1_, double s10, double s11, double s12, double s2_,
230:                    double s20, double s21, double s22, float xfrac, float yfrac) {
231:                return s00;
232:            }
233:
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.