Java Doc for EscherGraphics.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hssf » usermodel » 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 » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hssf.usermodel 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.Graphics
      org.apache.poi.hssf.usermodel.EscherGraphics

EscherGraphics
public class EscherGraphics extends Graphics (Code)
Translates Graphics calls into escher calls. The translation is lossy so many features are not supported and some just aren't implemented yet. If in doubt test the specific calls you wish to make. Graphics calls are always performed into an EscherGroup so one will need to be created.

Important:

One important concept worth considering is that of font size. One of the difficulties in converting Graphics calls into escher drawing calls is that Excel does not have the concept of absolute pixel positions. It measures it's cell widths in 'characters' and the cell heights in points. Unfortunately it's not defined exactly what a type of character it's measuring. Presumably this is due to the fact that the Excel will be using different fonts on different platforms or even within the same platform.

Because of this constraint we've had to calculate the verticalPointsPerPixel. This the amount the font should be scaled by when you issue commands such as drawString(). A good way to calculate this is to use the follow formula:

 multipler = groupHeightInPoints / heightOfGroup
 

The height of the group is calculated fairly simply by calculating the difference between the y coordinates of the bounding box of the shape. The height of the group can be calculated by using a convenience called HSSFClientAnchor.getAnchorHeightInPoints().


author:
   Glen Stampoultzis (glens at apache.org)



Constructor Summary
public  EscherGraphics(HSSFShapeGroup escherGroup, HSSFWorkbook workbook, Color forecolor, float verticalPointsPerPixel)
     Construct an escher graphics object.
Parameters:
  escherGroup - The escher group to write the graphics calls into.
Parameters:
  workbook - The workbook we are using.
Parameters:
  forecolor - The foreground color to use as default.
Parameters:
  verticalPointsPerPixel - The font multiplier.
 EscherGraphics(HSSFShapeGroup escherGroup, HSSFWorkbook workbook, Color foreground, Font font, float verticalPointsPerPixel)
     Constructs an escher graphics object.
Parameters:
  escherGroup - The escher group to write the graphics calls into.
Parameters:
  workbook - The workbook we are using.
Parameters:
  foreground - The foreground color to use as default.
Parameters:
  verticalPointsPerPixel - The font multiplier.

Method Summary
public  voidclearRect(int x, int y, int width, int height)
    
public  voidclipRect(int x, int y, int width, int height)
    
public  voidcopyArea(int x, int y, int width, int height, int dx, int dy)
    
public  Graphicscreate()
    
public  voiddispose()
    
public  voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
    
public  booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
    
public  booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
    
public  booleandrawImage(Image image, int i, int j, int k, int l, Color color, ImageObserver imageobserver)
    
public  booleandrawImage(Image image, int i, int j, int k, int l, ImageObserver imageobserver)
    
public  booleandrawImage(Image image, int i, int j, Color color, ImageObserver imageobserver)
    
public  booleandrawImage(Image image, int i, int j, ImageObserver imageobserver)
    
public  voiddrawLine(int x1, int y1, int x2, int y2)
    
public  voiddrawLine(int x1, int y1, int x2, int y2, int width)
    
public  voiddrawOval(int x, int y, int width, int height)
    
public  voiddrawPolygon(int xPoints, int yPoints, int nPoints)
    
public  voiddrawPolyline(int xPoints, int yPoints, int nPoints)
    
public  voiddrawRect(int x, int y, int width, int height)
    
public  voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
    
public  voiddrawString(String str, int x, int y)
    
public  voiddrawString(AttributedCharacterIterator iterator, int x, int y)
    
public  voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
    
public  voidfillOval(int x, int y, int width, int height)
    
public  voidfillPolygon(int xPoints, int yPoints, int nPoints)
     Fills a (closed) polygon, as defined by a pair of arrays, which hold the x and y coordinates.
public  voidfillRect(int x, int y, int width, int height)
    
public  voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
    
public  ColorgetBackground()
    
public  ShapegetClip()
    
public  RectanglegetClipBounds()
    
public  RectanglegetClipRect()
    
public  ColorgetColor()
    
 HSSFShapeGroupgetEscherGraphics()
    
public  FontgetFont()
    
public  FontMetricsgetFontMetrics(Font f)
    
public  voidsetBackground(Color background)
    
public  voidsetClip(int x, int y, int width, int height)
    
public  voidsetClip(Shape shape)
    
public  voidsetColor(Color color)
    
public  voidsetFont(Font f)
    
