All Packages Class Hierarchy This Package Previous Next Index
Class BrainWave.PostScript
java.lang.Object
|
+----BrainWave.PostScript
- public class PostScript
- extends Object
A static class that produces Strings of PostScript interpretable text.
- Version:
- 0.9.1
This revision fixes a bug for encapsulated PostScript AND changes EPS so that there is no "scaling" to an A4 page.
0.9
Provides a system for generating PostScript from java.awt.Graphics style methods. Calling these static methods returns a String containing the PostScript required to display that graphics primitive. By concatenating a series of these strings for different graphics routines, objects drawn on the screen may be converted to PostScript.
- Author:
- Raymond Smith

A4
- The printing area of A4.
BW
- Black and White printing option if true, ignore setcolor and print all colours as black.
CurrB
- Current Color (RGB) - blue component.
CurrFont
- Current font.
CurrG
- Current Color (RGB) - green component.
CurrR
- Current Color (RGB) - red component.
DefaultFont
- Default font.
DefaultFontName
- Default font name.
DefaultFontPoint
- Default font point size.
Letter
- The printing area of Letter.
Xscale
- X scaling factor used to map screen positions to PostScript points.
Yscale
- Y scaling factor used to map screen positions to PostScript points.

PostScript()

drawLine(int, int, int, int)
- Draw a line from (x1,y1) to (x2,y2).
drawRect(int, int, int, int)
- Draw an outline of a rectangle with left corner (x,y) and dimensions w * h.
drawRect(String, String, String, String)
- Same as the above, but takes coordinates and dimensions as Strings of PostScript (which may be String representing of numbers).
drawString(String, int, int)
- write the String str to the PostScript page.
drawString(String, String, String)
- write String str to PostScript page.
fillRect(int, int, int, int)
- Draw a filled rectangle with left corner (x,y) and dimensions w * h.
fillRect(String, String, String, String)
insertComment(String)
- Add a single line comment.
postAmble(boolean)
- Trailing information to complete a PostScript document.
preAmble(boolean)
- Provided for compatibility with previous versions - orienation is assumed to be portrait.
preAmble(boolean, boolean)
- Provided for compatibility with previous versions - no paper size is selected.
preAmble(boolean, boolean, Paper, int, int)
- Pre-amble information for a minimally conforming PostScript document.
setColor(Color)
- Set the PostScript colour to c.
setColor(int, int, int)
- Set a colour with RGB settings r, g, b modulo 255.
setFont(Font)
- Set the PostScript font to fnt if fnt is TimesRoman, Courier, or Helvetica, or Symbol.
setFont(Graphics, Font)
- Set the PostScript font to fnt, scaling point size.
stringWidth(Graphics, Font, String)
whichFont(Font)
- Return a PostScript font name for fnt.

A4
public static Paper A4
- The printing area of A4. The length and width given here are slightly smaller than the physical dimensions to allow for margins (printers will not print over a whole page).
Letter
public static Paper Letter
- The printing area of Letter. The length and width given here are slightly smaller than the physical dimensions to allow for margins (printers will not print over a whole page).
Yscale
protected static double Yscale
- Y scaling factor used to map screen positions to PostScript points.
Xscale
protected static double Xscale
- X scaling factor used to map screen positions to PostScript points.
DefaultFontName
protected static String DefaultFontName
- Default font name.
DefaultFontPoint
protected static int DefaultFontPoint
- Default font point size.
DefaultFont
protected static Font DefaultFont
- Default font.
CurrFont
protected static Font CurrFont
- Current font.
CurrR
protected static int CurrR
- Current Color (RGB) - red component.
CurrG
protected static int CurrG
- Current Color (RGB) - green component.
CurrB
protected static int CurrB
- Current Color (RGB) - blue component.
BW
public static boolean BW
- Black and White printing option if true, ignore setcolor and print all colours as black.

PostScript
public PostScript()

preAmble
public static String preAmble(boolean encap,
boolean land,
Paper pge,
int sw,
int sl)
- Pre-amble information for a minimally conforming PostScript document. Specifies type of PostScript (encapsulated or note) and orientation (landscape or not).
preAmble
public static String preAmble(boolean encap,
boolean landscape)
- Provided for compatibility with previous versions - no paper size is selected.
preAmble
public static String preAmble(boolean encap)
- Provided for compatibility with previous versions - orienation is assumed to be portrait.
postAmble
public static String postAmble(boolean encap)
- Trailing information to complete a PostScript document.
drawString
public static String drawString(String str,
int x,
int y)
- write the String str to the PostScript page. Precondition: str contains no newlines.
drawString
public static String drawString(String str,
String x,
String y)
- write String str to PostScript page. Precondition: str contains no newlines, and x and y are PostScript commands that evaluate to a single numeric value
whichFont
public static String whichFont(Font fnt)
- Return a PostScript font name for fnt. If fnt is TimesRoman, Courier, Helvetica, or Symbol, this is the corresponding font. Any other font is returned as Courier.
setFont
public static String setFont(Graphics g,
Font fnt)
- Set the PostScript font to fnt, scaling point size. The font must be TimesRoman, Courier, Helvetica, or Symbol.
setFont
protected static String setFont(Font fnt)
- Set the PostScript font to fnt if fnt is TimesRoman, Courier, or Helvetica, or Symbol. Otherwise, set font to Courier. This method blindly sets the point size without scaling.
drawLine
public static String drawLine(int x1,
int y1,
int x2,
int y2)
- Draw a line from (x1,y1) to (x2,y2).
fillRect
public static String fillRect(int x,
int y,
int w,
int h)
- Draw a filled rectangle with left corner (x,y) and dimensions w * h.
fillRect
public static String fillRect(String x,
String y,
String w,
String h)
drawRect
public static String drawRect(int x,
int y,
int w,
int h)
- Draw an outline of a rectangle with left corner (x,y) and dimensions w * h.
drawRect
public static String drawRect(String x,
String y,
String w,
String h)
- Same as the above, but takes coordinates and dimensions as Strings of PostScript (which may be String representing of numbers). All sequences of commands must evaluate to a single integer in the 4th 4th quadrant (ie x>= 0, y <= 0).
setColor
public static String setColor(Color c)
- Set the PostScript colour to c.
setColor
public static String setColor(int r,
int g,
int b)
- Set a colour with RGB settings r, g, b modulo 255.
public static String insertComment(String str)
- Add a single line comment. Precondition: str must contain no newlines.
stringWidth
public static String stringWidth(Graphics g,
Font f,
String str)
All Packages Class Hierarchy This Package Previous Next Index