Java Doc for PDFGraphics.java in  » PDF » gnujpdf » gnu » jpdf » 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 » gnujpdf » gnu.jpdf 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.Graphics
      gnu.jpdf.PDFGraphics

PDFGraphics
public class PDFGraphics extends Graphics implements Serializable(Code)
This class is our implementation of AWT's Graphics class. It provides a Java standard way of rendering into a PDF Document's Page.
author:
   Peter T Mount, http://www.retep.org.uk/pdf/
author:
   Eric Z. Beard, ericzbeard@hotmail.com
author:
   $Author: ezb $
version:
   $Revision: 1.2 $, $Date: 2001/11/16 15:26:04 $
See Also:   gnu.jpdf.PDFGraphics


Field Summary
protected  RectangleclipRectangle
    
protected  Rectanglemedia
    
protected  inttrax
    
protected  inttray
    


Method Summary
public  voidarc(double axc, double ayc, double width, double height, double ang1, double ang2, boolean clockwise)
     This produces an arc by breaking it down into one or more Bezier curves.
public  voidclearRect(int x, int y, int w, int h)
    
public  voidclipPolygon(Polygon p)
     This extra method allows PDF users to clip to a Polygon.
public  voidclipRect(int x, int y, int w, int h)
    
 voidcloseBlock()
     All functions should call this to close any existing optimised blocks.
 voidcloseBlock(String code)
    

This is used by code that use the path in any way other than Stroke (like Fill, close path & Stroke etc).

public  voidcopyArea(int x, int y, int w, int h, int dx, int dy)
    
public  Graphicscreate()
    

This returns a child instance of this Graphics object.

protected  PDFGraphicscreateGraphic(PDFPage page, PrintWriter pw)
     This method creates a new instance of the class based on the page and a print writer.
public  voidcurveto(int x1, int y1, int x2, int y2, int x3, int y3)
     This extension appends a Bezier curve to the path.
public  voidcurveto(double x1, double y1, double x2, double y2, double x3, double y3)
     This extension appends a Bezier curve to the path.
public  voidcurveto(int x1, int y1, int x2, int y2)
     This extension appends a Bezier curve to the path.
public  voidcurveto(double x1, double y1, double x2, double y2)
     This extension appends a Bezier curve to the path.
public  voidcurveto2(int x1, int y1, int x2, int y2)
     This extension appends a Bezier curve to the path.
public  voidcurveto2(double x1, double y1, double x2, double y2)
     This extension appends a Bezier curve to the path.
public  voiddispose()
    

This releases any resources used by this Graphics object.

public  voiddraw3DRect(int x, int y, int width, int height, boolean raised)
    

Not implemented

Draws a 3-D highlighted outline of the specified rectangle.

public  voiddrawArc(int x, int y, int w, int h, int sa, int aa)
    
public  voiddrawBytes(byte[] data, int offset, int length, int x, int y)
    
public  booleandrawImage(Image img, int x, int y, ImageObserver obs)
    
public  booleandrawImage(Image img, int x, int y, int w, int h, ImageObserver obs)
    

Draws an image onto the page.

This method is implemented with ASCIIbase85 encoding and the zip stream deflater.

public  booleandrawImage(Image img, int x, int y, Color bgcolor, ImageObserver obs)
    
public  booleandrawImage(Image img, int x, int y, int w, int h, Color bgcolor, ImageObserver obs)
    
public  booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver obs)
     Draw's an image onto the page, with scaling

This is not yet supported.

public  booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver obs)
     Draw's an image onto the page, with scaling

This is not yet supported.

public  voiddrawLine(int x1, int y1, int x2, int y2)
     Draws a line between two coordinates.
public  voiddrawOval(int x, int y, int w, int h)
    
public  voiddrawPolygon(int[] xp, int[] yp, int np)
     Draws a polygon, linking the first and last coordinates.
public  voiddrawPolyline(int[] xp, int[] yp, int np)
     Draws a polyline.
public  voiddrawRect(int x, int y, int w, int h)
     We override Graphics.drawRect as it doesn't join the 4 lines.
public  voiddrawRoundRect(int x, int y, int w, int h, int aw, int ah)
    
public  voiddrawString(String s, int x, int y)
     This draws a string.
public  voiddrawString(java.text.AttributedCharacterIterator aci, int x, int y)
     Draws a string using a AttributedCharacterIterator.
public  voidfill3DRect(int x, int y, int width, int height, boolean raised)
    