public  voidsetPaintMode()
    
public  voidsetXORMode(Color color)
    
public  voidtranslate(int x, int y)
    


Constructor Detail
EscherGraphics
public EscherGraphics(HSSFShapeGroup escherGroup, HSSFWorkbook workbook, Color forecolor, float verticalPointsPerPixel)(Code)
Construct an escher graphics object.
Parameters:
  escherGroup - The escher group to write the graphics calls into.
Parameters:
  workbook - The workbook we are using.
Parameters:
  forecolor - The foreground color to use as default.
Parameters:
  verticalPointsPerPixel - The font multiplier. (See class description for information on how this works.).



EscherGraphics
EscherGraphics(HSSFShapeGroup escherGroup, HSSFWorkbook workbook, Color foreground, Font font, float verticalPointsPerPixel)(Code)
Constructs an escher graphics object.
Parameters:
  escherGroup - The escher group to write the graphics calls into.
Parameters:
  workbook - The workbook we are using.
Parameters:
  foreground - The foreground color to use as default.
Parameters:
  verticalPointsPerPixel - The font multiplier. (See class description for information on how this works.).
Parameters:
  font - The font to use.




Method Detail
clearRect
public void clearRect(int x, int y, int width, int height)(Code)



clipRect
public void clipRect(int x, int y, int width, int height)(Code)



copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)(Code)



create
public Graphics create()(Code)



dispose
public void dispose()(Code)



drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)(Code)



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 observer)(Code)



drawImage
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)(Code)



drawImage
public boolean drawImage(Image image, int i, int j, int k, int l, Color color, ImageObserver imageobserver)(Code)



drawImage
public boolean drawImage(Image image, int i, int j, int k, int l, ImageObserver imageobserver)(Code)



drawImage
public boolean drawImage(Image image, int i, int j, Color color, ImageObserver imageobserver)(Code)



drawImage
public boolean drawImage(Image image, int i, int j, ImageObserver imageobserver)(Code)



drawLine
public void drawLine(int x1, int y1, int x2, int y2)(Code)



drawLine
public void drawLine(int x1, int y1, int x2, int y2, int width)(Code)



drawOval
public void drawOval(int x, int y, int width, int height)(Code)



drawPolygon
public void drawPolygon(int xPoints, int yPoints, int nPoints)(Code)



drawPolyline
public void drawPolyline(int xPoints, int yPoints, int nPoints)(Code)



drawRect
public void drawRect(int x, int y, int width, int height)(Code)



drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code)



drawString
public void drawString(String str, int x, int y)(Code)



drawString
public void drawString(AttributedCharacterIterator iterator, int x, int y)(Code)



fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)(Code)



fillOval
public void fillOval(int x, int y, int width, int height)(Code)



fillPolygon
public void fillPolygon(int xPoints, int yPoints, int nPoints)(Code)
Fills a (closed) polygon, as defined by a pair of arrays, which hold the x and y coordinates.

This draws the polygon, with nPoint line segments. The first nPoint - 1 line segments are drawn between sequential points (xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]). The final line segment is a closing one, from the last point to the first (assuming they are different).

The area inside of the polygon is defined by using an even-odd fill rule (also known as the alternating rule), and the area inside of it is filled.
Parameters:
  xPoints - array of the x coordinates.
Parameters:
  yPoints - array of the y coordinates.
Parameters:
  nPoints - the total number of points in the polygon.
See Also:   java.awt.Graphics.drawPolygon(int[]int[]int)




fillRect
public void fillRect(int x, int y, int width, int height)(Code)



fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)(Code)



getBackground
public Color getBackground()(Code)



getClip
public Shape getClip()(Code)



getClipBounds
public Rectangle getClipBounds()(Code)



getClipRect
public Rectangle getClipRect()(Code)



getColor
public Color getColor()(Code)



getEscherGraphics
HSSFShapeGroup getEscherGraphics()(Code)



getFont
public Font getFont()(Code)



getFontMetrics
public FontMetrics getFontMetrics(Font f)(Code)



setBackground
public void setBackground(Color background)(Code)



setClip
public void setClip(int x, int y, int width, int height)(Code)



setClip
public void setClip(Shape shape)(Code)



setColor
public void setColor(Color color)(Code)



setFont
public void setFont(Font f)(Code)



setPaintMode
public void setPaintMode()(Code)



setXORMode
public void setXORMode(Color color)(Code)



translate
public void translate(int x, int y)(Code)



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.