|
xmlgraphics-commons 2.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.xmlgraphics.ps.PSGenerator
public class PSGenerator
This class is used to output PostScript code to an OutputStream. This class assumes that
the PSProcSets.STD_PROCSET has been added to the PostScript file.
| Field Summary | |
|---|---|
static 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 Summary | |
|---|---|
PSGenerator(OutputStream out)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
commentln(String comment)
Writes a comment to the stream and ends the line. |
void |
concatMatrix(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 String |
convertRealToDSC(float value)
Converts a <real> value for use in DSC comments. |
static String |
convertStringToDSC(String text)
Converts text by applying escaping rules established in the DSC specs. |
static String |
convertStringToDSC(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. |
boolean |
embedIdentityH()
Embeds the Identity-H CMap file into the output stream, if that has not already been done. |
static void |
escapeChar(char c,
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. |
String |
formatDouble(double value)
Formats a double value for PostScript output. |
String |
formatDouble5(double value)
Formats a double value for PostScript output (higher resolution). |
String |
formatMatrix(AffineTransform at)
Formats a transformation matrix. |
String |
formatRectangleToArray(Rectangle2D rect)
Formats a Rectangle2D to an array. |
PSState |
getCurrentState()
Returns the current graphics state. |
PSResource |
getIdentityHCMapResource()
Returns the PSResource instance corresponding to the Identity-H CMap resource. |
OutputStream |
getOutputStream()
Returns the OutputStream the PSGenerator writes to. |
PSResource |
getProcsetCIDInitResource()
Returns the PSResource instance corresponding to the CIDInit ProcSet resource. |
int |
getPSLevel()
Returns the selected PostScript level. |
ResourceTracker |
getResourceTracker()
Resturns the ResourceTracker instance associated with this PSGenerator. |
void |
includeProcsetCIDInitResource()
Adds a PostScript DSC comment to the output stream requiring the inclusion of the CIDInit ProcSet resource. |
boolean |
isCommentsEnabled()
Indicates whether this instance allows to write comments. |
boolean |
isCompactMode()
Indicates whether this instance is in compact mode. |
boolean |
isResourceSupplied(PSResource res)
Deprecated. Use the isResourceSupplied() on ResourceTracker instead. |
String |
mapCommand(String command)
Maps a standard PostScript command (like "setlinejoin" or "setrgbcolor") to a macro. |
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. |
Source |
resolveURI(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 |
setCommentsEnabled(boolean value)
Controls whether this instance allows to write comments using the commentln(String)
method. |
void |
setCompactMode(boolean value)
Controls whether this instance shall produce compact PostScript (omitting comments and using short macros). |
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 |
showPage()
Issues the "showpage" command and resets the painting state accordingly. |
void |
useColor(Color col)
Establishes the specified color. |
void |
useDash(String pattern)
Establishes the specified dash pattern. |
void |
useFont(String name,
float size)
Establishes the specified font and size. |
void |
useLineCap(int linecap)
Establishes the specified line cap style. |
void |
useLineJoin(int linejoin)
Establishes the specified line join style. |
void |
useLineWidth(double width)
Establishes the specified line width. |
void |
useMiterLimit(float miterlimit)
Establishes the specified miter limit. |
void |
useRGBColor(Color col)
Deprecated. use useColor method instead |
void |
write(int n)
Writes the given number to the stream in decimal format. |
void |
write(String cmd)
Writes a PostScript command to the stream. |
void |
writeByteArr(byte[] cmd)
Writes encoded data to the PostScript stream. |
void |
writeDSCComment(String name)
Writes a DSC comment to the output stream. |
void |
writeDSCComment(String name,
Object param)
Writes a DSC comment to the output stream. |
void |
writeDSCComment(String name,
Object[] params)
Writes a DSC comment to the output stream. |
void |
writeln(String cmd)
Writes a PostScript command to the stream and ends the line. |
void |
writeResources(boolean pageLevel)
Deprecated. Use the writeResources() on ResourceTracker instead. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_LANGUAGE_LEVEL
@Deprecated public static final Object ATEND
public static final char LF
| Constructor Detail |
|---|
public PSGenerator(OutputStream out)
out - the OutputStream to write the generated PostScript code to| Method Detail |
|---|
public boolean isCompactMode()
setCompactMode(boolean)
for details.
public void setCompactMode(boolean value)
PSProcSets.STD_PROCSET) is included in the PostScript file. Setting this to
false produces more verbose PostScript suitable for debugging.
value - true to enable compact mode, false for verbose modepublic boolean isCommentsEnabled()
setCommentsEnabled(boolean) for details.
public void setCommentsEnabled(boolean value)
commentln(String)
method.
value - true to enable comments, false to disable thempublic OutputStream getOutputStream()
public int getPSLevel()
public void setPSLevel(int level)
level - the PostScript level (currently 1, 2 and 3 are known)public Source resolveURI(String uri)
uri - URI to access
Source object, or null if the URI
cannot be resolved.
public final void newLine()
throws IOException
IOException - In case of an I/O problempublic String formatDouble(double value)
value - value to format
public String formatDouble5(double value)
value - value to format
public void write(String cmd)
throws IOException
cmd - The PostScript code to be written.
IOException - In case of an I/O problem
public void write(int n)
throws IOException
n - a number
IOException - in case of an I/O problem
public void writeln(String cmd)
throws IOException
cmd - The PostScript code to be written.
IOException - In case of an I/O problem
public void commentln(String comment)
throws IOException
comment - comment to write
IOException - In case of an I/O problempublic String mapCommand(String command)
mapCommand in interface PSCommandMapcommand - the command
public void writeByteArr(byte[] cmd)
throws IOException
cmd - The encoded PostScript code to be written.
IOException - In case of an I/O problem
public void flush()
throws IOException
IOException - In case of an I/O problem
public static final void escapeChar(char c,
StringBuffer target)
c - character to escapetarget - target StringBuffer to write the escaped character topublic static final String convertStringToDSC(String text)
text - Text to convert
public static final String convertRealToDSC(float value)
value - the value to convert
public static final String convertStringToDSC(String text,
boolean forceParentheses)
text - Text to convertforceParentheses - Force the use of parentheses
public void writeDSCComment(String name)
throws IOException
name - Name of the DSC comment
IOException - In case of an I/O problemDSCConstants
public void writeDSCComment(String name,
Object param)
throws IOException
name - Name of the DSC commentparam - Single parameter to the DSC comment
IOException - In case of an I/O problemDSCConstants
public void writeDSCComment(String name,
Object[] params)
throws IOException
name - Name of the DSC commentparams - Array of parameters to the DSC comment
IOException - In case of an I/O problemDSCConstants
public void saveGraphicsState()
throws IOException
IOException - In case of an I/O problem
public boolean restoreGraphicsState()
throws IOException
IOException - In case of an I/O problempublic PSState getCurrentState()
public void showPage()
throws IOException
IOException - In case of an I/O problem
public void concatMatrix(double a,
double b,
double c,
double d,
double e,
double f)
throws IOException
a - A partb - B partc - C partd - D parte - E partf - F part
IOException - In case of an I/O problem
public void concatMatrix(double[] matrix)
throws IOException
matrix - Matrix to use
IOException - In case of an I/O problempublic String formatMatrix(AffineTransform at)
at - the AffineTransform with the matrix
public void concatMatrix(AffineTransform at)
throws IOException
at - the AffineTransform whose matrix to use
IOException - In case of an I/O problempublic String formatRectangleToArray(Rectangle2D rect)
rect - the rectangle
public void defineRect(double x,
double y,
double w,
double h)
throws IOException
x - upper left cornery - upper left cornerw - widthh - height
IOException - In case of an I/O problem
public void useLineCap(int linecap)
throws IOException
linecap - the line cap style (0, 1 or 2) as defined by the setlinecap command.
IOException - In case of an I/O problem
public void useLineJoin(int linejoin)
throws IOException
linejoin - the line join style (0, 1 or 2) as defined by the setlinejoin command.
IOException - In case of an I/O problem
public void useMiterLimit(float miterlimit)
throws IOException
miterlimit - the miter limit as defined by the setmiterlimit command.
IOException - In case of an I/O problem
public void useLineWidth(double width)
throws IOException
width - the line width as defined by the setlinewidth command.
IOException - In case of an I/O problem
public void useDash(String pattern)
throws IOException
pattern - the dash pattern as defined by the setdash command.
IOException - In case of an I/O problem
@Deprecated
public void useRGBColor(Color col)
throws IOException
col - the color as defined by the setrgbcolor command.
IOException - In case of an I/O problem
public void useColor(Color col)
throws IOException
col - the color.
IOException - In case of an I/O problem
public void useFont(String name,
float size)
throws IOException
name - name of the font for the "F" command (see FOP Std Proc Set)size - size of the font
IOException - In case of an I/O problempublic ResourceTracker getResourceTracker()
public void setResourceTracker(ResourceTracker resTracker)
resTracker - the ResourceTracker instance@Deprecated public void notifyStartNewPage()
@Deprecated
public void notifyResourceUsage(PSResource res,
boolean needed)
res - the resource being usedneeded - true if this is a needed resource, false for a supplied resource
@Deprecated
public void writeResources(boolean pageLevel)
throws IOException
pageLevel - true if the DSC comment for the page level should be generated,
false for the document level (in the trailer)
IOException - In case of an I/O problem@Deprecated public boolean isResourceSupplied(PSResource res)
res - the resource
public boolean embedIdentityH()
throws IOException
IOException - in case of an I/O problempublic PSResource getIdentityHCMapResource()
public PSResource getProcsetCIDInitResource()
public void includeProcsetCIDInitResource()
throws IOException
IOException - in case of an I/O problem
|
xmlgraphics-commons 2.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||