Source Code Cross Referenced for PSDocumentGraphics2D.java in  » Graphic-Library » xmlgraphics-commons-1.2 » org » apache » xmlgraphics » java2d » ps » 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 » xmlgraphics commons 1.2 » org.apache.xmlgraphics.java2d.ps 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /* $Id: PSDocumentGraphics2D.java 512838 2007-02-28 16:42:28Z jeremias $ */
019:
020:        package org.apache.xmlgraphics.java2d.ps;
021:
022:        import java.awt.Graphics;
023:        import java.io.OutputStream;
024:        import java.io.IOException;
025:
026:        import org.apache.xmlgraphics.ps.DSCConstants;
027:        import org.apache.xmlgraphics.ps.PSProcSets;
028:
029:        /**
030:         * This class is a wrapper for the <tt>PSGraphics2D</tt> that
031:         * is used to create a full document around the PostScript rendering from
032:         * <tt>PSGraphics2D</tt>.
033:         *
034:         * @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
035:         * @version $Id: PSDocumentGraphics2D.java 512838 2007-02-28 16:42:28Z jeremias $
036:         * @see org.apache.xmlgraphics.java2d.ps.PSGraphics2D
037:         */
038:        public class PSDocumentGraphics2D extends AbstractPSDocumentGraphics2D {
039:
040:            /**
041:             * Create a new AbstractPSDocumentGraphics2D.
042:             * This is used to create a new PostScript document, the height,
043:             * width and output stream can be setup later.
044:             * For use by the transcoder which needs font information
045:             * for the bridge before the document size is known.
046:             * The resulting document is written to the stream after rendering.
047:             *
048:             * @param textAsShapes set this to true so that text will be rendered
049:             * using curves and not the font.
050:             */
051:            public PSDocumentGraphics2D(boolean textAsShapes) {
052:                super (textAsShapes);
053:            }
054:
055:            /**
056:             * Create a new AbstractPSDocumentGraphics2D.
057:             * This is used to create a new PostScript document of the given height
058:             * and width.
059:             * The resulting document is written to the stream after rendering.
060:             *
061:             * @param textAsShapes set this to true so that text will be rendered
062:             * using curves and not the font.
063:             * @param stream the stream that the final document should be written to.
064:             * @param width the width of the document
065:             * @param height the height of the document
066:             * @throws IOException an io exception if there is a problem
067:             *         writing to the output stream
068:             */
069:            public PSDocumentGraphics2D(boolean textAsShapes,
070:                    OutputStream stream, int width, int height)
071:                    throws IOException {
072:                this (textAsShapes);
073:                setupDocument(stream, width, height);
074:            }
075:
076:            public void nextPage() throws IOException {
077:                closePage();
078:            }
079:
080:            protected void writeFileHeader() throws IOException {
081:                final Long pagewidth = new Long(this .width);
082:                final Long pageheight = new Long(this .height);
083:
084:                //PostScript Header
085:                gen.writeln(DSCConstants.PS_ADOBE_30);
086:                gen.writeDSCComment(DSCConstants.CREATOR,
087:                        new String[] { "Apache XML Graphics Commons"
088:                                + ": PostScript Generator for Java2D" });
089:                gen.writeDSCComment(DSCConstants.CREATION_DATE,
090:                        new Object[] { new java.util.Date() });
091:                gen.writeDSCComment(DSCConstants.PAGES, DSCConstants.ATEND);
092:                gen.writeDSCComment(DSCConstants.BBOX, new Object[] { ZERO,
093:                        ZERO, pagewidth, pageheight });
094:                gen.writeDSCComment(DSCConstants.END_COMMENTS);
095:
096:                //Defaults
097:                gen.writeDSCComment(DSCConstants.BEGIN_DEFAULTS);
098:                gen.writeDSCComment(DSCConstants.END_DEFAULTS);
099:
100:                //Prolog
101:                gen.writeDSCComment(DSCConstants.BEGIN_PROLOG);
102:                gen.writeDSCComment(DSCConstants.END_PROLOG);
103:
104:                //Setup
105:                gen.writeDSCComment(DSCConstants.BEGIN_SETUP);
106:                PSProcSets.writeStdProcSet(gen);
107:                PSProcSets.writeEPSProcSet(gen);
108:                if (customTextHandler != null) {
109:                    customTextHandler.writeSetup();
110:                }
111:                gen.writeDSCComment(DSCConstants.END_SETUP);
112:            }
113:
114:            protected void writePageHeader() throws IOException {
115:                Integer pageNumber = new Integer(this .pagecount);
116:                gen.writeDSCComment(DSCConstants.PAGE, new Object[] {
117:                        pageNumber.toString(), pageNumber });
118:                gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] {
119:                        ZERO, ZERO, new Integer(width), new Integer(height) });
120:                gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP);
121:                gen.writeln("<<");
122:                gen.writeln("/PageSize [" + width + " " + height + "]");
123:                gen.writeln("/ImagingBBox null");
124:                gen.writeln(">> setpagedevice");
125:                if (customTextHandler != null) {
126:                    customTextHandler.writePageSetup();
127:                }
128:            }
129:
130:            protected void writePageTrailer() throws IOException {
131:                gen.writeln("showpage");
132:            }
133:
134:            /**
135:             * This constructor supports the create method
136:             * @param g the PostScript document graphics to make a copy of
137:             */
138:            public PSDocumentGraphics2D(PSDocumentGraphics2D g) {
139:                super (g);
140:            }
141:
142:            /**
143:             * Creates a new <code>Graphics</code> object that is
144:             * a copy of this <code>Graphics</code> object.
145:             * @return     a new graphics context that is a copy of
146:             * this graphics context.
147:             */
148:            public Graphics create() {
149:                return new PSDocumentGraphics2D(this);
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.