public  voidfillArc(int x, int y, int w, int h, int sa, int aa)
    
public  voidfillOval(int x, int y, int w, int h)
    
public  voidfillPolygon(int[] xp, int[] yp, int np)
     Fills a polygon.
public  voidfillRect(int x, int y, int w, int h)
    
public  voidfillRoundRect(int x, int y, int w, int h, int aw, int ah)
    
public  ShapegetClip()
     Returns the Shape of the clipping region As my JDK docs say, this may break with Java 2D.
public  RectanglegetClipBounds()
    
public  ColorgetColor()
    
public  FontgetFont()
     Return's the current font.
public  FontMetricsgetFontMetrics(Font font)
     Returns the FontMetrics for a font.

This doesn't work correctly.

public  PDFPagegetPage()
    
public  PrintWritergetWriter()
    
protected  voidinit(PDFPage page)
     This is called by PDFPage when creating a Graphcis instance.
protected  voidinit(PDFPage page, PrintWriter pw)
    
public  voidlineto(int x, int y)
    
public  voidlineto(double x, double y)
    
public  voidmoveto(int x, int y)
     This moves the current drawing point.
public  voidmoveto(double x, double y)
     This moves the current drawing point.
 voidnewPath()
     Functions that draw lines should start by calling this.
 voidnewTextBlock(int x, int y)
    

Functions that draw text should start by calling this.

public  voidpolygon(int[] xp, int[] yp, int np)
     This is used to add a polygon to the current path.
public  voidsetClip(int x, int y, int w, int h)
    
public  voidsetClip(Shape s)
     As my JDK docs say, this may break with Java 2D.
public  voidsetColor(Color c)
    
public  voidsetDefaultLineWidth()
     This extension sets the line width to the default of 1mm which is what Java uses when drawing to a PrintJob.
public  voidsetFont(Font f)
     This sets the font.
public  voidsetLineWidth(double w)
    
public  voidsetOrientation()
     This sets the media Orientation (0=Portrait, 90=Landscape, 180=Inverse, 270=Seascape).
public  voidsetPaintMode()
     Not implemented, as this is not supported in the PDF specification.
public  voidsetXORMode(Color c1)
     Not implemented, as this is not supported in the PDF specification.
public  voidtranslate(int x, int y)
     Translate the origin.

Field Detail
clipRectangle
protected Rectangle clipRectangle(Code)
This holds the current clipRectangle



media
protected Rectangle media(Code)
This is the media we are working with



trax
protected int trax(Code)
This is used to translate coordinates



tray
protected int tray(Code)
This is used to translate coordinates





Method Detail
arc
public void arc(double axc, double ayc, double width, double height, double ang1, double ang2, boolean clockwise)(Code)
This produces an arc by breaking it down into one or more Bezier curves. It is used internally to implement the drawArc and fillArc methods.
Parameters:
  axc - X coordinate of arc centre
Parameters:
  ayc - Y coordinate of arc centre
Parameters:
  width - of bounding rectangle
Parameters:
  height - of bounding rectangle
Parameters:
  ang1 - Start angle
Parameters:
  ang2 - End angle
Parameters:
  clockwise - true to draw clockwise, false anti-clockwise



clearRect
public void clearRect(int x, int y, int w, int h)(Code)
This simply draws a White Rectangle to clear the area
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



clipPolygon
public void clipPolygon(Polygon p)(Code)
This extra method allows PDF users to clip to a Polygon.

In theory you could use setClip(), except that java.awt.Graphics only supports Rectangle with that method, so we will have an extra method.
Parameters:
  p - Polygon to clip to




clipRect
public void clipRect(int x, int y, int w, int h)(Code)
Clips to a set of coordinates
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



closeBlock
void closeBlock()(Code)
All functions should call this to close any existing optimised blocks.



closeBlock
void closeBlock(String code)(Code)

This is used by code that use the path in any way other than Stroke (like Fill, close path & Stroke etc). Usually this is used internally.


Parameters:
  code - PDF operators that will close the path



copyArea
public void copyArea(int x, int y, int w, int h, int dx, int dy)(Code)
This is unsupported - how do you do this with Vector graphics?
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height
Parameters:
  dx - coord
Parameters:
  dy - coord



create
public Graphics create()(Code)

This returns a child instance of this Graphics object. As with AWT, the affects of using the parent instance while the child exists, is not determined.

Once complete, the child should be released with it's dispose() method which will restore the graphics state to it's parent.

