Source Code Cross Referenced for PdfPatternPainter.java in  » PDF » pdf-itext » com » lowagie » text » pdf » 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 » PDF » pdf itext » com.lowagie.text.pdf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the Mozilla Public License Version 1.1
003:         * (the "License"); you may not use this file except in compliance with the License.
004:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:         *
006:         * Software distributed under the License is distributed on an "AS IS" basis,
007:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:         * for the specific language governing rights and limitations under the License.
009:         *
010:         * The Original Code is 'iText, a free JAVA-PDF library'.
011:         *
012:         * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
013:         * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
014:         * All Rights Reserved.
015:         * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
016:         * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
017:         *
018:         * Contributor(s): all the names of the contributors are added in the source code
019:         * where applicable.
020:         *
021:         * Alternatively, the contents of this file may be used under the terms of the
022:         * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
023:         * provisions of LGPL are applicable instead of those above.  If you wish to
024:         * allow use of your version of this file only under the terms of the LGPL
025:         * License and not to allow others to use your version of this file under
026:         * the MPL, indicate your decision by deleting the provisions above and
027:         * replace them with the notice and other provisions required by the LGPL.
028:         * If you do not delete the provisions above, a recipient may use your version
029:         * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
030:         *
031:         * This library is free software; you can redistribute it and/or modify it
032:         * under the terms of the MPL as stated above or under the terms of the GNU
033:         * Library General Public License as published by the Free Software Foundation;
034:         * either version 2 of the License, or any later version.
035:         *
036:         * This library is distributed in the hope that it will be useful, but WITHOUT
037:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
038:         * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
039:         * details.
040:         *
041:         * If you didn't download this code from the following link, you should check if
042:         * you aren't using an obsolete version:
043:         * http://www.lowagie.com/iText/
044:         */
045:        package com.lowagie.text.pdf;
046:
047:        import java.awt.Color;
048:
049:        import com.lowagie.text.DocumentException;
050:        import com.lowagie.text.Image;
051:        import com.lowagie.text.Rectangle;
052:
053:        /**
054:         * Implements the pattern.
055:         */
056:
057:        public class PdfPatternPainter extends PdfTemplate {
058:
059:            protected float xstep, ystep;
060:            protected boolean stencil = false;
061:            protected Color defaultColor;
062:
063:            /**
064:             *Creates a <CODE>PdfPattern</CODE>.
065:             */
066:
067:            private PdfPatternPainter() {
068:                super ();
069:                type = TYPE_PATTERN;
070:            }
071:
072:            /**
073:             * Creates new PdfPattern
074:             *
075:             * @param wr the <CODE>PdfWriter</CODE>
076:             */
077:
078:            PdfPatternPainter(PdfWriter wr) {
079:                super (wr);
080:                type = TYPE_PATTERN;
081:            }
082:
083:            PdfPatternPainter(PdfWriter wr, Color defaultColor) {
084:                this (wr);
085:                stencil = true;
086:                if (defaultColor == null)
087:                    this .defaultColor = Color.gray;
088:                else
089:                    this .defaultColor = defaultColor;
090:            }
091:
092:            /**
093:             * Sets the horizontal interval of this pattern.
094:             *
095:             * @param xstep the xstep in horizontal painting
096:             */
097:
098:            public void setXStep(float xstep) {
099:                this .xstep = xstep;
100:            }
101:
102:            /**
103:             * Sets the vertical interval of this pattern.
104:             *
105:             * @param ystep in vertical painting
106:             */
107:
108:            public void setYStep(float ystep) {
109:                this .ystep = ystep;
110:            }
111:
112:            /**
113:             * Returns the horizontal interval when repeating the pattern.
114:             * @return a value
115:             */
116:            public float getXStep() {
117:                return this .xstep;
118:            }
119:
120:            /**
121:             * Returns the vertical interval when repeating the pattern.
122:             * @return a value
123:             */
124:            public float getYStep() {
125:                return this .ystep;
126:            }
127:
128:            /**
129:             * Tells you if this pattern is colored/uncolored (stencil = uncolored, you need to set a default color).
130:             * @return true if the pattern is an uncolored tiling pattern (stencil).
131:             */
132:            public boolean isStencil() {
133:                return stencil;
134:            }
135:
136:            /**
137:             * Sets the transformation matrix for the pattern.
138:             * @param a
139:             * @param b
140:             * @param c
141:             * @param d
142:             * @param e
143:             * @param f
144:             */
145:            public void setPatternMatrix(float a, float b, float c, float d,
146:                    float e, float f) {
147:                setMatrix(a, b, c, d, e, f);
148:            }
149:
150:            /**
151:             * Gets the stream representing this pattern
152:             *
153:             * @return the stream representing this pattern
154:             */
155:
156:            PdfPattern getPattern() {
157:                return new PdfPattern(this );
158:            }
159:
160:            /**
161:             * Gets a duplicate of this <CODE>PdfPatternPainter</CODE>. All
162:             * the members are copied by reference but the buffer stays different.
163:             * @return a copy of this <CODE>PdfPatternPainter</CODE>
164:             */
165:
166:            public PdfContentByte getDuplicate() {
167:                PdfPatternPainter tpl = new PdfPatternPainter();
168:                tpl.writer = writer;
169:                tpl.pdf = pdf;
170:                tpl.this Reference = this Reference;
171:                tpl.pageResources = pageResources;
172:                tpl.bBox = new Rectangle(bBox);
173:                tpl.xstep = xstep;
174:                tpl.ystep = ystep;
175:                tpl.matrix = matrix;
176:                tpl.stencil = stencil;
177:                tpl.defaultColor = defaultColor;
178:                return tpl;
179:            }
180:
181:            /**
182:             * Returns the default color of the pattern.
183:             * @return a Color
184:             */
185:            public Color getDefaultColor() {
186:                return defaultColor;
187:            }
188:
189:            /**
190:             * @see com.lowagie.text.pdf.PdfContentByte#setGrayFill(float)
191:             */
192:            public void setGrayFill(float gray) {
193:                checkNoColor();
194:                super .setGrayFill(gray);
195:            }
196:
197:            /**
198:             * @see com.lowagie.text.pdf.PdfContentByte#resetGrayFill()
199:             */
200:            public void resetGrayFill() {
201:                checkNoColor();
202:                super .resetGrayFill();
203:            }
204:
205:            /**
206:             * @see com.lowagie.text.pdf.PdfContentByte#setGrayStroke(float)
207:             */
208:            public void setGrayStroke(float gray) {
209:                checkNoColor();
210:                super .setGrayStroke(gray);
211:            }
212:
213:            /**
214:             * @see com.lowagie.text.pdf.PdfContentByte#resetGrayStroke()
215:             */
216:            public void resetGrayStroke() {
217:                checkNoColor();
218:                super .resetGrayStroke();
219:            }
220:
221:            /**
222:             * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorFillF(float, float, float)
223:             */
224:            public void setRGBColorFillF(float red, float green, float blue) {
225:                checkNoColor();
226:                super .setRGBColorFillF(red, green, blue);
227:            }
228:
229:            /**
230:             * @see com.lowagie.text.pdf.PdfContentByte#resetRGBColorFill()
231:             */
232:            public void resetRGBColorFill() {
233:                checkNoColor();
234:                super .resetRGBColorFill();
235:            }
236:
237:            /**
238:             * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorStrokeF(float, float, float)
239:             */
240:            public void setRGBColorStrokeF(float red, float green, float blue) {
241:                checkNoColor();
242:                super .setRGBColorStrokeF(red, green, blue);
243:            }
244:
245:            /**
246:             * @see com.lowagie.text.pdf.PdfContentByte#resetRGBColorStroke()
247:             */
248:            public void resetRGBColorStroke() {
249:                checkNoColor();
250:                super .resetRGBColorStroke();
251:            }
252:
253:            /**
254:             * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFillF(float, float, float, float)
255:             */
256:            public void setCMYKColorFillF(float cyan, float magenta,
257:                    float yellow, float black) {
258:                checkNoColor();
259:                super .setCMYKColorFillF(cyan, magenta, yellow, black);
260:            }
261:
262:            /**
263:             * @see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorFill()
264:             */
265:            public void resetCMYKColorFill() {
266:                checkNoColor();
267:                super .resetCMYKColorFill();
268:            }
269:
270:            /**
271:             * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStrokeF(float, float, float, float)
272:             */
273:            public void setCMYKColorStrokeF(float cyan, float magenta,
274:                    float yellow, float black) {
275:                checkNoColor();
276:                super .setCMYKColorStrokeF(cyan, magenta, yellow, black);
277:            }
278:
279:            /**
280:             * @see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorStroke()
281:             */
282:            public void resetCMYKColorStroke() {
283:                checkNoColor();
284:                super .resetCMYKColorStroke();
285:            }
286:
287:            /**
288:             * @see com.lowagie.text.pdf.PdfContentByte#addImage(com.lowagie.text.Image, float, float, float, float, float, float)
289:             */
290:            public void addImage(Image image, float a, float b, float c,
291:                    float d, float e, float f) throws DocumentException {
292:                if (stencil && !image.isMask())
293:                    checkNoColor();
294:                super .addImage(image, a, b, c, d, e, f);
295:            }
296:
297:            /**
298:             * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFill(int, int, int, int)
299:             */
300:            public void setCMYKColorFill(int cyan, int magenta, int yellow,
301:                    int black) {
302:                checkNoColor();
303:                super .setCMYKColorFill(cyan, magenta, yellow, black);
304:            }
305:
306:            /**
307:             * @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStroke(int, int, int, int)
308:             */
309:            public void setCMYKColorStroke(int cyan, int magenta, int yellow,
310:                    int black) {
311:                checkNoColor();
312:                super .setCMYKColorStroke(cyan, magenta, yellow, black);
313:            }
314:
315:            /**
316:             * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorFill(int, int, int)
317:             */
318:            public void setRGBColorFill(int red, int green, int blue) {
319:                checkNoColor();
320:                super .setRGBColorFill(red, green, blue);
321:            }
322:
323:            /**
324:             * @see com.lowagie.text.pdf.PdfContentByte#setRGBColorStroke(int, int, int)
325:             */
326:            public void setRGBColorStroke(int red, int green, int blue) {
327:                checkNoColor();
328:                super .setRGBColorStroke(red, green, blue);
329:            }
330:
331:            /**
332:             * @see com.lowagie.text.pdf.PdfContentByte#setColorStroke(java.awt.Color)
333:             */
334:            public void setColorStroke(Color color) {
335:                checkNoColor();
336:                super .setColorStroke(color);
337:            }
338:
339:            /**
340:             * @see com.lowagie.text.pdf.PdfContentByte#setColorFill(java.awt.Color)
341:             */
342:            public void setColorFill(Color color) {
343:                checkNoColor();
344:                super .setColorFill(color);
345:            }
346:
347:            /**
348:             * @see com.lowagie.text.pdf.PdfContentByte#setColorFill(com.lowagie.text.pdf.PdfSpotColor, float)
349:             */
350:            public void setColorFill(PdfSpotColor sp, float tint) {
351:                checkNoColor();
352:                super .setColorFill(sp, tint);
353:            }
354:
355:            /**
356:             * @see com.lowagie.text.pdf.PdfContentByte#setColorStroke(com.lowagie.text.pdf.PdfSpotColor, float)
357:             */
358:            public void setColorStroke(PdfSpotColor sp, float tint) {
359:                checkNoColor();
360:                super .setColorStroke(sp, tint);
361:            }
362:
363:            /**
364:             * @see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter)
365:             */
366:            public void setPatternFill(PdfPatternPainter p) {
367:                checkNoColor();
368:                super .setPatternFill(p);
369:            }
370:
371:            /**
372:             * @see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)
373:             */
374:            public void setPatternFill(PdfPatternPainter p, Color color,
375:                    float tint) {
376:                checkNoColor();
377:                super .setPatternFill(p, color, tint);
378:            }
379:
380:            /**
381:             * @see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float)
382:             */
383:            public void setPatternStroke(PdfPatternPainter p, Color color,
384:                    float tint) {
385:                checkNoColor();
386:                super .setPatternStroke(p, color, tint);
387:            }
388:
389:            /**
390:             * @see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter)
391:             */
392:            public void setPatternStroke(PdfPatternPainter p) {
393:                checkNoColor();
394:                super .setPatternStroke(p);
395:            }
396:
397:            void checkNoColor() {
398:                if (stencil)
399:                    throw new RuntimeException(
400:                            "Colors are not allowed in uncolored tile patterns.");
401:            }
402:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.