|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph.output.Output
org.faceless.graph.output.PDFOutput
public class PDFOutput
This class renders the graph to a PDF document defined using version 1.2 or earlier
of the Big Faceless PDF library. The latest version of this library is version 2, so
class should only be used by those that already own an older version of the PDF library.
See PDF2Output
for a class that works with latest version.
Constructor Summary | |
---|---|
PDFOutput(PDFPage p,
float left,
float top,
float right,
float bottom)
Create a new PDFOutput class to render the graph to the specified page. |
Method Summary | |
---|---|
boolean |
canPattern()
Return true if this subclass out Output can handle pattern fills. |
boolean |
canRotate()
Returns true if this subclass can handle rotated text (it can, so it does) |
BoundingBox |
getCanvas()
Return the canvas as a BoundingBox . |
Graph |
getGraph()
Return the graph being rendered. |
BoundingBox |
getTextBox(String text,
Style s)
Return the bounding box for given string in the specified style. |
void |
line(double x1,
double y1,
double x2,
double y2)
Draw a line from x1,y1 to x2,y2 on the canvas, in the current colour |
void |
poly(String name,
double[] x,
double[] y,
int num)
Draw and fill a polygon on the canvas, in the current colour. |
void |
render(Graph gr)
Render the Graph to this Output object. |
void |
setColor(Paint s)
Set the current pen, font and fill colour |
void |
setFontMap(String name,
int style,
PDFFont font)
Define a custom font for use with this output class. |
void |
setLineDash(double on,
double off,
double phase)
Set the line dash pattern |
void |
setLineThickness(double thickness)
Set the line thickness (1 being default, 2 twice as thick, etc.) on platforms that support it. |
void |
text(String text,
double x,
double y,
Style s)
Draw a line of text at the specified position in the specified style. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PDFOutput(PDFPage p, float left, float top, float right, float bottom)
Create a new PDFOutput class to render the graph to the specified page. This class assumes that the page has the default canvas settings - i.e. it's measured in points from the bottom left of the page.
p
- a PDFpage
object measured in points from the bottom-leftleft
- the left margin of the graph, in points from the left of the pagebottom
- the bottom margin of the graph, in points from the bottom of the pagewidth
- the width of the graph in pointsheight
- the height of the graph in pointsMethod Detail |
---|
public final boolean canRotate()
canRotate
in class Output
public final boolean canPattern()
Output
canPattern
in class Output
public void render(Graph gr)
Output
render
in class Output
public Graph getGraph()
Output
getGraph
in class Output
public BoundingBox getCanvas()
Output
BoundingBox
. The final graph
will be sized to fit this box.
getCanvas
in class Output
public void setLineThickness(double thickness)
Output
setLineThickness
in class Output
public void setLineDash(double on, double off, double phase)
Output
setLineDash
in class Output
public void setColor(Paint s)
Output
setColor
in class Output
public void line(double x1, double y1, double x2, double y2)
Output
line
in class Output
public void poly(String name, double[] x, double[] y, int num)
Output
poly
in class Output
name
- The name of the dataset that is being drawn. Not
used in the current release, but will eventually be user for
interaction with rendered graphsx
- the array of X co-ordinatesy
- the array of Y co-ordinatesnum
- the number of co-ordinates in the arraypublic void setFontMap(String name, int style, PDFFont font)
setFontMap("myfont", java.awt.Font.PLAIN, new TrueTypeFont("myfont.ttf"));
public BoundingBox getTextBox(String text, Style s)
Output
getTextBox
in class Output
text
- The string to return the size for.s
- The style to apply to the text before returning it's size.
The aspects of the style that may affect this include font, rotation
and alignmentpublic void text(String text, double x, double y, Style s)
Output
text
in class Output
text
- The line of text to draw.x
- The x position to place the text at, measured from the
left of the canvas.y
- The y position to place the text at, measured from the
bottom of the canvas.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |