Source Code Cross Referenced for GlyfCompositeComp.java in  » Graphic-Library » batik » org » apache » batik » svggen » font » table » 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 » Graphic Library » batik » org.apache.batik.svggen.font.table 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Licensed to the Apache Software Foundation (ASF) under one or more
004:           contributor license agreements.  See the NOTICE file distributed with
005:           this work for additional information regarding copyright ownership.
006:           The ASF licenses this file to You under the Apache License, Version 2.0
007:           (the "License"); you may not use this file except in compliance with
008:           the License.  You may obtain a copy of the License at
009:
010:               http://www.apache.org/licenses/LICENSE-2.0
011:
012:           Unless required by applicable law or agreed to in writing, software
013:           distributed under the License is distributed on an "AS IS" BASIS,
014:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:           See the License for the specific language governing permissions and
016:           limitations under the License.
017:
018:         */
019:        package org.apache.batik.svggen.font.table;
020:
021:        import java.io.ByteArrayInputStream;
022:
023:        /**
024:         * @version $Id: GlyfCompositeComp.java 475477 2006-11-15 22:44:28Z cam $
025:         * @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
026:         */
027:        public class GlyfCompositeComp {
028:
029:            public static final short ARG_1_AND_2_ARE_WORDS = 0x0001;
030:            public static final short ARGS_ARE_XY_VALUES = 0x0002;
031:            public static final short ROUND_XY_TO_GRID = 0x0004;
032:            public static final short WE_HAVE_A_SCALE = 0x0008;
033:            public static final short MORE_COMPONENTS = 0x0020;
034:            public static final short WE_HAVE_AN_X_AND_Y_SCALE = 0x0040;
035:            public static final short WE_HAVE_A_TWO_BY_TWO = 0x0080;
036:            public static final short WE_HAVE_INSTRUCTIONS = 0x0100;
037:            public static final short USE_MY_METRICS = 0x0200;
038:
039:            private int firstIndex;
040:            private int firstContour;
041:            private short argument1;
042:            private short argument2;
043:            private short flags;
044:            private int glyphIndex;
045:            private double xscale = 1.0;
046:            private double yscale = 1.0;
047:            private double scale01 = 0.0;
048:            private double scale10 = 0.0;
049:            private int xtranslate = 0;
050:            private int ytranslate = 0;
051:            private int point1 = 0;
052:            private int point2 = 0;
053:
054:            protected GlyfCompositeComp(ByteArrayInputStream bais) {
055:                flags = (short) ((bais.read() << 8) | bais.read());
056:                glyphIndex = ((bais.read() << 8) | bais.read());
057:
058:                // Get the arguments as just their raw values
059:                if ((flags & ARG_1_AND_2_ARE_WORDS) != 0) {
060:                    argument1 = (short) (bais.read() << 8 | bais.read());
061:                    argument2 = (short) (bais.read() << 8 | bais.read());
062:                } else {
063:                    argument1 = (short) bais.read();
064:                    argument2 = (short) bais.read();
065:                }
066:
067:                // Assign the arguments according to the flags
068:                if ((flags & ARGS_ARE_XY_VALUES) != 0) {
069:                    xtranslate = argument1;
070:                    ytranslate = argument2;
071:                } else {
072:                    point1 = argument1;
073:                    point2 = argument2;
074:                }
075:
076:                // Get the scale values (if any)
077:                if ((flags & WE_HAVE_A_SCALE) != 0) {
078:                    int i = (short) (bais.read() << 8 | bais.read());
079:                    xscale = yscale = (double) i / (double) 0x4000;
080:                } else if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0) {
081:                    short i = (short) (bais.read() << 8 | bais.read());
082:                    xscale = (double) i / (double) 0x4000;
083:                    i = (short) (bais.read() << 8 | bais.read());
084:                    yscale = (double) i / (double) 0x4000;
085:                } else if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0) {
086:                    int i = (short) (bais.read() << 8 | bais.read());
087:                    xscale = (double) i / (double) 0x4000;
088:                    i = (short) (bais.read() << 8 | bais.read());
089:                    scale01 = (double) i / (double) 0x4000;
090:                    i = (short) (bais.read() << 8 | bais.read());
091:                    scale10 = (double) i / (double) 0x4000;
092:                    i = (short) (bais.read() << 8 | bais.read());
093:                    yscale = (double) i / (double) 0x4000;
094:                }
095:            }
096:
097:            public void setFirstIndex(int idx) {
098:                firstIndex = idx;
099:            }
100:
101:            public int getFirstIndex() {
102:                return firstIndex;
103:            }
104:
105:            public void setFirstContour(int idx) {
106:                firstContour = idx;
107:            }
108:
109:            public int getFirstContour() {
110:                return firstContour;
111:            }
112:
113:            public short getArgument1() {
114:                return argument1;
115:            }
116:
117:            public short getArgument2() {
118:                return argument2;
119:            }
120:
121:            public short getFlags() {
122:                return flags;
123:            }
124:
125:            public int getGlyphIndex() {
126:                return glyphIndex;
127:            }
128:
129:            public double getScale01() {
130:                return scale01;
131:            }
132:
133:            public double getScale10() {
134:                return scale10;
135:            }
136:
137:            public double getXScale() {
138:                return xscale;
139:            }
140:
141:            public double getYScale() {
142:                return yscale;
143:            }
144:
145:            public int getXTranslate() {
146:                return xtranslate;
147:            }
148:
149:            public int getYTranslate() {
150:                return ytranslate;
151:            }
152:
153:            /**
154:             * Transforms an x-coordinate of a point for this component.
155:             * @param x The x-coordinate of the point to transform
156:             * @param y The y-coordinate of the point to transform
157:             * @return The transformed x-coordinate
158:             */
159:            public int scaleX(int x, int y) {
160:                return Math.round((float) (x * xscale + y * scale10));
161:            }
162:
163:            /**
164:             * Transforms a y-coordinate of a point for this component.
165:             * @param x The x-coordinate of the point to transform
166:             * @param y The y-coordinate of the point to transform
167:             * @return The transformed y-coordinate
168:             */
169:            public int scaleY(int x, int y) {
170:                return Math.round((float) (x * scale01 + y * yscale));
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.