Source Code Cross Referenced for Transformer.java in  » 6.0-JDK-Modules » j2me » com » sun » pisces » 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 » j2me » com.sun.pisces 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved. 
004:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER 
005:         *  
006:         * This program is free software; you can redistribute it and/or 
007:         * modify it under the terms of the GNU General Public License version 
008:         * 2 only, as published by the Free Software Foundation. 
009:         *  
010:         * This program is distributed in the hope that it will be useful, but 
011:         * WITHOUT ANY WARRANTY; without even the implied warranty of 
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
013:         * General Public License version 2 for more details (a copy is 
014:         * included at /legal/license.txt). 
015:         *  
016:         * You should have received a copy of the GNU General Public License 
017:         * version 2 along with this work; if not, write to the Free Software 
018:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 
019:         * 02110-1301 USA 
020:         *  
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa 
022:         * Clara, CA 95054 or visit www.sun.com if you need additional 
023:         * information or have any questions.
024:         */
025:
026:        package com.sun.pisces;
027:
028:        public class Transformer extends PathSink {
029:
030:            PathSink output;
031:            long m00, m01, m02;
032:            long m10, m11, m12;
033:
034:            boolean scaleAndTranslate;
035:
036:            public Transformer() {
037:            }
038:
039:            public Transformer(PathSink output, Transform6 transform) {
040:                if (output instanceof  Transformer) {
041:                    // Collapse adjacent transforms
042:                    Transformer t = (Transformer) output;
043:                    this .output = t.output;
044:                    this .m00 = (transform.m00 * t.m00 + transform.m10 * t.m01) >> 16;
045:                    this .m01 = (transform.m01 * t.m00 + transform.m11 * t.m01) >> 16;
046:                    this .m10 = (transform.m00 * t.m10 + transform.m10 * t.m11) >> 16;
047:                    this .m11 = (transform.m01 * t.m10 + transform.m11 * t.m11) >> 16;
048:                    this .m02 = transform.m02 * t.m00 + transform.m12 * t.m01
049:                            + t.m02;
050:                    this .m12 = transform.m02 * t.m10 + transform.m12 * t.m11
051:                            + t.m12;
052:                } else {
053:                    this .output = output;
054:                    setTransform(transform);
055:                }
056:
057:                classify();
058:            }
059:
060:            public void setTransform(Transform6 transform) {
061:                this .m00 = (long) transform.m00;
062:                this .m01 = (long) transform.m01;
063:                this .m02 = (long) transform.m02 << 16;
064:                this .m10 = (long) transform.m10;
065:                this .m11 = (long) transform.m11;
066:                this .m12 = (long) transform.m12 << 16;
067:
068:                classify();
069:            }
070:
071:            private void classify() {
072:                if (m01 == 0 && m10 == 0) {
073:                    scaleAndTranslate = true;
074:                } else {
075:                    scaleAndTranslate = false;
076:                }
077:            }
078:
079:            public void setOutput(PathSink output) {
080:                this .output = output;
081:            }
082:
083:            public void moveTo(int x0, int y0) {
084:                long tx0, ty0;
085:
086:                if (scaleAndTranslate) {
087:                    tx0 = m00 * x0 + m02;
088:                    ty0 = m11 * y0 + m12;
089:                } else {
090:                    tx0 = m00 * x0 + m01 * y0 + m02;
091:                    ty0 = m10 * x0 + m11 * y0 + m12;
092:                }
093:
094:                //   	System.out.println("PT: moveTo " +
095:                //   			   ((tx0 >> 16)/65536.0) + ", " +
096:                //   			   ((ty0 >> 16)/65536.0));
097:                output.moveTo((int) (tx0 >> 16), (int) (ty0 >> 16));
098:            }
099:
100:            public void lineJoin() {
101:                output.lineJoin();
102:            }
103:
104:            public void lineTo(int x1, int y1) {
105:                long tx1, ty1;
106:
107:                if (scaleAndTranslate) {
108:                    tx1 = m00 * x1 + m02;
109:                    ty1 = m11 * y1 + m12;
110:                } else {
111:                    tx1 = m00 * x1 + m01 * y1 + m02;
112:                    ty1 = m10 * x1 + m11 * y1 + m12;
113:                }
114:
115:                //   	System.out.println("PT: lineTo " +
116:                //   			   ((tx1 >> 16)/65536.0) + ", " +
117:                //   			   ((ty1 >> 16)/65536.0));
118:                output.lineTo((int) (tx1 >> 16), (int) (ty1 >> 16));
119:            }
120:
121:            public void quadTo(int x1, int y1, int x2, int y2) {
122:                long tx1, ty1, tx2, ty2;
123:
124:                if (scaleAndTranslate) {
125:                    tx1 = m00 * x1 + m02;
126:                    ty1 = m11 * y1 + m12;
127:                    tx2 = m00 * x2 + m02;
128:                    ty2 = m11 * y2 + m12;
129:                } else {
130:                    tx1 = m00 * x1 + m01 * y1 + m02;
131:                    ty1 = m10 * x1 + m11 * y1 + m12;
132:                    tx2 = m00 * x2 + m01 * y2 + m02;
133:                    ty2 = m10 * x2 + m11 * y2 + m12;
134:                }
135:
136:                // 	System.out.println("PT: quadTo " +
137:                //  			   ((tx1 >> 16)/65536.0) + ", " +
138:                //  			   ((ty1 >> 16)/65536.0) + ", " +
139:                //  			   ((tx2 >> 16)/65536.0) + ", " +
140:                //  			   ((ty2 >> 16)/65536.0));
141:                output.quadTo((int) (tx1 >> 16), (int) (ty1 >> 16),
142:                        (int) (tx2 >> 16), (int) (ty2 >> 16));
143:            }
144:
145:            public void cubicTo(int x1, int y1, int x2, int y2, int x3, int y3) {
146:                long tx1, ty1, tx2, ty2, tx3, ty3;
147:
148:                if (scaleAndTranslate) {
149:                    tx1 = m00 * x1 + m02;
150:                    ty1 = m11 * y1 + m12;
151:                    tx2 = m00 * x2 + m02;
152:                    ty2 = m11 * y2 + m12;
153:                    tx3 = m00 * x3 + m02;
154:                    ty3 = m11 * y3 + m12;
155:                } else {
156:                    tx1 = m00 * x1 + m01 * y1 + m02;
157:                    ty1 = m10 * x1 + m11 * y1 + m12;
158:                    tx2 = m00 * x2 + m01 * y2 + m02;
159:                    ty2 = m10 * x2 + m11 * y2 + m12;
160:                    tx3 = m00 * x3 + m01 * y3 + m02;
161:                    ty3 = m10 * x3 + m11 * y3 + m12;
162:                }
163:                //          if (m00 != (1 << 16)) {
164:                //              tx1 = m00*x1;
165:                //              tx2 = m00*x2;
166:                //              tx3 = m00*x3;
167:                //          } else {
168:                //              tx1 = (long)x1 << 16;
169:                //              tx2 = (long)x2 << 16;
170:                //              tx3 = (long)x3 << 16;
171:                //          }
172:
173:                //         if (m11 != (1 << 16)) {
174:                //             ty1 = m11*y1;
175:                //             ty2 = m11*y2;
176:                //             ty3 = m11*y3;
177:                //         } else {
178:                //             ty1 = (long)y1 << 16;
179:                //             ty2 = (long)y2 << 16;
180:                //             ty3 = (long)y3 << 16;
181:                //         }
182:
183:                //         if (m01 != 0) {
184:                //             tx1 += m01*y1;
185:                //             tx2 += m01*y2;
186:                //             tx3 += m01*y3;
187:                //         }
188:
189:                //         if (m10 != 0) {
190:                //             ty1 += m10*x1;
191:                //             ty2 += m10*x2;
192:                //             ty3 += m10*x3;
193:                //         }
194:
195:                //         if (m02 != 0) {
196:                //             tx1 += m02;
197:                //             tx2 += m02;
198:                //             tx3 += m02;
199:                //         }
200:
201:                //         if (m12 != 0) {
202:                //             ty1 += m12;
203:                //             ty2 += m12;
204:                //             ty3 += m12;
205:                //         }
206:
207:                //  	System.out.println("PT: cubicTo " +
208:                //   			   ((tx1 >> 16)/65536.0) + ", " +
209:                //   			   ((ty1 >> 16)/65536.0) + ", " +
210:                //   			   ((tx2 >> 16)/65536.0) + ", " +
211:                //   			   ((ty2 >> 16)/65536.0) + ", " +
212:                //   			   ((tx3 >> 16)/65536.0) + ", " +
213:                //   			   ((ty3 >> 16)/65536.0));
214:                output.cubicTo((int) (tx1 >> 16), (int) (ty1 >> 16),
215:                        (int) (tx2 >> 16), (int) (ty2 >> 16),
216:                        (int) (tx3 >> 16), (int) (ty3 >> 16));
217:            }
218:
219:            public void close() {
220:                //  	System.out.println("PT: close");
221:                output.close();
222:            }
223:
224:            public void end() {
225:                //  	System.out.println("PT: end");
226:                output.end();
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.