org.apache.xmlgraphics.ps
public class PSGenerator extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.Object |
ATEND
Deprecated.
Please use DSCConstants.ATEND. This constant was in the wrong place.
|
static int |
DEFAULT_LANGUAGE_LEVEL
Default postscript language level
|
static char |
LF
Line feed used by PostScript
|
| Constructor and Description |
|---|
PSGenerator(java.io.OutputStream out)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
commentln(java.lang.String comment)
Writes a comment to the stream and ends the line.
|
void |
concatMatrix(java.awt.geom.AffineTransform at)
Concats the transformations matric.
|
void |
concatMatrix(double[] matrix)
Concats the transformations matrix.
|
void |
concatMatrix(double a,
double b,
double c,
double d,
double e,
double f)
Concats the transformation matrix.
|
static java.lang.String |
convertRealToDSC(float value)
Converts a
|
static java.lang.String |
convertStringToDSC(java.lang.String text)
Converts text by applying escaping rules established in the DSC specs.
|
static java.lang.String |
convertStringToDSC(java.lang.String text,
boolean forceParentheses)
Converts text by applying escaping rules established in the DSC specs.
|
void |
defineRect(double x,
double y,
double w,
double h)
Adds a rectangle to the current path.
|
static void |
escapeChar(char c,
java.lang.StringBuffer target)
Escapes a character conforming to the rules established in the PostScript
Language Reference (Search for "Literal Text Strings").
|
void |
flush()
Flushes the OutputStream.
|
java.lang.String |
formatDouble(double value)
Formats a double value for PostScript output.
|
java.lang.String |
formatDouble5(double value)
Formats a double value for PostScript output (higher resolution).
|
java.lang.String |
formatMatrix(java.awt.geom.AffineTransform at)
Formats a transformation matrix.
|
java.lang.String |
formatRectangleToArray(java.awt.geom.Rectangle2D rect)
Formats a Rectangle2D to an array.
|
PSState |
getCurrentState()
Returns the current graphics state.
|
java.io.OutputStream |
getOutputStream()
Returns the OutputStream the PSGenerator writes to.
|
int |
getPSLevel()
Returns the selected PostScript level.
|
ResourceTracker |
getResourceTracker()
Resturns the ResourceTracker instance associated with this PSGenerator.
|
boolean |
isResourceSupplied(PSResource res)
Deprecated.
Use the isResourceSupplied() on ResourceTracker instead.
|
void |
newLine()
Writes a newline character to the OutputStream.
|
void |
notifyResourceUsage(PSResource res,
boolean needed)
Deprecated.
Use the notifyResourceUsageOnPage() on ResourceTracker instead
|
void |
notifyStartNewPage()
Deprecated.
Use the notifyStartNewPage() on ResourceTracker instead.
|
javax.xml.transform.Source |
resolveURI(java.lang.String uri)
Attempts to resolve the given URI.
|
boolean |
restoreGraphicsState()
Restores the last graphics state of the rendering engine.
|
void |
saveGraphicsState()
Saves the graphics state of the rendering engine.
|
void |
setPSLevel(int level)
Sets the PostScript level that is used to generate the current document.
|
void |
setResourceTracker(ResourceTracker resTracker)
Sets the ResourceTracker instance to be associated with this PSGenerator.
|
void |
useColor(java.awt.Color col)
Establishes the specified color.
|
void |
useDash(java.lang.String pattern)
Establishes the specified dash pattern.
|
void |
useFont(java.lang.String name,
float size)
Establishes the specified font and size.
|
void |
useLineCap(int linecap)
Establishes the specified line cap style.
|
void |
useLineWidth(double width)
Establishes the specified line width.
|
void |
useRGBColor(java.awt.Color col)
Deprecated.
use useColor method instead
|
void |
write(java.lang.String cmd)
Writes a PostScript command to the stream.
|
void |
writeByteArr(byte[] cmd)
Writes encoded data to the PostScript stream.
|
void |
writeDSCComment(java.lang.String name)
Writes a DSC comment to the output stream.
|
void |
writeDSCComment(java.lang.String name,
java.lang.Object param)
Writes a DSC comment to the output stream.
|
void |
writeDSCComment(java.lang.String name,
java.lang.Object[] params)
Writes a DSC comment to the output stream.
|
void |
writeln(java.lang.String cmd)
Writes a PostScript command to the stream and ends the line.
|
void |
writeResources(boolean pageLevel)
Deprecated.
Use the writeResources() on ResourceTracker instead.
|
public static final int DEFAULT_LANGUAGE_LEVEL
public static final java.lang.Object ATEND
public static final char LF
public PSGenerator(java.io.OutputStream out)
out - the OutputStream to write the generated PostScript code topublic java.io.OutputStream getOutputStream()
public int getPSLevel()
public void setPSLevel(int level)
level - the PostScript level (currently 1, 2 and 3 are known)public javax.xml.transform.Source resolveURI(java.lang.String uri)
uri - URI to accessSource object, or null if the URI
cannot be resolved.public final void newLine()
throws java.io.IOException
java.io.IOException - In case of an I/O problempublic java.lang.String formatDouble(double value)
value - value to formatpublic java.lang.String formatDouble5(double value)
value - value to formatpublic void write(java.lang.String cmd)
throws java.io.IOException
cmd - The PostScript code to be written.java.io.IOException - In case of an I/O problempublic void writeln(java.lang.String cmd)
throws java.io.IOException
cmd - The PostScript code to be written.java.io.IOException - In case of an I/O problempublic void commentln(java.lang.String comment)
throws java.io.IOException
comment - comment to writejava.io.IOException - In case of an I/O problempublic void writeByteArr(byte[] cmd)
throws java.io.IOException
cmd - The encoded PostScript code to be written.java.io.IOException - In case of an I/O problempublic void flush()
throws java.io.IOException
java.io.IOException - In case of an I/O problempublic static final void escapeChar(char c,
java.lang.StringBuffer target)
c - character to escapetarget - target StringBuffer to write the escaped character topublic static final java.lang.String convertStringToDSC(java.lang.String text)
text - Text to convertpublic static final java.lang.String convertRealToDSC(float value)
value - the value to convertpublic static final java.lang.String convertStringToDSC(java.lang.String text,
boolean forceParentheses)
text - Text to convertforceParentheses - Force the use of parenthesespublic void writeDSCComment(java.lang.String name)
throws java.io.IOException
name - Name of the DSC commentjava.io.IOException - In case of an I/O problemDSCConstantspublic void writeDSCComment(java.lang.String name,
java.lang.Object param)
throws java.io.IOException
name - Name of the DSC commentparam - Single parameter to the DSC commentjava.io.IOException - In case of an I/O problemDSCConstantspublic void writeDSCComment(java.lang.String name,
java.lang.Object[] params)
throws java.io.IOException
name - Name of the DSC commentparams - Array of parameters to the DSC commentjava.io.IOException - In case of an I/O problemDSCConstantspublic void saveGraphicsState()
throws java.io.IOException
java.io.IOException - In case of an I/O problempublic boolean restoreGraphicsState()
throws java.io.IOException
java.io.IOException - In case of an I/O problempublic PSState getCurrentState()
public void concatMatrix(double a,
double b,
double c,
double d,
double e,
double f)
throws java.io.IOException
a - A partb - B partc - C partd - D parte - E partf - F partjava.io.IOException - In case of an I/O problempublic void concatMatrix(double[] matrix)
throws java.io.IOException
matrix - Matrix to usejava.io.IOException - In case of an I/O problempublic java.lang.String formatMatrix(java.awt.geom.AffineTransform at)
at - the AffineTransform with the matrixpublic void concatMatrix(java.awt.geom.AffineTransform at)
throws java.io.IOException
at - the AffineTransform whose matrix to usejava.io.IOException - In case of an I/O problempublic java.lang.String formatRectangleToArray(java.awt.geom.Rectangle2D rect)
rect - the rectanglepublic void defineRect(double x,
double y,
double w,
double h)
throws java.io.IOException
x - upper left cornery - upper left cornerw - widthh - heightjava.io.IOException - In case of an I/O problempublic void useLineCap(int linecap)
throws java.io.IOException
linecap - the line cap style (0, 1 or 2) as defined by the setlinecap command.java.io.IOException - In case of an I/O problempublic void useLineWidth(double width)
throws java.io.IOException
width - the line width as defined by the setlinewidth command.java.io.IOException - In case of an I/O problempublic void useDash(java.lang.String pattern)
throws java.io.IOException
pattern - the dash pattern as defined by the setdash command.java.io.IOException - In case of an I/O problempublic void useRGBColor(java.awt.Color col)
throws java.io.IOException
col - the color as defined by the setrgbcolor command.java.io.IOException - In case of an I/O problempublic void useColor(java.awt.Color col)
throws java.io.IOException
col - the color.java.io.IOException - In case of an I/O problempublic void useFont(java.lang.String name,
float size)
throws java.io.IOException
name - name of the font for the "F" command (see FOP Std Proc Set)size - size of the fontjava.io.IOException - In case of an I/O problempublic ResourceTracker getResourceTracker()
public void setResourceTracker(ResourceTracker resTracker)
resTracker - the ResourceTracker instancepublic void notifyStartNewPage()
public void notifyResourceUsage(PSResource res, boolean needed)
res - the resource being usedneeded - true if this is a needed resource, false for a supplied resourcepublic void writeResources(boolean pageLevel)
throws java.io.IOException
pageLevel - true if the DSC comment for the page level should be generated,
false for the document level (in the trailer)java.io.IOException - In case of an I/O problempublic boolean isResourceSupplied(PSResource res)
res - the resourceCopyright 1999-2008 The Apache Software Foundation. All Rights Reserved.