Graphics object to render onto the page



createGraphic
protected PDFGraphics createGraphic(PDFPage page, PrintWriter pw)(Code)
This method creates a new instance of the class based on the page and a print writer.
Parameters:
  page - the page to attach to
Parameters:
  pw - the PrintWriter to attach to.



curveto
public void curveto(int x1, int y1, int x2, int y2, int x3, int y3)(Code)
This extension appends a Bezier curve to the path. The curve extends from the current point to (x3,y3) using (x1,y1) and (x2,y2) as the Bezier control points.

The new current point is (x3,y3)
Parameters:
  x1 - First control point
Parameters:
  y1 - First control point
Parameters:
  x2 - Second control point
Parameters:
  y2 - Second control point
Parameters:
  x3 - Destination point
Parameters:
  y3 - Destination point




curveto
public void curveto(double x1, double y1, double x2, double y2, double x3, double y3)(Code)
This extension appends a Bezier curve to the path. The curve extends from the current point to (x3,y3) using (x1,y1) and (x2,y2) as the Bezier control points.

The new current point is (x3,y3)
Parameters:
  x1 - First control point
Parameters:
  y1 - First control point
Parameters:
  x2 - Second control point
Parameters:
  y2 - Second control point
Parameters:
  x3 - Destination point
Parameters:
  y3 - Destination point




curveto
public void curveto(int x1, int y1, int x2, int y2)(Code)
This extension appends a Bezier curve to the path. The curve extends from the current point to (x2,y2) using the current point and (x1,y1) as the Bezier control points.

The new current point is (x2,y2)
Parameters:
  x1 - Second control point
Parameters:
  y1 - Second control point
Parameters:
  x2 - Destination point
Parameters:
  y2 - Destination point




curveto
public void curveto(double x1, double y1, double x2, double y2)(Code)
This extension appends a Bezier curve to the path. The curve extends from the current point to (x2,y2) using the current point and (x1,y1) as the Bezier control points.

The new current point is (x2,y2)
Parameters:
  x1 - Second control point
Parameters:
  y1 - Second control point
Parameters:
  x2 - Destination point
Parameters:
  y2 - Destination point




curveto2
public void curveto2(int x1, int y1, int x2, int y2)(Code)
This extension appends a Bezier curve to the path. The curve extends from the current point to (x2,y2) using (x1,y1) and the end point as the Bezier control points.

The new current point is (x2,y2)
Parameters:
  x1 - Second control point
Parameters:
  y1 - Second control point
Parameters:
  x2 - Destination point
Parameters:
  y2 - Destination point




curveto2
public void curveto2(double x1, double y1, double x2, double y2)(Code)
This extension appends a Bezier curve to the path. The curve extends from the current point to (x2,y2) using (x1,y1) and the end point as the Bezier control points.

The new current point is (x2,y2)
Parameters:
  x1 - Second control point
Parameters:
  y1 - Second control point
Parameters:
  x2 - Destination point
Parameters:
  y2 - Destination point




dispose
public void dispose()(Code)

This releases any resources used by this Graphics object. You must use this method once finished with it. Leaving it open will leave the PDF stream in an inconsistent state, and will produce errors.

If this was created with Graphics.create() then the parent instance can be used again. If not, then this closes the graphics operations for this page when used with PDFJob.

When using PDFPage, you can create another fresh Graphics instance, which will draw over this one.




draw3DRect
public void draw3DRect(int x, int y, int width, int height, boolean raised)(Code)

Not implemented

Draws a 3-D highlighted outline of the specified rectangle. The edges of the rectangle are highlighted so that they appear to be beveled and lit from the upper left corner. The colors used for the highlighting effect are determined based on the current color. The resulting rectangle covers an area that is width + 1 pixels wide by height + 1 pixels tall.


Parameters:
  x - an int value
Parameters:
  y - an int value
Parameters:
  width - an int value
Parameters:
  height - an int value
Parameters:
  raised - a boolean value



drawArc
public void drawArc(int x, int y, int w, int h, int sa, int aa)(Code)
Draws an arc
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height
Parameters:
  sa - Start angle
Parameters:
  aa - End angle



drawBytes
public void drawBytes(byte[] data, int offset, int length, int x, int y)(Code)

Not implemented


Parameters:
  data - a byte[] value
Parameters:
  offset - an int value
Parameters:
  length - an int value
Parameters:
  x - an int value
Parameters:
  y - an int value



