Package rma.util.postscript
Class PSGrBase
java.lang.Object
java.awt.Graphics
java.awt.Graphics2D
rma.util.postscript.PSGrBase
- Direct Known Subclasses:
PSGr2
PSGr is a Graphics subclass that images to PostScript.
(C) 1996 E.J. Friedman-Hill and Sandia National Labs
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color
The background color of the current widget.protected static final int
number of chars in a full row of pixel dataprotected Rectangle
protected Color
The current colorstatic final boolean
protected Font
The current fontprotected static final char[]
hexadecimal digitsprotected PrintWriter
Output stream where postscript goesprotected static final int
protected static final int
protected static final int
protected static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRenderingHints
(Map map) protected void
arcTo
(int x1, int y1, int x2, int y2, int dim) void
clearRect
(int x, int y, int width, int height) Clears the specified rectangle by filling it with the current background color of the current drawing surface.void
void
clipRect
(int x, int y, int width, int height) Deprecated.void
copyArea
(int x, int y, int width, int height, int dx, int dy) Copies an area of the screen.create()
Creates a new PSGr Object that is a copy of the original PSGr Object.protected void
diagnostic
(String s) void
dispose()
Disposes of this graphics context.protected void
doArc
(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill) protected boolean
doImage
(Image img, int x, int y, int width, int height, int sx, int sy, int sw, int sh, ImageObserver observer, Color bgcolor) protected void
doPoly
(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close) protected void
doRect
(int x, int y, int width, int height, boolean fill) protected void
doRoundRect
(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill) void
void
draw3DRect
(int x, int y, int width, int height, boolean raised) Draws a highlighted 3-D rectangle.void
drawArc
(int x, int y, int width, int height, int startAngle, int arcAngle) Draws an arc bounded by the specified rectangle from startAngle to endAngle.void
drawBytes
(byte[] data, int offset, int length, int x, int y) Draws the specified bytes using the current font and color.void
drawChars
(char[] data, int offset, int length, int x, int y) Draws the specified characters using the current font and color.void
drawGlyphVector
(GlyphVector vec, float x, float y) void
drawImage
(BufferedImage image, BufferedImageOp op, int x, int y) boolean
drawImage
(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, Color c, ImageObserver observer) Warning this is not yet supportedboolean
drawImage
(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, ImageObserver observer) Warning this is not yet supportedboolean
drawImage
(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws the specified image inside the specified rectangle.boolean
drawImage
(Image img, int x, int y, int width, int height, ImageObserver observer) Draws the specified image inside the specified rectangle.boolean
drawImage
(Image img, int x, int y, Color bgcolor, ImageObserver observer) Draws the specified image at the specified coordinate (x, y).boolean
drawImage
(Image img, int x, int y, ImageObserver observer) Draws the specified image at the specified coordinate (x, y).boolean
drawImage
(Image image, AffineTransform xform, ImageObserver observer) void
drawLine
(int x1, int y1, int x2, int y2) Draws a line between the coordinates (x1,y1) and (x2,y2).void
drawOval
(int x, int y, int width, int height) Draws an oval inside the specified rectangle using the current color.void
drawPolygon
(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.void
Draws a polygon defined by the specified point.void
drawPolyline
(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.void
drawRect
(int x, int y, int width, int height) Draws the outline of the specified rectangle using the current color.void
drawRenderableImage
(RenderableImage image, AffineTransform xform) void
drawRenderedImage
(RenderedImage img, AffineTransform xform) void
drawRoundRect
(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws an outlined rounded corner rectangle using the current color.void
drawString
(String s, float x, float y) void
drawString
(String str, int x, int y) Draws the specified String using the current font and color.void
drawString
(AttributedCharacterIterator iterator, float x, float y) protected void
emitColorImageProlog
(int xdim) protected void
Top of every PS filevoid
void
void
fill3DRect
(int x, int y, int width, int height, boolean raised) Paints a highlighted 3-D rectangle using the current color.void
fillArc
(int x, int y, int width, int height, int startAngle, int arcAngle) Fills an arc using the current color.void
fillOval
(int x, int y, int width, int height) Fills an oval inside the specified rectangle using the current color.void
fillPolygon
(int[] xPoints, int[] yPoints, int nPoints) Fills a polygon with the current color.void
Fills the specified polygon with the current color.void
fillRect
(int x, int y, int width, int height) Fills the specified rectangle with the current color.void
fillRoundRect
(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws a rounded rectangle filled in with the current color.void
finalize()
Disposes of this graphics context once it is no longer referenced.getClip()
Returns the bounding rectangle of the current clipping area.Returns the bounding rectangle of the current clipping area.Deprecated.getColor()
Gets the current color.getFont()
Gets the current font.Gets the current font metrics.Gets the current font metrics for the specified font.getPaint()
void
grestore()
void
gsave()
boolean
protected void
lineto
(int x, int y) protected void
moveto
(int x, int y) void
rotate
(double theta) void
rotate
(double theta, double x, double y) void
scale
(double x, double y) Scales the graphics context.void
Gets the current color.void
setClip
(int x, int y, int width, int height) Clips to a rectangle.void
Sets the clipping region using the shape's bounding rectangle.void
Sets the current color to the specified color.void
protected void
setdash
(float[] dashstyle, float dashphase) void
Sets the font for all subsequent text-drawing operations.void
Change the Writer this context's output goes to.void
void
Sets the default paint mode to overwrite the destination with the current color.void
setRenderingHint
(RenderingHints.Key kintKey, Object hintValue) void
setRenderingHints
(Map hints) void
void
setTransform
(AffineTransform xform) void
setXORMode
(Color c1) Sets the paint mode to alternate between the current color and the new specified color.void
shear
(double shx, double shy) protected void
stroke
(boolean fill) toString()
Returns a String object representing this Graphic's value.void
transform
(AffineTransform xform) protected int
transformY
(int y) Flip Y coords so Postscript looks like Javavoid
translate
(double x, double y) void
translate
(int x, int y) Translates the specified parameters into the origin of the graphics context.Methods inherited from class java.awt.Graphics2D
drawString
Methods inherited from class java.awt.Graphics
create, getClipBounds, hitClip
-
Field Details
-
DEBUG
public static final boolean DEBUG- See Also:
-
PAGEHEIGHT
protected static final int PAGEHEIGHT- See Also:
-
PAGEWIDTH
protected static final int PAGEWIDTH- See Also:
-
XOFFSET
protected static final int XOFFSET- See Also:
-
YOFFSET
protected static final int YOFFSET- See Also:
-
hd
protected static final char[] hdhexadecimal digits -
charsPerRow
protected static final int charsPerRownumber of chars in a full row of pixel data- See Also:
-
os
Output stream where postscript goes -
clr
The current color -
backClr
The background color of the current widget. It's up to the client software to set this correctly! -
font
The current font -
clippingRect
-
-
Constructor Details
-
PSGrBase
public PSGrBase()Constructs a new PSGr Object that write to stdout. Unlike regular Graphics objects, PSGr contexts can be created directly. -
PSGrBase
Constructs a new PSGr Object. Unlike regular Graphics objects, PSGr contexts can be created directly.- Parameters:
w
- Output stream for PostScript output
-
PSGrBase
Constructs a new PSGr Object. Unlike regular Graphics objects, PSGr contexts can be created directly.- Parameters:
w
- Output stream for PostScript output
-
-
Method Details
-
create
Creates a new PSGr Object that is a copy of the original PSGr Object. Not implemented; throws RuntimeException -
setOutput
Change the Writer this context's output goes to. -
translate
public void translate(int x, int y) Translates the specified parameters into the origin of the graphics context. All subsequent operations on this graphics context will be relative to this origin.- Specified by:
translate
in classGraphics2D
- Parameters:
x
- the x coordinatey
- the y coordinate- See Also:
-
scale
public void scale(double x, double y) Scales the graphics context. All subsequent operations on this graphics context will be affected.- Specified by:
scale
in classGraphics2D
- Parameters:
x
- the scaled x coordinatey
- the scaled y coordinate- See Also:
-
lineto
protected void lineto(int x, int y) -
moveto
protected void moveto(int x, int y) -
getColor
Gets the current color. -
setBackground
Gets the current color.- Specified by:
setBackground
in classGraphics2D
- See Also:
-
setColor
Sets the current color to the specified color. All subsequent graphics operations will use this specified color. -
setPaintMode
public void setPaintMode()Sets the default paint mode to overwrite the destination with the current color. PostScript has only paint mode.- Specified by:
setPaintMode
in classGraphics
-
setXORMode
Sets the paint mode to alternate between the current color and the new specified color. PostScript does not support XOR mode.- Specified by:
setXORMode
in classGraphics
- Parameters:
c1
- the second color
-
getFont
Gets the current font. -
setFont
Sets the font for all subsequent text-drawing operations. -
getFontMetrics
Gets the current font metrics.- Overrides:
getFontMetrics
in classGraphics
- See Also:
-
getFontMetrics
Gets the current font metrics for the specified font.- Specified by:
getFontMetrics
in classGraphics
- Parameters:
f
- the specified font- See Also:
-
getClipRect
Deprecated.Returns the bounding rectangle of the current clipping area.- Overrides:
getClipRect
in classGraphics
- See Also:
-
getClip
Returns the bounding rectangle of the current clipping area. -
setClip
Sets the clipping region using the shape's bounding rectangle. -
getClipBounds
Returns the bounding rectangle of the current clipping area.- Specified by:
getClipBounds
in classGraphics
- Returns:
- the bounding rectangle
- See Also:
-
setClip
public void setClip(int x, int y, int width, int height) Clips to a rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. Graphic operations have no effect outside of the clipping area. -
clipRect
Deprecated. -
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy) Copies an area of the screen. -
drawLine
public void drawLine(int x1, int y1, int x2, int y2) Draws a line between the coordinates (x1,y1) and (x2,y2). The line is drawn below and to the left of the logical coordinates. -
doRect
protected void doRect(int x, int y, int width, int height, boolean fill) -
fillRect
public void fillRect(int x, int y, int width, int height) Fills the specified rectangle with the current color. -
drawRect
public void drawRect(int x, int y, int width, int height) Draws the outline of the specified rectangle using the current color. Use drawRect(x, y, width-1, height-1) to draw the outline inside the specified rectangle. -
clearRect
public void clearRect(int x, int y, int width, int height) Clears the specified rectangle by filling it with the current background color of the current drawing surface. Which drawing surface it selects depends on how the graphics context was created. -
doRoundRect
protected void doRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill) -
stroke
protected void stroke(boolean fill) -
arcTo
protected void arcTo(int x1, int y1, int x2, int y2, int dim) -
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws an outlined rounded corner rectangle using the current color.- Specified by:
drawRoundRect
in classGraphics
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglearcWidth
- the diameter of the arcarcHeight
- the radius of the arc- See Also:
-
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws a rounded rectangle filled in with the current color.- Specified by:
fillRoundRect
in classGraphics
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglearcWidth
- the diameter of the arcarcHeight
- the radius of the arc- See Also:
-
draw3DRect
public void draw3DRect(int x, int y, int width, int height, boolean raised) Draws a highlighted 3-D rectangle.- Overrides:
draw3DRect
in classGraphics2D
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleraised
- a boolean that states whether the rectangle is raised or not
-
fill3DRect
public void fill3DRect(int x, int y, int width, int height, boolean raised) Paints a highlighted 3-D rectangle using the current color.- Overrides:
fill3DRect
in classGraphics2D
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleraised
- a boolean that states whether the rectangle is raised or not
-
drawOval
public void drawOval(int x, int y, int width, int height) Draws an oval inside the specified rectangle using the current color. -
fillOval
public void fillOval(int x, int y, int width, int height) Fills an oval inside the specified rectangle using the current color. -
doArc
protected void doArc(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill) -
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Draws an arc bounded by the specified rectangle from startAngle to endAngle. 0 degrees is at the 3-o'clock position.Positive arc angles indicate counter-clockwise rotations, negative arc angles are drawn clockwise. -
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Fills an arc using the current color. This generates a pie shape. -
doPoly
protected void doPoly(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close) -
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.- Specified by:
drawPolyline
in classGraphics
- Parameters:
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of points- See Also:
-
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) Draws a polygon defined by an array of x points and y points.- Specified by:
drawPolygon
in classGraphics
- Parameters:
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of points- See Also:
-
drawPolygon
Draws a polygon defined by the specified point.- Overrides:
drawPolygon
in classGraphics
- Parameters:
p
- the specified polygon- See Also:
-
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) Fills a polygon with the current color.- Specified by:
fillPolygon
in classGraphics
- Parameters:
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of points- See Also:
-
fillPolygon
Fills the specified polygon with the current color.- Overrides:
fillPolygon
in classGraphics
- Parameters:
p
- the polygon- See Also:
-
drawString
Draws the specified String using the current font and color. The x,y position is the starting point of the baseline of the String.- Specified by:
drawString
in classGraphics2D
- Parameters:
str
- the String to be drawnx
- the x coordinatey
- the y coordinate- See Also:
-
drawChars
public void drawChars(char[] data, int offset, int length, int x, int y) Draws the specified characters using the current font and color. -
drawBytes
public void drawBytes(byte[] data, int offset, int length, int x, int y) Draws the specified bytes using the current font and color. -
doImage
protected boolean doImage(Image img, int x, int y, int width, int height, int sx, int sy, int sw, int sh, ImageObserver observer, Color bgcolor) -
drawImage
Draws the specified image at the specified coordinate (x, y). If the image is incomplete the image observer will be notified later. -
drawImage
public boolean drawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, ImageObserver observer) Warning this is not yet supported -
drawImage
public boolean drawImage(Image img, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, Color c, ImageObserver observer) Warning this is not yet supported -
drawImage
Draws the specified image inside the specified rectangle. The image is scaled if necessary. If the image is incomplete the image observer will be notified later. -
drawImage
Draws the specified image at the specified coordinate (x, y). If the image is incomplete the image observer will be notified later. -
drawImage
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws the specified image inside the specified rectangle. The image is scaled if necessary. If the image is incomplete the image observer will be notified later. -
dispose
public void dispose()Disposes of this graphics context. The Graphics context cannot be used after being disposed of. -
finalize
public void finalize()Disposes of this graphics context once it is no longer referenced. -
toString
Returns a String object representing this Graphic's value. -
transformY
protected int transformY(int y) Flip Y coords so Postscript looks like Java -
emitProlog
protected void emitProlog()Top of every PS file -
emitColorImageProlog
protected void emitColorImageProlog(int xdim) -
gsave
public void gsave() -
grestore
public void grestore() -
emitThis
-
diagnostic
-
setdash
protected void setdash(float[] dashstyle, float dashphase) -
rotate
public void rotate(double theta) - Specified by:
rotate
in classGraphics2D
-
rotate
public void rotate(double theta, double x, double y) - Specified by:
rotate
in classGraphics2D
-
getComposite
- Specified by:
getComposite
in classGraphics2D
-
drawString
- Specified by:
drawString
in classGraphics2D
-
drawRenderableImage
- Specified by:
drawRenderableImage
in classGraphics2D
-
drawRenderedImage
- Specified by:
drawRenderedImage
in classGraphics2D
-
addRenderingHints
- Specified by:
addRenderingHints
in classGraphics2D
-
getRenderingHint
- Specified by:
getRenderingHint
in classGraphics2D
-
getRenderingHints
- Specified by:
getRenderingHints
in classGraphics2D
-
setRenderingHint
- Specified by:
setRenderingHint
in classGraphics2D
-
setRenderingHints
- Specified by:
setRenderingHints
in classGraphics2D
-
getPaint
- Specified by:
getPaint
in classGraphics2D
-
hit
- Specified by:
hit
in classGraphics2D
-
drawGlyphVector
- Specified by:
drawGlyphVector
in classGraphics2D
-
setComposite
- Specified by:
setComposite
in classGraphics2D
-
draw
- Specified by:
draw
in classGraphics2D
-
drawImage
- Specified by:
drawImage
in classGraphics2D
-
drawImage
- Specified by:
drawImage
in classGraphics2D
-
shear
public void shear(double shx, double shy) - Specified by:
shear
in classGraphics2D
-
clip
- Specified by:
clip
in classGraphics2D
-
fill
- Specified by:
fill
in classGraphics2D
-
transform
- Specified by:
transform
in classGraphics2D
-
drawString
- Specified by:
drawString
in classGraphics2D
-
getTransform
- Specified by:
getTransform
in classGraphics2D
-
setTransform
- Specified by:
setTransform
in classGraphics2D
-
getBackground
- Specified by:
getBackground
in classGraphics2D
-
getDeviceConfiguration
- Specified by:
getDeviceConfiguration
in classGraphics2D
-
getFontRenderContext
- Specified by:
getFontRenderContext
in classGraphics2D
-
setPaint
- Specified by:
setPaint
in classGraphics2D
-
translate
public void translate(double x, double y) - Specified by:
translate
in classGraphics2D
-
getStroke
- Specified by:
getStroke
in classGraphics2D
-
setStroke
- Specified by:
setStroke
in classGraphics2D
-