drawImage
public boolean drawImage(Image img, int x, int y, ImageObserver obs)(Code)
Draw's an image onto the page
Parameters:
  img - The java.awt.Image
Parameters:
  x - coordinate on page
Parameters:
  y - coordinate on page
Parameters:
  obs - ImageObserver true if drawn



drawImage
public boolean drawImage(Image img, int x, int y, int w, int h, ImageObserver obs)(Code)

Draws an image onto the page.

This method is implemented with ASCIIbase85 encoding and the zip stream deflater. It results in a stream that is anywhere from 3 to 10 times as big as the image. This obviusly needs some improvement, but it works well for small images


Parameters:
  img - The java.awt.Image
Parameters:
  x - coordinate on page
Parameters:
  y - coordinate on page
Parameters:
  w - Width on page
Parameters:
  h - height on page
Parameters:
  obs - ImageObserver true if drawn



drawImage
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver obs)(Code)

Draw's an image onto the page, with a backing colour.


Parameters:
  img - The java.awt.Image
Parameters:
  x - coordinate on page
Parameters:
  y - coordinate on page
Parameters:
  bgcolor - Background colour
Parameters:
  obs - ImageObserver true if drawn



drawImage
public boolean drawImage(Image img, int x, int y, int w, int h, Color bgcolor, ImageObserver obs)(Code)

Draw's an image onto the page, with a backing colour.


Parameters:
  img - The java.awt.Image
Parameters:
  x - coordinate on page
Parameters:
  y - coordinate on page
Parameters:
  w - Width on page
Parameters:
  h - height on page
Parameters:
  bgcolor - Background colour
Parameters:
  obs - ImageObserver true if drawn



drawImage
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver obs)(Code)
Draw's an image onto the page, with scaling

This is not yet supported.
Parameters:
  img - The java.awt.Image
Parameters:
  dx1 - coordinate on page
Parameters:
  dy1 - coordinate on page
Parameters:
  dx2 - coordinate on page
Parameters:
  dy2 - coordinate on page
Parameters:
  sx1 - coordinate on image
Parameters:
  sy1 - coordinate on image
Parameters:
  sx2 - coordinate on image
Parameters:
  sy2 - coordinate on image
Parameters:
  obs - ImageObserver true if drawn




drawImage
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver obs)(Code)
Draw's an image onto the page, with scaling

This is not yet supported.
Parameters:
  img - The java.awt.Image
Parameters:
  dx1 - coordinate on page
Parameters:
  dy1 - coordinate on page
Parameters:
  dx2 - coordinate on page
Parameters:
  dy2 - coordinate on page
Parameters:
  sx1 - coordinate on image
Parameters:
  sy1 - coordinate on image
Parameters:
  sx2 - coordinate on image
Parameters:
  sy2 - coordinate on image
Parameters:
  bgcolor - Background colour
Parameters:
  obs - ImageObserver true if drawn




drawLine
public void drawLine(int x1, int y1, int x2, int y2)(Code)
Draws a line between two coordinates. If the first coordinate is the same as the last one drawn (ie a previous drawLine, moveto, etc) it is ignored.
Parameters:
  x1 - coord
Parameters:
  y1 - coord
Parameters:
  x2 - coord
Parameters:
  y2 - coord



drawOval
public void drawOval(int x, int y, int w, int h)(Code)

Draws an oval


Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



drawPolygon
public void drawPolygon(int[] xp, int[] yp, int np)(Code)
Draws a polygon, linking the first and last coordinates.
Parameters:
  xp - Array of x coordinates
Parameters:
  yp - Array of y coordinates
Parameters:
  np - number of points in polygon



drawPolyline
public void drawPolyline(int[] xp, int[] yp, int np)(Code)
Draws a polyline. The first and last coordinates are not linked.
Parameters:
  xp - Array of x coordinates
Parameters:
  yp - Array of y coordinates
Parameters:
  np - number of points in polyline



drawRect
public void drawRect(int x, int y, int w, int h)(Code)
We override Graphics.drawRect as it doesn't join the 4 lines. Also, PDF provides us with a Rectangle operator, so we will use that.
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



drawRoundRect
public void drawRoundRect(int x, int y, int w, int h, int aw, int ah)(Code)
This is not yet implemented
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height
Parameters:
  aw - a-width
Parameters:
  ah - a-height



drawString
public void drawString(String s, int x, int y)(Code)
This draws a string.
Parameters:
  x - coord
Parameters:
  y - coord



drawString
public void drawString(java.text.AttributedCharacterIterator aci, int x, int y)(Code)
Draws a string using a AttributedCharacterIterator.

This is not supported yet, as I have no idea what an AttributedCharacterIterator is.

This method is new to the Java2 API.




fill3DRect
public void fill3DRect(int x, int y, int width, int height, boolean raised)(Code)

Not implemented


Parameters:
  x - an int value
Parameters:
  y - an int value
Parameters:
  width - an int value
Parameters:
  height - an int value
Parameters:
  raised - a boolean value



fillArc
public void fillArc(int x, int y, int w, int h, int sa, int aa)(Code)
Fills an arc, joining the start and end coordinates
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height
Parameters:
  sa - Start angle
Parameters:
  aa - End angle



fillOval
public void fillOval(int x, int y, int w, int h)(Code)

Draws a filled oval


Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



fillPolygon
public void fillPolygon(int[] xp, int[] yp, int np)(Code)
Fills a polygon.
Parameters:
  xp - Array of x coordinates
Parameters:
  yp - Array of y coordinates
Parameters:
  np - number of points in polygon



fillRect
public void fillRect(int x, int y, int w, int h)(Code)
Fills a rectangle with the current colour
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



fillRoundRect
public void fillRoundRect(int x, int y, int w, int h, int aw, int ah)(Code)
This is not yet implemented
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height
Parameters:
  aw - a-width
Parameters:
  ah - a-height



getClip
public Shape getClip()(Code)
Returns the Shape of the clipping region As my JDK docs say, this may break with Java 2D. Shape of the clipping region



getClipBounds
public Rectangle getClipBounds()(Code)
Returns the Rectangle that fits the current clipping region the Rectangle that fits the current clipping region



getColor
public Color getColor()(Code)
Returns the current pen Colour the current pen Colour



getFont
public Font getFont()(Code)
Return's the current font. the current font.



getFontMetrics
public FontMetrics getFontMetrics(Font font)(Code)
Returns the FontMetrics for a font.

This doesn't work correctly. Perhaps having some way of mapping the base 14 fonts to our own FontMetrics implementation?
Parameters:
  font - The java.awt.Font to return the metrics for FontMetrics for a font




getPage
public PDFPage getPage()(Code)
Returns the associated PDFPage for this graphic the associated PDFPage for this graphic



getWriter
public PrintWriter getWriter()(Code)
Returns the PrintWriter handling the underlying stream the PrintWriter handling the underlying stream



init
protected void init(PDFPage page)(Code)
This is called by PDFPage when creating a Graphcis instance.
Parameters:
  page - The PDFPage to draw onto.



init
protected void init(PDFPage page, PrintWriter pw)(Code)
This method is used internally by create() and by the PDFJob class
Parameters:
  page - PDFPage to draw into
Parameters:
  pw - PrintWriter to use



lineto
public void lineto(int x, int y)(Code)
This adds a line segment to the current path
Parameters:
  x - coord
Parameters:
  y - coord



lineto
public void lineto(double x, double y)(Code)
This adds a line segment to the current path
Parameters:
  x - coord
Parameters:
  y - coord



moveto
public void moveto(int x, int y)(Code)
This moves the current drawing point.
Parameters:
  x - coord
Parameters:
  y - coord



moveto
public void moveto(double x, double y)(Code)
This moves the current drawing point.
Parameters:
  x - coord
Parameters:
  y - coord



newPath
void newPath()(Code)
Functions that draw lines should start by calling this. It starts a new path unless inStroke is set, in that case it uses the existing path



newTextBlock
void newTextBlock(int x, int y)(Code)

Functions that draw text should start by calling this. It starts a text block (accounting for media orientation) unless we are already in a Text block.

It also handles if the font has been changed since the current text block was started, so your function will be current.


Parameters:
  x - x coord in java space
Parameters:
  y - y coord in java space



polygon
public void polygon(int[] xp, int[] yp, int np)(Code)
This is used to add a polygon to the current path. Used by drawPolygon(), drawPolyline() and fillPolygon() etal
Parameters:
  xp - Array of x coordinates
Parameters:
  yp - Array of y coordinates
Parameters:
  np - number of points in polygon
See Also:   PDFGraphics.drawPolygon
See Also:   PDFGraphics.drawPolyline
See Also:   PDFGraphics.fillPolygon



setClip
public void setClip(int x, int y, int w, int h)(Code)
Clips to a set of coordinates
Parameters:
  x - coord
Parameters:
  y - coord
Parameters:
  w - width
Parameters:
  h - height



setClip
public void setClip(Shape s)(Code)
As my JDK docs say, this may break with Java 2D.

Sets the clipping region to that of a Shape.
Parameters:
  s - Shape to clip to.




setColor
public void setColor(Color c)(Code)
Sets the colour for drawing
Parameters:
  c - Color to use



setDefaultLineWidth
public void setDefaultLineWidth()(Code)
This extension sets the line width to the default of 1mm which is what Java uses when drawing to a PrintJob.



setFont
public void setFont(Font f)(Code)
This sets the font.
Parameters:
  f - java.awt.Font to set to.



setLineWidth
public void setLineWidth(double w)(Code)
This extension allows the width of the drawn line to be set
Parameters:
  w - Line width in mm



setOrientation
public void setOrientation()(Code)
This sets the media Orientation (0=Portrait, 90=Landscape, 180=Inverse, 270=Seascape).

Normally, this is called when the Graphics instance is created, but if the media is changed, then this must be called, especially when using the PDFJob class to create the file.




setPaintMode
public void setPaintMode()(Code)
Not implemented, as this is not supported in the PDF specification.



setXORMode
public void setXORMode(Color c1)(Code)
Not implemented, as this is not supported in the PDF specification.
Parameters:
  c1 - Color to xor with



translate
public void translate(int x, int y)(Code)
Translate the origin.
Parameters:
  x - coord offset
Parameters:
  y - coord offset



Methods inherited from java.awt.Graphics
abstract public void clearRect(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void clipRect(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void copyArea(int x, int y, int width, int height, int dx, int dy)(Code)(Java Doc)
abstract public Graphics create()(Code)(Java Doc)
public Graphics create(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void dispose()(Code)(Java Doc)
public void draw3DRect(int x, int y, int width, int height, boolean raised)(Code)(Java Doc)
abstract public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)(Code)(Java Doc)
public void drawBytes(byte data, int offset, int length, int x, int y)(Code)(Java Doc)
public void drawChars(char data, int offset, int length, int x, int y)(Code)(Java Doc)
abstract public boolean drawImage(Image img, int x, int y, ImageObserver observer)(Code)(Java Doc)
abstract public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)(Code)(Java Doc)
abstract public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)(Code)(Java Doc)
abstract public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)(Code)(Java Doc)
abstract public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)(Code)(Java Doc)
abstract public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)(Code)(Java Doc)
abstract public void drawLine(int x1, int y1, int x2, int y2)(Code)(Java Doc)
abstract public void drawOval(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void drawPolygon(int xPoints, int yPoints, int nPoints)(Code)(Java Doc)
public void drawPolygon(Polygon p)(Code)(Java Doc)
abstract public void drawPolyline(int xPoints, int yPoints, int nPoints)(Code)(Java Doc)
public void drawRect(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code)(Java Doc)
abstract public void drawString(String str, int x, int y)(Code)(Java Doc)
abstract public void drawString(AttributedCharacterIterator iterator, int x, int y)(Code)(Java Doc)
public void fill3DRect(int x, int y, int width, int height, boolean raised)(Code)(Java Doc)
abstract public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)(Code)(Java Doc)
abstract public void fillOval(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void fillPolygon(int xPoints, int yPoints, int nPoints)(Code)(Java Doc)
public void fillPolygon(Polygon p)(Code)(Java Doc)
abstract public void fillRect(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code)(Java Doc)
public void finalize()(Code)(Java Doc)
abstract public Shape getClip()(Code)(Java Doc)
abstract public Rectangle getClipBounds()(Code)(Java Doc)
public Rectangle getClipBounds(Rectangle r)(Code)(Java Doc)
public Rectangle getClipRect()(Code)(Java Doc)
abstract public Color getColor()(Code)(Java Doc)
abstract public Font getFont()(Code)(Java Doc)
public FontMetrics getFontMetrics()(Code)(Java Doc)
abstract public FontMetrics getFontMetrics(Font f)(Code)(Java Doc)
public boolean hitClip(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void setClip(int x, int y, int width, int height)(Code)(Java Doc)
abstract public void setClip(Shape clip)(Code)(Java Doc)
abstract public void setColor(Color c)(Code)(Java Doc)
abstract public void setFont(Font font)(Code)(Java Doc)
abstract public void setPaintMode()(Code)(Java Doc)
abstract public void setXORMode(Color c1)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
abstract public void translate(int x, int y)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.